> ## 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.

# List work items

> List work items for a self-hosted Environment.

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

Lists work items for a `self_hosted` Environment. Results use cursor pagination and are returned in ascending ID order, which matches queue creation order.

## Path parameters

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

## Headers

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

## Query parameters

| Parameter   | Type    | Required | Default | Description                                                          |
| ----------- | ------- | -------- | ------- | -------------------------------------------------------------------- |
| `limit`     | integer | No       | 20      | Items per page. Must be positive; values above 100 are capped at 100 |
| `page`      | string  | No       | -       | Cursor returned by the previous response's `next_page`               |
| `before_id` | string  | No       | -       | Return records before this work item ID                              |
| `after_id`  | string  | No       | -       | Return records after this work item ID                               |

`page`, `before_id`, and `after_id` are mutually exclusive. See [Pagination](/cloud-agents/api/conventions/pagination) for cursor semantics.

## Example request

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

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "data": [
    {
      "id": "work_019f3be4fd2475d9a784bf2c739e1194",
      "type": "work",
      "environment_id": "env_019e64e01a137caf953ac2ac7b42ec5c",
      "data": {
        "type": "session",
        "id": "sess_019f3be3fa66750bb9a1fbcde85b5fe1"
      },
      "state": "queued",
      "created_at": "2026-07-01T08:15:01Z",
      "acknowledged_at": null,
      "started_at": null,
      "latest_heartbeat_at": null,
      "stop_requested_at": null,
      "stopped_at": null,
      "metadata": {
        "job": "daily-report"
      }
    }
  ],
  "first_id": "work_019f3be4fd2475d9a784bf2c739e1194",
  "last_id": "work_019f3be4fd2475d9a784bf2c739e1194",
  "has_more": false,
  "next_page": null
}
```

## Response fields

| Field       | Type                                                                                       | Description                                                                          |
| ----------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `data`      | array of [Work item objects](/cloud-agents/api/environments/work/schemas#work-item-object) | Work items on the current page                                                       |
| `first_id`  | string\|null                                                                               | ID of the first record on this page                                                  |
| `last_id`   | string\|null                                                                               | ID of the last record on this page                                                   |
| `has_more`  | boolean                                                                                    | Whether more records remain                                                          |
| `next_page` | string\|null                                                                               | Cursor for the next page. Equals `last_id` when `has_more` is true, otherwise `null` |

## Errors

| HTTP | Type                    | Trigger                                                           |
| ---- | ----------------------- | ----------------------------------------------------------------- |
| 400  | `invalid_request_error` | `limit` is not a positive integer                                 |
| 400  | `invalid_request_error` | More than one of `page`, `before_id`, and `after_id` was provided |
| 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.

## 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>
