---
title: "POST /api/projects/{project_id}/tracing/spans/service_health/"
method: POST
path: "/api/projects/{project_id}/tracing/spans/service_health/"
tags: ["tracing"]
---

# POST /api/projects/{project_id}/tracing/spans/service_health/

`POST /api/projects/{project_id}/tracing/spans/service_health/`

## Request

- Base URL: `https://us.posthog.com`
- URL: `https://us.posthog.com/api/projects/{project_id}/tracing/spans/service_health/`
- Auth: HTTP bearer

## Path parameters

- `project_id` string, required

## Request body

- ServiceHealthRequest
  - `query` ServiceHealthQuery, required
    - `dateRange` ServiceHealthDateRange
      - `date_from` string, nullable: Relative (-30m, -6h, -7d) or ISO 8601.
      - `date_to` string, nullable: Same format. Omit or null for "now".
    - `compare` 'none' | 'previous_period' | 'previous_day' | 'previous_week': * `none` - None * `previous_period` - Previous Period * `previous_day` - Previous Day * `previous_week` - Previous Week
    - `environment` string, nullable: Only this environment, matched without case on deployment.environment.name, then deployment.environment, then env.
    - `serviceNames` string[]: Only these services.
    - `spanScope` 'entry' | 'all': * `entry` - Entry * `all` - All
    - `orderBy` 'status' | 'error_rate' | 'p95' | 'throughput' | 'error_count': * `status` - Status * `error_rate` - Error Rate * `p95` - P95 * `throughput` - Throughput * `error_count` - Error Count
    - `limit` integer: Max service rows, 1-200.
  - `baselineDateRange` ServiceHealthDateRange
    - `date_from` string, nullable: Relative (-30m, -6h, -7d) or ISO 8601.
    - `date_to` string, nullable: Same format. Omit or null for "now".

## Response `200`

- ServiceHealthResponse
  - `window` ServiceHealthWindow, required
    - `current` ServiceHealthTimeRange, required
      - `date_from` string, required: Start, ISO 8601 UTC, inclusive.
      - `date_to` string, required: End, ISO 8601 UTC, exclusive.
    - `baseline` ServiceHealthTimeRange, required
      - `date_from` string, required: Start, ISO 8601 UTC, inclusive.
      - `date_to` string, required: End, ISO 8601 UTC, exclusive.
    - `timezone` string, required: Always UTC.
  - `summary` ServiceHealthSummary, required
    - `services` integer, required: Services scored, before the limit.
    - `requests` integer, required: Requests over all scored services.
    - `ok` integer, required: Services per status.
    - `degraded` integer, required: Services per status.
    - `regressed` integer, required: Services per status.
    - `silent` integer, required: Services per status.
    - `new` integer, required: Services per status.
    - `recovered` integer, required: Services per status.
    - `improved` integer, required: Services per status.
  - `services` ServiceHealthRow[], required: One row per service, in orderBy order.
    - `service` string, required: Service name.
    - `status` 'silent' | 'regressed' | 'degraded' | 'new' | 'recovered' | 'improved' | 'ok', required: * `silent` - Silent * `regressed` - Regressed * `degraded` - Degraded * `new` - New * `recovered` - Recovered * `improved` - Improved * `ok` - Ok
    - `reason` string, required: Why the service has this status. Empty for ok.
    - `requests` integer, required: Spans in the window, in the chosen spanScope.
    - `throughput_per_min` number, double, required: Requests per minute.
    - `error_count` integer, required: Requests with OTel status Error.
    - `error_rate_pct` number, double, nullable, required: Error share of requests, percent.
    - `error_rate_delta_pp` number, double, nullable, required: Change from the baseline, points.
    - `p50_ms` number, double, nullable, required: Median duration, ms.
    - `p95_ms` number, double, nullable, required: 95th percentile duration, ms.
    - `p95_change_pct` number, double, nullable, required: p95 change from the baseline, percent.
    - `p99_ms` number, double, nullable, required: 99th percentile duration, ms.
    - `baseline_requests` integer, nullable, required: Baseline requests. Null without one.
    - `last_seen` string, nullable, required: Last span, ISO 8601 UTC.
  - `next` ServiceHealthNextCall[], required: Prefilled follow-up calls.
    - `tool` string, required: The tool to call next.
    - `why` string, required: What the call answers.
    - `query` object, required: The prefilled query argument.
  - `truncated` boolean, required: True when more services matched than limit.
  - `notes` string[], required: Caveats about this result.

## Changes

> 53 revisions in range; 1 not diffed.

- **2026-10-21** `04a392d92a14`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/posthog/apis/posthog-api/changes/api/projects/:project_id/tracing/spans/service_health/post.md)

---

[API](https://skmtc.dev/posthog/apis/posthog-api.md) · [All operations](https://skmtc.dev/posthog/apis/posthog-api/llms.txt) · [OpenAPI document](https://skmtc.dev/posthog/apis/posthog-api/revisions/993f70ab941b?raw)
