Skip to main content

Overview

This endpoint generates a short-lived, single-use token for the streaming endpoint. Tokens are stored securely in Redis and automatically expire after their TTL period. This is step 1 of the two-step streaming flow.

Endpoint

  • HTTP Method: GET
  • URL: /api/v1/token

Features

Single-Use Security

Each token can only be used once — it is deleted from Redis after the first stream request.

Configurable TTL

Set a custom time-to-live between 1 and 300 seconds (default: 60s).

Bearer Key Auth

Tokens are generated under your API key — credits are charged to your organization.

Rate Limited

Server-derived rate limiting ensures fair usage across all consumers.

Authentication

Requires a Bearer token in the Authorization header.

Request

Query Parameters No body content is required for this GET request.

Example Request

With a custom TTL of 5 minutes:

Response

A successful response returns the token and its TTL:
Response Headers

Error Responses

Missing or invalid API key.
No credits remaining on the account.
Rate limit exceeded.
Token generation failed.

Code Examples

Additional Notes

  • Single-Use: The token is deleted from Redis after its first use in a stream request.
  • Auto-Expiry: Tokens expire automatically after the TTL period — unused tokens do not count against your API quota.
  • Next Step: Use this token as a query parameter on the Stream Workflow endpoint to start receiving real-time responses.