Mint an API token
const url = 'https://api.sloose.com/orgs/org_9f3c/tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"CI — config push","expiresAt":"2026-04-15T12:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/orgs/org_9f3c/tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "CI — config push", "expiresAt": "2026-04-15T12:00:00Z" }'Creates a token scoped to this org with the admin role, acting as the member who created it. The secret is in the response and nowhere else, so store it when you receive it.
Session only. An org API token is refused here with 403 SESSION_REQUIRED: a token must not be able to mint or revoke tokens.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The org id the session was issued for. A token for one org can never read another.
Example
org_9f3cThe org id the session was issued for. A token for one org can never read another.
Request Bodyrequired
Section titled “Request Bodyrequired”object
What the token is for. Shown in the token list.
Example
CI — config pushISO timestamp. Omitted means the token never expires.
Responses
Section titled “Responses”Created. secret is not retrievable afterwards.
object
object
The token’s leading characters, for recognising it in a list.
Shown once. The server keeps only a hash of it.
Example
{ "secret": "slo_…"}The request body did not match the schema. issues carries the Zod issue list.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}You are no longer a member of this org.
object
Example
{ "code": "MEMBERSHIP_GONE"}An API token was used, the role is too low, or the bearer belongs to another org.
object
Example
{ "code": "SESSION_REQUIRED"}expiresAt is not in the future.
object
Example
{ "code": "EXPIRY_IN_PAST"}