Перейти до основного вмісту

API reference

Base URL: https://api.casinocrm.io (managed) or your self-host URL.

Auth

Three auth modes — pick by endpoint group:

ModeUsed byHeader
API keySDK + ingestion endpoints (/v1/events, /v1/players/identify)Authorization: Bearer ucrm_pk_<env>_<id>_<secret>
Clerk sessionAdmin endpointsAuthorization: Bearer <clerk-jwt>
Internal secretServer-to-server onlyX-Internal-Secret: <env>

API keys are project-scoped (one per project per environment). Generate from Settings → API keys in the admin.

Envelope

Success:

{
"data": { ... },
"meta": { "count": 42 } // optional, paginated endpoints
}

Error:

{
"error": {
"code": "PLAYER_NOT_FOUND",
"message": "Player abc-123 not found",
"details": { ... } // optional
}
}

Pagination

Cursor-based. Encode (last_seen_at, id) for stable pagination across mutations:

GET /v1/players?limit=50&cursor=eyJscyI6Ii4uLiIsImlkIjoiLi4uIn0

Response includes meta.next_cursor when more pages exist; null when done.

Idempotency

POST endpoints that mutate (campaign send, bonus grant, journey trigger) accept Idempotency-Key: <uuid> header. Replays return the same response without re-executing.

Rate limits

Per-API-key:

  • Ingestion (/v1/events): 10K req/sec sustained, 50K burst
  • Identify (/v1/players/identify): 1K req/sec
  • Admin / Clerk-protected: 100 req/sec per session

Exceeded → 429 RATE_LIMITED with Retry-After header.

Endpoint groups