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

# Get work queue stats

> Read queue depth and worker polling statistics for a self-hosted Environment.

`GET /api/v1/cloud/environments/{environment_id}/work/stats`

Returns queue statistics for a `self_hosted` Environment.

## Path parameters

| Parameter        | Type   | Description                           |
| ---------------- | ------ | ------------------------------------- |
| `environment_id` | string | Environment ID with the `env_` prefix |

## Headers

| Header          | Required | Description         |
| --------------- | -------- | ------------------- |
| `Authorization` | Yes      | `Bearer $QODER_PAT` |

## Example request

```bash theme={null}
curl -X GET "https://api.qoder.com/api/v1/cloud/environments/env_019e64e01a137caf953ac2ac7b42ec5c/work/stats" \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "type": "work_queue_stats",
  "depth": 3,
  "pending": 1,
  "oldest_queued_at": "2026-07-01T08:15:01Z",
  "workers_polling": 2
}
```

## Response fields

Returns a [Work queue stats object](/cloud-agents/api/environments/work/schemas#work-queue-stats-object).

## Errors

| HTTP | Type                    | Trigger                              |
| ---- | ----------------------- | ------------------------------------ |
| 400  | `invalid_request_error` | The Environment is not `self_hosted` |
| 401  | `authentication_error`  | PAT invalid or expired               |
| 403  | `permission_error`      | Not authorized for this operation    |
| 404  | `not_found_error`       | Environment not found                |

See [Errors](/cloud-agents/api/conventions/errors) for the full error envelope.

## Notes

* `depth` counts queued items that are claimable now.
* `pending` counts queued items delivered within the recent redelivery window but not yet acknowledged.
* `workers_polling` only counts poll requests that included `Worker-ID`.

## Related

<CardGroup cols={2}>
  <Card title="Cloud environment setup" icon="server" href="/cloud-agents/environments">
    Choose the container, network, and dependencies your agent runs in.
  </Card>
</CardGroup>
