Endpoint
Request Body
string
required
Access token ID. Must be unique to the account and between 1 and 96 bytes in length.
string
Expiration time in RFC 3339 format (e.g.,
2027-01-01T00:00:00Z). If not set, the expiration will be set to that of the requestor’s token.boolean
default:false
Namespace streams based on the configured stream-level scope, which must be a prefix. Stream name arguments will be automatically prefixed, and the prefix will be stripped when listing streams.
object
required
Access token scope defining permissions.
Response
string
required
The created access token. This is the only time the token secret will be returned.
Examples
Common Use Cases
Read-only token for specific streams
Create a token that can only read from streams with a specific prefix:User-scoped token with auto-prefixing
Create a token for a specific user where all stream operations are automatically prefixed:auto_prefix_streams: true, when using this token:
append("messages")→ actually appends to"users/1234/messages"list_streams()→ returns"messages"instead of"users/1234/messages"
Token with specific operations
Create a token with fine-grained permissions using theops array:
Security Best Practices
Principle of Least Privilege
Grant only the minimum permissions needed for the token’s intended use.
Set Expiration
Always set an
expires_at time appropriate for the token’s use case.Scope Narrowly
Use specific basin/stream prefixes or exact matches rather than allowing all resources.
Rotate Regularly
Implement token rotation for long-lived tokens.