# Retrieve an agent session

`GET https://api.morevoice.ai/v1/agent_sessions/{id}`

Returns the `AgentSession` object. Answers `404` with the code `resource_missing` when nothing has this ID in this organisation and mode.

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `agent_sessions_retrieve`.

## Parameters

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A agent session ID (`ags_…`). |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |

## Responses

### 200 OK

OK Returns `AgentSession`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The session's ID. |
| `object` | `"agent_session"` | — |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `user_id` | `string` | The member it signs in. |
| `external_id` | `string \| null` | Your own id for that member (managed users), else null. |
| `org_id` | `string` | The organisation it is bound to (it never switches). |
| `origin` | `string \| null` | The only website it works from, or null for any. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |
| `expires_at` | `string` | When it ends (a fixed lifetime: using it does not extend it). |
| `last_used` | `string \| null` | When it was last used (to the nearest few minutes). |

Example:

```json
{
  "created": "2026-11-03T08:00:00.000Z",
  "expires_at": "2026-11-03T16:00:00.000Z",
  "external_id": "agent-1042",
  "id": "ags_H97Oak9qchHXc1hB8b93SK",
  "last_used": "2026-11-03T09:14:22.000Z",
  "livemode": true,
  "object": "agent_session",
  "org_id": "org_87tzsRJO1egtexauAF8PwX",
  "origin": "https://app.example.com",
  "user_id": "usr_2Lm8Pq4Rt6Vx0Zb3Nd5Fh7"
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 404 Not Found

No object with this ID (in the path or the body) exists in this organisation and mode. Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const agentSession = await mv.agentSessions.retrieve("ags_7Hk2Lm9Qp");
console.log(agentSession);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

agent_session = client.agent_sessions.retrieve("ags_7Hk2Lm9Qp")
print(agent_session)
```

**cURL**

```sh
curl https://api.morevoice.ai/v1/agent_sessions/ags_7Hk2Lm9Qp \
  -H "Authorization: Bearer $MOREVOICE_API_KEY"
```
