# List traces

> A project's traces, newest first: each its root span's name, start_us, duration_us, span_count, error_count, the services it crossed and its HTTP status.

<div class="g1t-endpoint"><span class="g1t-method" data-method="get">GET</span><code>/workspaces/{workspace}/projects/{project}/observability/traces</code></div>

Filter by words in q, errors_only, min_duration_ms, environment and service, between from and to. A page holds limit; pass next back as cursor for the next. Needs a role on the project's repository.

Each trace is its root span (or its earliest, when the root has not arrived), with what the rest add up to.

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`observability`](/reference/mcp/#observability) with `action` `traces`, and the same inputs
- **Scope:** An access token needs [`observability:read`](/guides/authentication/#scopes).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace` | string | Yes | The workspace's slug, e.g. "flagon-io". |
| `project` | string | Yes | The project's slug, as in g1t.sh/{workspace}/{project}. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | No | The start of the period: an RFC 3339 time or Unix milliseconds. 24 hours before `to` unless you say. |
| `to` | string | No | The end of the period: an RFC 3339 time or Unix milliseconds. Now unless you say. |
| `q` | string | No | Words to find, all of them, or a phrase in quotes. |
| `errors_only` | boolean | No | Only traces with a span that failed. |
| `min_duration_ms` | integer | No | Only traces that took at least this many milliseconds. |
| `environment` | string | No | Only what ran in this environment, such as production or preview; several comma-separated. |
| `service` | string | No | Only what this service sent (OpenTelemetry's service.name; an app on g1t.page is its project's name); several comma-separated. |
| `cursor` | string | No | Where to carry on from: the last page's `next`. |
| `limit` | integer | No | How many a page holds. |

## Example request

```sh
curl "https://api.g1t.sh/workspaces/flagon-io/projects/g1t/observability/traces?errors_only=true&min_duration_ms=500" \
  -H "Authorization: Bearer $G1T_TOKEN"
```

## Example response

A successful request answers `200` with:

```json
{
  "items": [
    {
      "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
      "name": "GET /:workspace/:repo/pulls/:number",
      "start_us": 1791813807418000,
      "duration_us": 842000,
      "span_count": 6,
      "error_count": 1,
      "services": [
        "g1t-web",
        "g1t-work"
      ],
      "status": 500,
      "service": "g1t-web",
      "environment": "production",
      "deployment_id": "dpl_01kq9a2c4e6g8j0m2p4r6t8v0x",
      "commit_sha": "7c1e9a4b2d6f80135ac9e2b7d4f6a8c0e1b3d5f7",
      "source": "otlp"
    }
  ],
  "next": null
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
