> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squasher.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Services API

> List services with health, latency, and the last release, read one service in detail, and get the service map with its databases.

A service is one `service.name` that sends server or consumer spans. The Services API returns the
request rate, error rate, latency, and health of each service, its operations and dependencies,
and the map of calls between services and databases. See
[Services and releases](/features/services-and-releases) for how Squasher finds services and sets
their health.

## Operations

| Operation | Method and path | Purpose |
| - | - | - |
| `services.list` | `GET /v1/projects/{project_id}/services/catalog` | List services with metrics, health, and the last release. |
| `services.get` | `GET /v1/projects/{project_id}/services/catalog/{service_name}` | Read one service: summary, series, operations, dependencies, and releases. |
| `services.map` | `GET /v1/projects/{project_id}/services/map` | Read the service map: service and database nodes, and the calls between. |

All three operations need the `errors:read` scope. URL-encode `service_name`.

## Query parameters

Every operation takes a window and an environment:

| Parameter | Values | Default |
| - | - | - |
| `from` | ISO 8601 timestamp | 24 hours before `to` |
| `to` | ISO 8601 timestamp | Now |
| `environment` | A `deployment.environment.name`, for example `production`. Empty (`environment=`): telemetry without an environment | All environments |

The window is at most 7 days. `services.list` also takes these parameters:

| Parameter | Values | Default |
| - | - | - |
| `health` | `healthy`, `degraded`, `failing`, `no_data` | All services |
| `q` | Text that the service name contains, at most 200 characters | All services |
| `sort` | `count`, `error_rate`, `p95`, `last_seen` | `count` (most requests first) |
| `limit` | 1 to 100 | 100 |

## List services

```bash theme={null}
curl --get \
  --url "https://api.squasher.ai/v1/projects/$SQUASHER_PROJECT_ID/services/catalog" \
  --header "x-squasher-key: $SQUASHER_API_KEY" \
  --data-urlencode "environment=production" \
  --data-urlencode "sort=error_rate"
```

```json theme={null}
{
  "data": [
    {
      "service_name": "checkout-api",
      "status": "degraded",
      "request_count": 48210,
      "error_count": 731,
      "error_rate": 1.52,
      "p50_ms": 41,
      "p95_ms": 380,
      "p99_ms": 1210,
      "throughput_per_min": 33.5,
      "last_seen": "2026-10-11T09:29:41.000Z",
      "last_release": {
        "id": "rel_WyJwcm9kdWN0aW9uIiwiY2hlY2tvdXQtYXBpIiwiMi40LjEiXQ",
        "service_name": "checkout-api",
        "environment": "production",
        "version": "2.4.1",
        "confidence": "confirmed",
        "started_at": "2026-10-10T16:02:11.000Z",
        "ended_at": null,
        "is_current": true,
        "first_seen": "2026-10-10T16:02:40.000Z",
        "last_seen": "2026-10-11T09:29:41.000Z",
        "commit_sha": "9f2c1e7",
        "deployment_count": 1,
        "previous_release_id": "rel_WyJwcm9kdWN0aW9uIiwiY2hlY2tvdXQtYXBpIiwiMi40LjAiXQ"
      }
    }
  ],
  "status_counts": { "healthy": 6, "degraded": 1, "failing": 0, "no_data": 1 },
  "total_services": 8,
  "environment": "production",
  "environments": ["production", "staging"],
  "from": "2026-10-10T09:30:00.000Z",
  "to": "2026-10-11T09:30:00.000Z",
  "truncated": false
}
```

The JSON is shortened to one service.

| Field | Description |
| - | - |
| `data` | One row for each service: metrics, `status` (health), `last_seen`, and `last_release` (`null` without a release). |
| `counts_approximate` | `true` when the project has more services than one read groups (about 20,000). `status_counts` and `total_services` then count only part of them. |
| `status_counts` | Services for each health, over every service in the window, before the `health` filter and `limit`. |
| `total_services` | Services that match `environment`, `q`, and `health`, before `limit`. |
| `environments` | Environments that sent telemetry in the window. Use one as `environment`. |
| `truncated` | `true` when more services match than the response holds. |

Rates are percents from 0 to 100. Latencies are in milliseconds. `throughput_per_min` is requests per
minute over the window.

## Read one service

```bash theme={null}
curl --get \
  --url "https://api.squasher.ai/v1/projects/$SQUASHER_PROJECT_ID/services/catalog/checkout-api" \
  --header "x-squasher-key: $SQUASHER_API_KEY" \
  --data-urlencode "environment=production"
```

