Skip to content

API Reference

This page lists all available API endpoints for third-party integrations.

Third-party integrations authenticate using an API key passed in the x-api-key header:

Terminal window
curl -H "x-api-key: dpk_YOUR_API_KEY" https://app.dailyplay.ai/api/...

Dashboard management endpoints use a Clerk bearer token instead:

Terminal window
curl -H "Authorization: Bearer <clerk_token>" https://app.dailyplay.ai/api/...

These endpoints are used by third-party integrations to create and manage one-time session tokens.

Creates a one-time session token for a game or stream.

POST /api/org-api-keys?action=create-session

Headers:

HeaderValue
Content-Typeapplication/json
x-api-keyYour API key (dpk_...)

Body:

{
"game_id": 42,
"stream_id": null,
"external_ref": "user-12345",
"metadata": { "campaign": "summer-promo" },
"expires_in_minutes": 60
}
FieldTypeRequiredDescription
game_idnumber*Target game ID
stream_idnumber*Target stream ID
external_refstringNoYour tracking reference
metadataobjectNoArbitrary JSON data
expires_in_minutesnumberNoExpiry time (default: 1440)

* At least one of game_id or stream_id is required.

Response 200:

{
"success": true,
"data": {
"token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"stream_id": null,
"game_id": 42,
"expires_at": "2026-02-17T12:00:00.000Z",
"external_ref": "user-12345"
}
}

Checks whether a session token is still valid without consuming it.

GET /api/org-api-keys?action=validate-session&token=<uuid>

Query Parameters:

ParameterTypeRequiredDescription
tokenstring (UUID)YesThe session token to validate

Response 200:

{
"success": true,
"data": {
"valid": true,
"status": "active",
"stream_id": null,
"game_id": 42,
"expires_at": "2026-02-17T12:00:00.000Z",
"external_ref": "user-12345",
"metadata": { "campaign": "summer-promo" }
}
}

Atomically consumes a session token so it cannot be reused.

POST /api/org-api-keys?action=consume-session

Headers:

HeaderValue
Content-Typeapplication/json

Body:

{
"token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"player_uuid": "player-uuid-here"
}
FieldTypeRequiredDescription
tokenstring (UUID)YesThe session token to consume
player_uuidstringNoUUID identifying the player

Response 200:

{
"success": true,
"data": {
"session_id": 1,
"org_id": 5,
"stream_id": null,
"game_id": 42,
"external_ref": "user-12345",
"metadata": { "campaign": "summer-promo" }
}
}

Response 410 (already consumed/expired):

{
"success": false,
"error": "Session is invalid, already consumed, or expired"
}

These endpoints require a Clerk bearer token and are used by the DailyPlay dashboard to manage API keys.

GET /api/org-api-keys?org_id=<id>

Returns all API keys for the specified organization.


POST /api/org-api-keys

Body:

{
"org_id": 1,
"name": "Production CRM",
"description": "Used by the CRM to issue game links",
"allowed_game_ids": [42, 43],
"allowed_stream_ids": null,
"rate_limit_per_minute": 60,
"rate_limit_per_day": 10000,
"expires_at": "2027-01-01T00:00:00Z"
}

Response 200:

{
"success": true,
"data": {
"id": 1,
"name": "Production CRM",
"key_prefix": "dpk_a1b2",
"key": "dpk_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
}

:::caution The key field is only included in the creation response. It cannot be retrieved again. :::


PATCH /api/org-api-keys

Body:

{
"id": 1,
"org_id": 1,
"is_active": false
}

Set is_active to false to revoke a key, or true to reactivate it.


DELETE /api/org-api-keys?id=<id>&org_id=<id>

Permanently removes the API key record.


All error responses follow this format:

{
"success": false,
"error": "Description of what went wrong"
}
CodeMeaning
200Success
400Bad request — missing or invalid parameters
401Unauthorized — invalid or revoked API key / missing auth
403Forbidden — key does not have access to the requested resource
410Gone — session token already consumed or expired
429Too Many Requests — rate limit exceeded
500Internal server error