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

> List Forward sessions with filters and cursor pagination.

`GET /api/v1/forward/sessions`

Lists sessions under the authenticated account. Archived sessions are excluded by default.

## Headers

| Header          | Required | Description    |
| --------------- | -------- | -------------- |
| `Authorization` | Yes      | `Bearer <PAT>` |

## Query parameters

| Parameter          | Type            | Required | Default | Description                                                                     |
| ------------------ | --------------- | -------- | ------- | ------------------------------------------------------------------------------- |
| `identity_ids`     | string or array | No       | -       | Filter by one or more Identity IDs. Comma-separated strings are supported.      |
| `template_id`      | string          | No       | -       | Filter by Forward Template ID.                                                  |
| `source_type`      | string          | No       | -       | Filter by `api`, `im`, or `schedule`.                                           |
| `created_at[gt]`   | string          | No       | -       | Created strictly after this RFC 3339 timestamp.                                 |
| `created_at[gte]`  | string          | No       | -       | Created at or after this RFC 3339 timestamp.                                    |
| `created_at[lt]`   | string          | No       | -       | Created strictly before this RFC 3339 timestamp.                                |
| `created_at[lte]`  | string          | No       | -       | Created at or before this RFC 3339 timestamp.                                   |
| `updated_at[gt]`   | string          | No       | -       | Updated strictly after this RFC 3339 timestamp.                                 |
| `updated_at[gte]`  | string          | No       | -       | Updated at or after this RFC 3339 timestamp.                                    |
| `updated_at[lt]`   | string          | No       | -       | Updated strictly before this RFC 3339 timestamp.                                |
| `updated_at[lte]`  | string          | No       | -       | Updated at or before this RFC 3339 timestamp.                                   |
| `limit`            | integer         | No       | 20      | Items per page. Maximum 100.                                                    |
| `after_id`         | string          | No       | -       | Cursor for records after the given Session ID. Cannot be used with `before_id`. |
| `before_id`        | string          | No       | -       | Cursor for records before the given Session ID. Cannot be used with `after_id`. |
| `order`            | string          | No       | `desc`  | Sort order: `desc` or `asc`.                                                    |
| `include_archived` | boolean         | No       | `false` | Include archived sessions.                                                      |

## Example request

```bash theme={null}
curl -s -X GET 'https://api.qoder.com/api/v1/forward/sessions?identity_ids=idn_xxx,idn_yyy&template_id=tmpl_support&source_type=im&created_at[gte]=2026-06-01T00:00:00Z&limit=20' \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "data": [
    {
      "id": "sess_xxx",
      "type": "session",
      "identity_id": "idn_xxx",
      "template": {
        "id": "tmpl_support",
        "type": "template",
        "name": "Support assistant",
        "model": "ultimate",
        "version": 3
      },
      "source_type": "im",
      "status": "idle",
      "title": "Customer support session",
      "incremental_streaming_enabled": true,
      "metadata": {
        "source": "dingtalk"
      },
      "config": {
        "environment_variables": {
          "API_KEY": "sk-xxx"
        }
      },
      "stats": {
        "active_seconds": 30,
        "duration_seconds": 3600
      },
      "usage": {
        "credits": 12.5
      },
      "archived_at": null,
      "created_at": "2026-06-22T10:00:00Z",
      "updated_at": "2026-06-22T11:00:00Z"
    }
  ],
  "first_id": "sess_xxx",
  "last_id": "sess_xxx",
  "has_more": false
}
```

## Response fields

| Field      | Type         | Description                          |
| ---------- | ------------ | ------------------------------------ |
| `data`     | array        | Session objects 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.         |

## Errors

| HTTP | Type                    | Code                      | Trigger                            |
| ---- | ----------------------- | ------------------------- | ---------------------------------- |
| 400  | `invalid_request_error` | `invalid_time_range`      | Time filters are invalid.          |
| 400  | `invalid_request_error` | `invalid_pagination`      | Pagination parameters are invalid. |
| 401  | `authentication_error`  | `authentication_required` | PAT invalid or expired.            |

## Notes

* `after_id` and `before_id` cannot be used together.
* Current design does not support filtering by `status`.
* `usage.credits` may be omitted if the credits module is not enabled.

## Related

<CardGroup cols={2}>
  <Card title="Create a session" icon="plus" href="/cloud-agents/api/forward/sessions/create" />

  <Card title="Get a session" icon="file-lines" href="/cloud-agents/api/forward/sessions/get" />
</CardGroup>