```json theme={null}
{
  "service_name": "checkout-api",
  "status": "degraded",
  "environment": "production",
  "environments": ["production", "staging"],
  "from": "2026-10-10T09:30:00.000Z",
  "to": "2026-10-11T09:30:00.000Z",
  "granularity": "hour",
  "summary": {
    "request_count": 48210,
    "error_count": 731,
    "error_rate": 1.52,
    "p50_ms": 41,
    "p95_ms": 380,
    "p99_ms": 1210,
    "throughput_per_min": 33.5,
    "last_seen": "2026-10-11T09:29:41.000Z"
  },
  "series": [
    {
      "time": "2026-10-10T10:00:00.000Z",
      "request_count": 2011,
      "error_count": 22,
      "error_rate": 1.09,
      "p50_ms": 40,
      "p95_ms": 352,
      "p99_ms": 1104
    }
  ],
  "operations": [
    {
      "operation_name": "POST /checkout",
      "request_count": 12904,
      "error_count": 402,
      "error_rate": 3.12,
      "p50_ms": 95,
      "p95_ms": 610,
      "p99_ms": 1820,
      "last_seen": "2026-10-11T09:29:41.000Z"
    }
  ],
  "dependencies": {
    "upstream": [
      { "name": "web", "request_count": 40112, "error_rate": 1.4, "avg_latency_ms": 88 }
    ],
    "downstream": [
      { "name": "payments", "request_count": 12790, "error_rate": 0.6, "avg_latency_ms": 140 }
    ],
    "databases": [
      { "name": "postgresql", "request_count": 96044, "error_rate": 0, "avg_latency_ms": 4.2 }
    ]
  },
  "releases": []
}
```

* `upstream` lists the services that call this service. `downstream` lists the services it calls.
  `databases` lists the database systems it calls, by `db.system.name`.
* `releases` lists the releases of the service that served in the window, newest first. Each item
  has the same fields as `last_release` above.
* `series` has one point for each `granularity` bucket.

A service that sent no spans in the window answers with `status: "no_data"` and empty sections, not an error.

## Read the service map

```bash theme={null}
curl --get \
  --url "https://api.squasher.ai/v1/projects/$SQUASHER_PROJECT_ID/services/map" \
  --header "x-squasher-key: $SQUASHER_API_KEY" \
  --data-urlencode "environment=production"
```

```json theme={null}
{
  "nodes": [
    {
      "id": "service:checkout-api",
      "kind": "service",
      "name": "checkout-api",
      "status": "degraded",
      "request_count": 48210,
      "error_rate": 1.52,
      "avg_latency_ms": 96
    },
    {
      "id": "database:postgresql",
      "kind": "database",
      "name": "postgresql",
      "status": "healthy",
      "request_count": 96044,
      "error_rate": 0,
      "avg_latency_ms": 4.2
    }
  ],
  "edges": [
    {
      "source": "service:checkout-api",
      "target": "database:postgresql",
      "kind": "database",
      "request_count": 96044,
      "error_rate": 0,
      "avg_latency_ms": 4.2
    }
  ],
  "environment": "production",
  "environments": ["production", "staging"],
  "from": "2026-10-10T09:30:00.000Z",
  "to": "2026-10-11T09:30:00.000Z"
}
```

A node `id` is `service:<service.name>` or `database:<db.system.name>`. An edge `kind` is `call`
(service to service) or `database` (service to database). `source` and `target` are node IDs.

## Errors

| Status | When |
| - | - |
| `400` | A parameter is not valid, for example an unknown `health` or a `limit` above 100. |
| `403` | The key does not have `errors:read` on the project. |
| `422` | `from` is after `to`, or the window is longer than 7 days. |

## TypeScript client, CLI, and MCP

```typescript theme={null}
const services = await client.services.list({ environment: "production", health: "failing" });
const checkout = await client.services.get("checkout-api", { environment: "production" });
const map = await client.services.map({ environment: "production" });
```

```bash theme={null}
squasher services list --project <project_id> --environment production --sort error_rate
squasher services get --project <project_id> checkout-api
squasher services map --project <project_id> --environment production
```

Add `--json` to print the full response. In MCP Code Mode, call `search("services")` first, then
`execute` with `services.list`, `services.get`, or `services.map`.

## Related guides

* [Services and releases](/features/services-and-releases)
* [Releases API](/api-reference/releases)
* [Traces API](/api-reference/traces)
* [Send traces with OpenTelemetry](/integrations/opentelemetry)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.