Assistant APICreate a reader credential

Create a reader credential

From your server, with the secret key: a short-lived credential for one visitor of a page on one of the key's allowed origins. The page sends it as its bearer token instead of the publishable key, and gets answers from what the key reads, narrowed to that visitor.

A credential works only from the origin it was created for, never reads more than its key, and cannot create more credentials.

curl -X POST "https://api.documentation.ai/api/v1/assistant/reader-credentials" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "origin": "https://app.acme.com",
  "signed_in": true
}'
{
  "credential": "asst_rc_3k9TqX2mVbN7wLp4ZcR8sYd1FhJ6uGe0aKoIiMnB5vQ",
  "origin": "https://app.acme.com",
  "expires_at": "2026-11-06T09:45:00.000Z",
  "expires_in_seconds": 900
}
POST
/reader-credentials
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

An Assistant API key from Settings > Assistant API: the secret key (asst_sk_...) from servers and tools, or the publishable key (asst_pk_...) or a reader credential (asst_rc_...) from pages on the key's allowed origins. See Authentication.

An Assistant API key from Settings > Assistant API: the secret key (asst_sk_...) from servers and tools, or the publishable key (asst_pk_...) or a reader credential (asst_rc_...) from pages on the key's allowed origins. See Authentication.
Content-Typestring
Required

The media type of the request body

Options: application/json
originstring
Required

One of the key's allowed origins, exactly as the browser sends it.

Min length: 1 • Max length: 267
signed_inboolean

Whether the visitor is signed in to your product. false limits the credential to public pages.

rolesarray

The visitor's roles. Only roles the key also has are kept, each time the credential is used.

expires_in_secondsinteger

From 60 to 3,600. Defaults to 900 (15 minutes).

Min: 60 • Max: 3600
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. An Assistant API key from Settings > Assistant API: the secret key (asst_sk_...) from servers and tools, or the publishable key (asst_pk_...) or a reader credential (asst_rc_...) from pages on the key's allowed origins. See Authentication.

Body

application/json
originstring
Required

One of the key's allowed origins, exactly as the browser sends it.

Example:
https://app.acme.com
signed_inboolean

Whether the visitor is signed in to your product. false limits the credential to public pages.

rolesarray

The visitor's roles. Only roles the key also has are kept, each time the credential is used.

expires_in_secondsinteger

From 60 to 3,600. Defaults to 900 (15 minutes).

Responses

credentialstring

The credential, starting with asst_rc_. Pass it to the page, which sends it as its bearer token.

originstring

The only origin the credential works from.

expires_atstring

When it stops working, in ISO 8601 UTC.

expires_in_secondsnumber

Its lifetime in seconds.