---
title: Sessions
summary: This endpoint returns session logs for requests made through <a href="https://www.fastly.com/documentation/reference/api/ai-runtime-control">AI Runtime Control</a>, including request and response data and metadata, for debugging and audit purposes.
url: https://www.fastly.com/documentation/reference/api/ai-runtime-control/sessions
---

This endpoint returns session logs for requests made through <a href="https://www.fastly.com/documentation/reference/api/ai-runtime-control">AI Runtime Control</a>, including request and response data and metadata, for debugging and audit purposes.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `created_at` | string | The date and time the session was created, in RFC 3339 format. (Read-only) |
| `firewall_enabled` | boolean | Whether AI Firewall was enabled for this session's virtual key. |
| `firewall_incomplete_reason` | string | Why AI Firewall inspection was incomplete, if applicable. Present only when AI Firewall ran and inspection didn't complete. |
| `firewall_outcome` | string | The outcome AI Firewall reached for this session. Present only when AI Firewall ran. |
| `firewall_policy` | string | The AI Firewall policy that was applied. Present only when AI Firewall ran. |
| `firewall_stage` | string | The AI Firewall stage that produced the outcome (for example, the request or response stage). Present only when AI Firewall ran. |
| `id` | string | The unique identifier of the session. (Read-only) |
| `input_tokens` | integer | The total input tokens consumed in this session. |
| `logs` | array | The request and response pairs recorded for this session. |
| `model` | string | The AI model identifier used. |
| `output_tokens` | integer | The total output tokens generated in this session. |
| `primary_provider` | string | The ID of the provider connection originally requested, before any failover occurred. |
| `provider` | string | The name of the provider connection that ultimately served the session. |
| `provider_connection_id` | string | The ID of the provider connection that ultimately served the session. |
| `requests` | integer | The number of requests made in this session. |
| `updated_at` | string | The date and time the session was last updated, in RFC 3339 format. (Read-only) |
| `violations` | integer | The number of AI Firewall violations detected in this session. |
| `virtual_key_id` | string | The ID of the virtual key used for this session. |
| `virtual_key_name` | string | The display name of the virtual key used for this session. |
| `attrs` | object | Additional attributes recorded for this request/response pair. |
| `request` | string | The raw request data. |
| `response` | string | The raw response data. |
| `limit` | integer | The <code>limit</code> value used when making the request. |
| `next_cursor` | string | The cursor to use to request the next page of results. <code>null</code> when there are no more results. |
| `prev_cursor` | string | The cursor to use to request the previous page of results. <code>null</code> when there is no previous page. |
| `sort` | string | The <code>sort</code> value used when making the request. |
| `total` | integer | The count of results matching the request. |
| `meta` | object | Metadata about the request. |

## API endpoints

### Get session logs

**GET** `/ai-runtime-control/v1/sessions`

Returns session logs, including request and response data and metadata, for debugging and audit purposes.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `cursor` | string | query | No | Cursor for pagination. Use the <code>next_cursor</code> value from a previous response to request the next page of results, or the <code>prev_cursor</code> value to request the previous page. |
| `from` | string | query | No | The start of the time range, in RFC 3339 format. |
| `key` | string | query | No | Filter results to a specific virtual key ID. |
| `limit` | integer | query | No | Limit how many results are returned. |
| `model` | string | query | No | Filter results by AI model identifier. |
| `provider` | string | query | No | Filter results by AI provider connection ID. |
| `sort` | string | query | No | Sort field. Prefix with <code>-</code> for descending order (e.g., <code>sort=-created_at</code>). |
| `to` | string | query | No | The end of the time range, in RFC 3339 format. Defaults to <code>now</code>. |

