> For AI agents: the documentation index is at https://platform.detectif.ai/llms.txt. Every page is also available as Markdown by adding `.md` to its path.

# Create a stream token

`POST /v1/detect/stream-tokens`

Product: [Noesis](https://platform.detectif.ai/docs/noesis/) (call intelligence). URL: `https://api.noesis.detectif.ai/v1/detect/stream-tokens`.

Creates a single-use token for one live call, valid for 5 minutes, for clients that cannot send an Authorization header (Twilio <Stream>, Exotel, Telnyx, Vonage). Pass it as `?token=` on the WebSocket URL or as the Twilio `<Parameter name="token">`. The response also has the `session_id` the call will use: poll `GET /v1/detect/sessions/{session_id}` for live state and the final answer. Send `{"record": false}` to not record that call. Does not use your balance. Requires scope `noesis:detect`.

## Authentication

Send your API key as `Authorization: Bearer <your API key>`.

## Headers

| Name | Type | Required | Description |
|---|---|---|---|
| `Authorization` | string | yes | `Bearer <your API key>`. Keys are created in the dashboard; see [Authentication](https://platform.detectif.ai/docs/noesis/authentication/). |

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `record` | boolean or null | no | Record the call (audio and transcript, kept 30 days). Default true; false turns recording off for the call that uses this token. |

Example request body:

```json
{}
```

## Response

`201`: Success.

| Field | Type | Required | Description |
|---|---|---|---|
| `request_id` | string | yes |  |
| `object` | string | yes | (always `"noesis.stream_token"`) |
| `token` | string | yes | Single-use token (ntk_...), valid for 5 minutes. Pass it as ?token= or as the Twilio <Parameter name="token">. |
| `session_id` | string | yes | The session id the call that uses this token will have. Poll GET /v1/detect/sessions/{session_id} for its results. |
| `expires_at` | string | yes |  |
| `expires_in` | integer | yes | Seconds until the token expires. |
| `record` | boolean | yes | Whether the call will be recorded. |

### Example response

```json
{
  "request_id": "req_8f14e45fceea167a5a36dedd",
  "object": "noesis.stream_token",
  "token": "ntk_Q7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xQ7xa",
  "session_id": "5b2f0c9e8d7a4b6c9e1f2a3b4c5d6e7f",
  "expires_at": "2026-10-19T09:35:00Z",
  "expires_in": 300,
  "record": true
}
```

## Errors

| Status | Meaning |
|---|---|
| `400` | The request is invalid, for example an API key in the URL or an unsupported parameter. |
| `401` | The API key is missing, invalid or revoked. |
| `403` | The key lacks the required scope, the e-mail address is not verified, or the account is suspended. |
| `429` | Too many requests, or too many calls and file analyses at the same time. Wait for Retry-After seconds. |
| `500` | Something went wrong on our side. |

Error bodies use the shape described in [Errors](https://platform.detectif.ai/docs/noesis/errors/), with a stable `error.code`.

## Code samples

```bash
curl -X POST "https://api.noesis.detectif.ai/v1/detect/stream-tokens" \
  -H "Authorization: Bearer $DETECTIF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```python
import os

import requests

resp = requests.post(
    "https://api.noesis.detectif.ai/v1/detect/stream-tokens",
    headers={"Authorization": f"Bearer {os.environ['DETECTIF_API_KEY']}"},
    json={},
    timeout=30,
)
print(resp.status_code, resp.json())
```

```javascript
const res = await fetch("https://api.noesis.detectif.ai/v1/detect/stream-tokens", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.DETECTIF_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
console.log(res.status, await res.json());
```
