07 / Endpoints
Tickets
Bulk grant tickets (organisation → several workspaces)
API key requiredDistributes tickets from the organisation's shared pool to several workspaces at once.
Behaviour
- Each workspace's allocation (
allocated) increases cumulatively by the granted amount. - A workspace that had no quota gets one at this moment, and from then on it can only spend within its allocation.
- Listing the same
workspaceIdtwice in one request is a 400 (whether that means summing or overwriting is ambiguous, and we do not guess). - Up to 100 items per request.
Atomicity — all or nothing
It runs as a single transaction, so if the pool runs short partway through, the items already processed are rolled back too. Partial success would leave you unable to tell how far it got, and a retry would become a double grant. On failure you get a 400 (request or pool validation), a 404 (workspace missing) or a 409 (idempotency conflict), along with the guarantee that nothing was applied.
Idempotency
Send an Idempotency-Key header and, for 24 hours from the first successful request, a repeat of the same key returns the original response without re-running anything, with an Idempotent-Replay: true header attached. We strongly recommend using it to stop a network retry from granting twice. Failed responses are not stored as idempotency records, so you can fix the cause and retry with the same key. Sending different content under the same key is rejected with a 409.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
Request bodyBulkGrantTicketsRequest
| Field | Type | Required | Description |
|---|---|---|---|
| items[] | object[] | Required | Grant items (up to 100) |
| workspaceId | string | Required | Workspace to grant toExample: ws_cuid456def |
| amount | integer | Required | Tickets to grant (positive integer). To take tickets back, use POST .../tickets/revoke.min 1 | Example: 100 |
| maxRemaining | integer | Optional | Conditional cap on the remaining balance, owned by the caller's own granting policy. If the remaining balance after the grant would exceed this value, the whole request is rejected. FikaClip does not store the policy value.min 0 | Example: 500 |
| description | string | Required | Reason for the grant (recorded in the audit trail; required)minLength 1 · maxLength 500 | Example: Scheduled ticket distribution, August 2026 |
{
"items": [
{
"workspaceId": "ws_cuid456def",
"amount": 100,
"maxRemaining": 500
}
],
"description": "Scheduled ticket distribution, August 2026"
}Responses
| Status | Meaning |
|---|---|
| 200 | All succeededBulkGrantTicketsResponse |
| 400 | Bad request (validation failed)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 409 | The same Idempotency-Key has already been used for a request with different content. Use a new key.PartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200BulkGrantTicketsResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| bulkRequestId | string | Required | Identifier of this bulk operation. It is recorded in each workspace's history so the batch can be traced as a group.Example: 9b18865e-6a1d-4096-b4b1-7cefbb27129e |
| totalGranted | TicketAmount | Required | Total amount actually distributed |
| ticket | integer | Required | Ticket count (the same integer as the stored value). This is the reference value for settlement and for requests.Example: 500 |
| display | string | Required | Display string with the organisation's displayDivisor applied. For reference only — do not compute with it.Example: 500 |
| results[] | object[] | Required | |
| workspaceId | string | Required | Example: ws_cuid456def |
| granted | object | Required | |
| quota | object | Required | Workspace quota state after the grant |
| allocated | integer | Required | Example: 600 |
| used | integer | Required | Example: 120 |
| remaining | integer | Required | Example: 480 |
{
"requestId": "req_abc123",
"bulkRequestId": "9b18865e-6a1d-4096-b4b1-7cefbb27129e",
"totalGranted": {
"ticket": 500,
"display": "500"
},
"results": [
{
"workspaceId": "ws_cuid456def",
"quota": {
"allocated": 600,
"used": 120,
"remaining": 480
}
}
]
}Get organisation ticket balance
API key requiredReturns the shared pool balance together with how much is reserved by workspace quotas and how much is still unreserved.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
Request body
This endpoint takes no request body.
Responses
| Status | Meaning |
|---|---|
| 200 | RetrievedOrganizationTicketBalanceResponse |
| 400 | Bad request (validation failed)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200OrganizationTicketBalanceResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| organizationId | string | Required | Example: org_cuid123abc |
| poolBalance | object | Required | |
| reservedByQuota | object | Required | |
| unreserved | object | Required | |
| workspaces[] | object[] | Required | |
| workspaceId | string | Required | Example: ws_cuid456def |
| name | string | Required | Example: Marketing team |
| status | enum | Required | Workspace status. ARCHIVED is an inactive workspace where generation is blocked.Allowed: ACTIVE · ARCHIVED | Example: ACTIVE |
| quota | WorkspaceTicketQuota | Required | |
| allocated | integer | Required | Total tickets allocated to this workspace. 0 means fully blocked (no generation).Example: 500 |
| used | integer | Required | Tickets already spent. This cannot be undone and sets the floor for revoking.Example: 120 |
| remaining | integer | Required | Remaining tickets = allocated − used (minimum 0). The amount actually available.Example: 380 |
| updatedAt | string | Required | When the allocation last changedExample: 2026-08-20T09:00:00.000Z |
{
"requestId": "req_abc123",
"organizationId": "org_cuid123abc",
"workspaces": [
{
"workspaceId": "ws_cuid456def",
"name": "Marketing team",
"status": "ACTIVE",
"quota": {
"allocated": 500,
"used": 120,
"remaining": 380,
"updatedAt": "2026-08-20T09:00:00.000Z"
}
}
]
}Set workspace ticket quota (absolute)
API key requiredOverwrites the workspace's total allocation (this is not a delta).
allocated: 0→ fully blocked (that workspace cannot generate)allocated: null→ quota removed. The organisation's shared pool is used without a limit- It cannot be set below what has already been spent (
used) (400) - The sum of every quota's remaining headroom inside the organisation cannot exceed the shared pool balance (400)
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
| workspaceId | string | Required | Workspace IDExample: ws_cuid456def |
Request bodySetWorkspaceTicketQuotaRequest
| Field | Type | Required | Description |
|---|---|---|---|
| allocated | integer | null | Required | Total allocation. null removes the quota (unlimited).min 0 | Example: 500 |
| description | string | Optional | Reason for the change (audit log)maxLength 500 | Example: Limit raised as the team grew |
{
"allocated": 500,
"description": "Limit raised as the team grew"
}Responses
| Status | Meaning |
|---|---|
| 200 | SetSetWorkspaceTicketQuotaResponse |
| 400 | The ticket quota cannot be changed (INVALID_REQUEST, QUOTA_BELOW_USED, INSUFFICIENT_POOL_BALANCE)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 409 | The same Idempotency-Key has already been used for a request with different content. Use a new key.PartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200SetWorkspaceTicketQuotaResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| workspaceId | string | Required | Example: ws_cuid456def |
| quota | object | Required | |
| poolUnreservedAfter | object | Required |
{
"requestId": "req_abc123",
"workspaceId": "ws_cuid456def"
}Grant tickets to a workspace
API key requiredGrants tickets from the organisation's shared pool to this one workspace. allocated grows by amount (cumulative).
Calling it on a workspace that had no quota (unlimited) creates one, and from that moment the workspace can only spend within its allocation.
Constraints
- Exceeding the shared pool's unreserved headroom (
unreserved) returns400 INSUFFICIENT_POOL_BALANCE - To grant to several workspaces at once, use
POST /organizations/{orgId}/tickets/bulk-grant
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
| workspaceId | string | Required | Workspace IDExample: ws_cuid456def |
Request bodyGrantWorkspaceTicketsRequest
| Field | Type | Required | Description |
|---|---|---|---|
| amount | integer | Required | Tickets to grant (positive only)min 1 | Example: 100 |
| maxRemaining | integer | Optional | Conditional cap on the remaining balance, owned by the caller's own granting policy. If the remaining balance after the grant would exceed this value, the whole request is rejected with REMAINING_CAP_EXCEEDED. FikaClip does not store the policy value.min 0 | Example: 500 |
| description | string | Required | Reason for the grant (required for the audit log)minLength 1 · maxLength 500 | Example: Extra campaign volume for August |
{
"amount": 100,
"maxRemaining": 500,
"description": "Extra campaign volume for August"
}Responses
| Status | Meaning |
|---|---|
| 200 | GrantedGrantWorkspaceTicketsResponse |
| 400 | Tickets cannot be granted (INVALID_REQUEST, INSUFFICIENT_POOL_BALANCE, REMAINING_CAP_EXCEEDED)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 409 | The same Idempotency-Key has already been used for a request with different content. Use a new key.PartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200GrantWorkspaceTicketsResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| workspaceId | string | Required | Example: ws_cuid456def |
| granted | object | Required | |
| quota | object | Required | |
| poolUnreservedAfter | object | Required |
{
"requestId": "req_abc123",
"workspaceId": "ws_cuid456def"
}Revoke tickets from a workspace
API key requiredReduces this workspace's allocation and returns that amount to the organisation's shared pool.
Constraints
- Tickets already spent (
used) cannot be revoked. The maximum you can take back isremaining. - Asking for more returns
400 QUOTA_BELOW_USEDand nothing changes. - To revoke the whole remaining allocation, pass
remainingasamountor userevokeAll: true.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
| workspaceId | string | Required | Workspace IDExample: ws_cuid456def |
Request bodyRevokeWorkspaceTicketsRequest
| Field | Type | Required | Description |
|---|---|---|---|
| amount | integer | Optional | Tickets to revoke (positive only). Can be omitted when revokeAll: true.min 1 | Example: 50 |
| revokeAll | boolean | Optional | When true, the whole remaining allocation (remaining) is revoked.Example: false |
| description | string | Required | Reason for the revoke (required for the audit log)minLength 1 · maxLength 500 | Example: Remainder reclaimed after the campaign ended |
{
"amount": 50,
"revokeAll": false,
"description": "Remainder reclaimed after the campaign ended"
}Responses
| Status | Meaning |
|---|---|
| 200 | RevokedRevokeWorkspaceTicketsResponse |
| 400 | Tickets cannot be revoked (INVALID_REQUEST, QUOTA_BELOW_USED)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 409 | The same Idempotency-Key has already been used for a request with different content. Use a new key.PartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200RevokeWorkspaceTicketsResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| workspaceId | string | Required | Example: ws_cuid456def |
| revoked | object | Required | |
| quota | object | Required | |
| poolUnreservedAfter | object | Required |
{
"requestId": "req_abc123",
"workspaceId": "ws_cuid456def"
}Get workspace ticket status
API key requiredReturns one workspace's allocated, used and remaining tickets along with the maximum that can be revoked. Checking this before a grant or a revoke is how you avoid a 400.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
| workspaceId | string | Required | Workspace IDExample: ws_cuid456def |
Request body
This endpoint takes no request body.
Responses
| Status | Meaning |
|---|---|
| 200 | RetrievedWorkspaceTicketStatusResponse |
| 400 | Bad request (validation failed)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200WorkspaceTicketStatusResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| workspaceId | string | Required | Example: ws_cuid456def |
| workspaceName | string | Required | Example: Marketing team |
| quota | object | Required | |
| revocableMax | object | Required |
{
"requestId": "req_abc123",
"workspaceId": "ws_cuid456def",
"workspaceName": "Marketing team"
}Workspace ticket allocation history
API key requiredReturns the grant, revoke and quota-setting history of this workspace in reverse chronological order. It answers "who gave how much, when, and why" for auditing.
This is not the consumption record. Consumption lives in GET /organizations/{orgId}/tickets/ledger. Allocation changes do not move the organisation's shared pool balance and so leave no ledger entry, which is why they are kept as a separate history.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| orgId | string | Required | Organization IDExample: org_cuid123abc |
| workspaceId | string | Required | Workspace IDExample: ws_cuid456def |
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
| from | string | Optional | Start of the window (defaults to the last 30 days)Example: 2026-08-01T00:00:00.000Z |
| to | string | Optional | Example: 2026-09-01T00:00:00.000Z |
| action | enum | Optional | Action filter. It can be repeated (for example ?action=GRANT&action=REVOKE).Allowed: GRANT · REVOKE · SET | Example: GRANT |
| cursor | string | Optional | Pass the nextCursor from the previous response unchanged. Its format is <ISO createdAt>|<id>.Example: 2026-08-20T09:00:00.000Z|cmtb28hn6000b0yz4a3nx12v5 |
| limit | integer | Optional | Page size (default 50, max 200)Example: 50 |
Request body
This endpoint takes no request body.
Responses
| Status | Meaning |
|---|---|
| 200 | RetrievedWorkspaceTicketHistoryResponse |
| 400 | Bad request (validation failed)PartnerErrorResponse |
| 401 | Authentication failed (API key missing or invalid)PartnerErrorResponse |
| 403 | Forbidden (no access to that organisation)PartnerErrorResponse |
| 404 | Resource not foundPartnerErrorResponse |
| 429 | Rate limit exceededPartnerErrorResponse |
| 503 | Rate limit service temporarily unavailablePartnerErrorResponse |
Responses 200WorkspaceTicketHistoryResponse
| Field | Type | Required | Description |
|---|---|---|---|
| requestId | string | Required | Example: req_abc123 |
| workspaceId | string | Required | Example: ws_cuid456def |
| workspaceName | string | Required | Example: Marketing team |
| period | AggregationPeriod | Required | |
| from | string | Required | Example: 2026-08-01T00:00:00.000Z |
| to | string | Required | Example: 2026-09-01T00:00:00.000Z |
| data[] | object[] | Required | |
| id | string | Required | Example: cmtb28hn6000b0yz4a3nx12v5 |
| action | enum | Required | GRANT adds cumulatively / REVOKE takes back / SET writes an absolute value or removes the quotaAllowed: GRANT · REVOKE · SET | Example: GRANT |
| amount | integer | Required | Amount of the change. Always positive; the direction lives in action (the same convention as the ledger's amount).Example: 100 |
| previousAllocated | integer | Required | Allocation immediately before the changeExample: 500 |
| newAllocated | integer | Required | Allocation immediately after the changeExample: 600 |
| usedAtChange | integer | Required | Amount spent at the time of the change. This is what the revoke floor is judged against.Example: 120 |
| reason | string | null | Required | Example: Extra campaign volume for August |
| actor | object | Required | Who made the change |
| adminId | string | null | Required | Operator ID when the change came from the admin screenExample: null |
| apiKeyId | string | null | Required | API key ID used when the change came through the Admin APIExample: key_cuid789 |
| bulkRequestId | string | null | Required | Request ID when the entry came from a bulk grant. It groups one batch together.Example: 9b18865e-6a1d-4096-b4b1-7cefbb27129e |
| createdAt | string | Required | Example: 2026-08-20T09:00:00.000Z |
| nextCursor | string | null | Required | Cursor for the next page, or null when there is none.Example: 2026-08-20T09:00:00.000Z|cmtb28hn6000b0yz4a3nx12v5 |
{
"requestId": "req_abc123",
"workspaceId": "ws_cuid456def",
"workspaceName": "Marketing team",
"period": {
"from": "2026-08-01T00:00:00.000Z",
"to": "2026-09-01T00:00:00.000Z"
},
"data": [
{
"id": "cmtb28hn6000b0yz4a3nx12v5",
"action": "GRANT",
"amount": 100,
"previousAllocated": 500,
"newAllocated": 600,
"usedAtChange": 120,
"reason": "Extra campaign volume for August",
"actor": {
"apiKeyId": "key_cuid789"
},
"bulkRequestId": "9b18865e-6a1d-4096-b4b1-7cefbb27129e",
"createdAt": "2026-08-20T09:00:00.000Z"
}
],
"nextCursor": "2026-08-20T09:00:00.000Z|cmtb28hn6000b0yz4a3nx12v5"
}


