--- title: Mint Session Stream Token | Luma Agents --- POST /v1/sessions/{session\_id}/events/token Select code samplecURL (shell:curl) ```js const url = 'https://agents.lumalabs.ai/v1/sessions/example/events/token'; const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```sh curl --request POST \ --url https://agents.lumalabs.ai/v1/sessions/example/events/token \ --header 'Authorization: Bearer ' ``` - Productionagents.lumalabs.ai/v1/sessions/{session\_id}/events/token Mint a single-use handle for this session's event stream. Header-authenticated by construction: a `?token=` credential is only honoured on `GET /events/stream` (`stream_token_from_request`), so a handle can never mint its next handle and outlive its 60 seconds. ## Authorizations - **[BearerAuth](/api/agents/index.md#bearerauth)** ## Parameters ### Path Parameters **session\_id** required *Session Id* string ## Responses ### 200 Successful Response Media typeapplication/json *SessionStreamTokenResponse* A one-shot credential for `GET /v1/sessions/{id}/events/stream?token=`. Opaque by design — it is a handle, not a token with claims — so a copy in an access log or a `Referer` header carries nothing. Fetch-based SSE with an `Authorization` header is the default; this is the fallback for hosts that can only open a native `EventSource`. object **expires\_in** required *Expires In* Seconds until the token expires. Redemption also ends it. integer **token** required *Token* Opaque, single-use, valid for this session's event stream only. string ##### Examplegenerated ```json { "expires_in": 1, "token": "example" } ``` ### 422 Validation Error Media typeapplication/json *HTTPValidationError* object **detail** *Detail* Array\ *ValidationError* object **ctx** *Context* object **input** *Input* **loc** required *Location* Array **msg** required *Message* string **type** required *Error Type* string ##### Examplegenerated ```json { "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ] } ```