Skip to content

Grant AI credits

POST
/entitlements/admin/orgs/{orgId}/credits
curl --request POST \
--url https://api.sloose.com/entitlements/admin/orgs/org_9f3c/credits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "pool": "included", "credits": 1, "ref": "example", "reason": "example", "expiresAt": "example" }'

Backoffice route: a staff session, or ADMIN_TOKEN; never a customer’s session. Idempotent on ref: granting twice with the same ref grants once. Written down as org.credits.

orgId
required

The org id.

string
Example
org_9f3c

The org id.

Media typeapplication/json
object
pool

included credits reset each period; purchased ones carry over.

string | null
Allowed values: included purchased
credits

A positive number of credits to grant.

number | null
ref

Idempotency key. Generated if omitted.

string | null
reason
string | null
expiresAt
string | null
key
additional properties

Granted.

Media typeapplication/json
object
ref
required
string
balance
required

AI credits. Included credits reset each period; purchased ones do not.

object
included
required
number
purchased
required
number
reserved
required
number
available
required

Included + purchased − reserved

number
periodStart
required
string
periodEnd
required
string
Examplegenerated
{
"ref": "example",
"balance": {
"included": 1,
"purchased": 1,
"reserved": 1,
"available": 1,
"periodStart": "example",
"periodEnd": "example"
}
}

pool is not one of the two pools, or credits is not positive.

Media typeapplication/json
object
error
required
string
key
additional properties
Examplegenerated
{
"error": "example"
}

A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

A customer’s session, an API token, or no bearer at all — not staff, and not the ADMIN_TOKEN (code: ADMIN_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}