Create an API token
Creates a new personal access token for the authenticated caller, returning the plaintext token exactly once (it cannot be retrieved again) along with its id, name, scopes, and optional expiry. Accepts a name, an optional list of capability scopes (resource:action, e.g. documents:read; omitting scopes defaults to full non-admin access), and an optional expires_in_days (omitted means non-expiring). Each scope must be a known capability or legacy tier, and requesting the admin scope requires the caller to have the admin role. The token’s effective permissions are always clamped to the caller’s role at request time.
Authorizations
Personal Access Token. Send as Authorization: Bearer hq_pat_....
Body
Optional expiry; omitted = non-expiring manual PAT.
Requested capability scopes (resource:action, e.g. documents:read).
Omitted = ["user"] (full non-admin access, back-compat). Each must
be a known capability scope or a legacy tier; the effective set is
still clamped to the caller's role at request time.