Skip to content
Hayonix

API reference · Models

Mint a short-lived playground token for the inference API (signed-in users only)

POST/v1/playground-tokens
Console sessioninference:invokeProjectIdempotency-Key

Returns a bearer token that calls the inference API on behalf of the signed-in user in this project, for trying models from the console. It expires after ttl_seconds (15 minutes by default) and is shown only in this response. API keys cannot mint one.

Console session only. The console calls this with a signed-in session; API keys are refused. Requires the inference:invoke permission (a key's scope, or a role that includes it).

Request

Headers
HeaderRequiredDescription
X-Project-IdyesThe project to act in, for console sessions. Requests with an API key leave it out.
Idempotency-KeynoMakes a retry safe: the same key and request within 24 hours return the original response (see Idempotency). The SDKs send one for you.

Body

JSON (application/json): CreatePlaygroundTokenRequest.

  • ttl_secondsinteger

    Lifetime in seconds (30–900, default 900)

    30–900

Response

201 PlaygroundToken — The token (shown once)

  • objectstringrequired

    Always `playground_token`: the type of this object

    One ofplayground_token

  • idstringrequired

    Unique ID (`pgt_…`)

    ID with prefix pgt_

  • project_idstringrequired

    Project it belongs to

    ID with prefix prj_

  • tokenstringrequired

    Bearer token for the inference API. Short-lived; never store it.

  • expires_atstring (date-time)required

    When it expires (null: never) (ISO 8601, UTC)

Example response
Example response
{
  "object": "playground_token",
  "id": "pgt_01jc5zq4m8k3v6x9t2w7r0b1e4",
  "project_id": "prj_01jc5zq4m8k3v6x9t2w7r0b1e4",
  "token": "pg_eyJ2IjoxLC…",
  "expires_at": "2026-01-01T00:00:00.000Z"
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
409conflict_error idempotency_in_progressA request with the same Idempotency-Key is still running.
422idempotency_error idempotency_key_reusedThe Idempotency-Key was used with a different request.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.