PlayableLabs Docs
Developers

API Overview

REST API basics, base URL, request format, rate limiting, pagination, and error codes for PlayableLabs

Base URL

All API requests use the following base URL:

https://api.playablelabs.ai/api

Request Format

The API accepts and returns JSON. Include these headers in every request:

Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

Authentication

Every request must include a valid token. PlayableLabs supports two authentication methods:

  • JWT session tokens -- Obtained via the web app login flow (NextAuth v5)
  • API tokens -- Created in Developers > Tokens for programmatic access

See the Authentication guide for details.

Rate Limiting

The API enforces rate limits to ensure fair usage:

TierLimitWindowStrategy
Standard100 requests1 minuteFixed window
Sensitive endpoints20 requests1 minuteSliding window
Export10 requests5 minutesFixed window

When rate-limited, the API returns 429 Too Many Requests with these headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1700000000
Retry-After: 30

Response Shape

Every successful response wraps the payload in a single data key. Nothing else is added to the body: there is no timestamp, path or method field.

{ "data": { "id": "a1", "name": "Merge Blitz" } }

List endpoints add a meta block next to data (see Pagination).

Pagination

List endpoints return paginated results. Use query parameters to control pagination:

curl -H "Authorization: Bearer YOUR_TOKEN" \
  "https://api.playablelabs.ai/api/games?page=1&limit=20&sort=createdAt&order=desc"
ParameterTypeDefaultDescription
pagenumber1Page number (1-based)
limitnumber20Items per page (max 100)
sortstringcreatedAtField to sort by
orderstringdescSort direction: asc or desc

Paginated responses return the items in data and the paging details in meta. Some endpoints add counters beside the four standard fields (for example nonDemoCount on the games list). Endpoints addressed by offset (activity and audit logs) still accept offset; meta.page is floor(offset / limit) + 1 and meta.offset echoes the requested offset.

{
  "data": [...],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 54,
    "totalPages": 3
  }
}

Multi-Tenant Scoping

All data is scoped by organization. Pass the organizationId as a query parameter or in the request body where required. You can only access data belonging to organizations you are a member of.

Error Codes

The API uses standard HTTP status codes and returns structured error responses:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Name is required",
  "requestId": "6f1c0a52-8d0e-4c1b-9a43-0d4f6a1b2c3d"
}

requestId is the same value the API returns in the X-Request-ID response header (omitted if the error happens before the request is assigned an id). Quote it when reporting a failed request. Errors may also carry errorCode, code, suggestedName, retryAfter, param or details next to these keys; they are never nested.

StatusError CodeDescription
400VALIDATION_ERRORInvalid request body or parameters
401AUTHENTICATION_REQUIREDMissing or invalid token
403INSUFFICIENT_PERMISSIONSToken lacks required scope
404RESOURCE_NOT_FOUNDRequested resource does not exist
409DUPLICATE_RESOURCEResource already exists
429RATE_LIMIT_EXCEEDEDToo many requests
500INTERNAL_SERVER_ERRORUnexpected server error

Key Endpoints

MethodEndpointDescription
GET/api/gamesList games
POST/api/gamesCreate a game
GET/api/assetsList assets
POST/api/storage/urlsGet upload URLs
POST/api/exportTrigger an export
GET/api/tokensList API tokens

Next Steps

On this page