← Back to API docs

POST/api/v1/widget/token

Live animation widget: exchange an embed token (server side only)
Live animation widgetactivebetacoreRequires entitlement

Access

Request
POST https://api.sports.csap.ai/api/v1/widget/token
Auth
Header X-API-Key: <your key> (Authorization: Bearer <key> also works; ?key= is still accepted but discouraged, because the key ends up in URLs and logs)
External keys
Requires entitlementThe endpoint and its data domain must be granted to the key; otherwise 403.
Rate limits
3000 per minute · 200000 per day · Set per key (rate_per_min and quota_daily returned by /api/v1/account are authoritative; the numbers above are a trial key's). Beyond them the answer is 429. In addition, heavy requests such as whole-table snapshots and statistics lists without a match id are processed 2 at a time for the whole platform; a request that cannot get a slot receives 429 with Retry-After. Responses do not carry X-RateLimit-* headers for now. See the general guide

Request parameters 3

ParameterTyperequiredExampleDescription
configstringrequiredId of a published configuration, e.g. wgt_1a2b3c4d (required, JSON body)
originstringrequiredAddress of the embedding page, e.g. https://www.example.com (required, JSON body; must be among the enabled embed domains)
ttlintegeroptionalToken lifetime in seconds, default 7200, maximum 86400 (JSON body)

Example request

curl -X POST "https://api.sports.csap.ai/api/v1/widget/token" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"config":"wgt_cb6d03be","origin":"https://www.example.com","ttl":7200}'

Try it

Example response

An example response is being added; send a request in Try it above to see a real one.

Response fields 3

embed_urlstringRelative address of the widget page; prefix the API domain and put it in an iframe (add the match parameter: a platform match id or auto)
expires_atintegerToken expiry time (Unix seconds)
tokenstringWidget token (bound to a configuration and the embedding page's origin; goes in the token parameter of /widget/anim)

Errors

HTTPmessageWhen
401missing API key / unauthorizedNo X-API-Key, or the key is invalid or disabled
403The live animation widget isn't enabled. Please contact sales.The organization has no access to the live animation widget, or the access is suspended
400Invalid request. Expected {config, origin, ttl}.The body is not JSON, or fields are missing
403The origin isn't one of the authorized embed domains.The origin's domain is not among the embed domains registered for the access
403Your plan doesn't include this view.The view used by the configuration (2.5D / 3D) is not part of the access
404Configuration not found.Wrong configuration id, or it does not belong to this organization
409This configuration hasn't been published yet.The configuration is a draft; publish it in the console first
403explicit endpoint and data-domain entitlement requiredThis endpoint and its data domain must be enabled separately
429rate limit exceeded / daily quota exceededThe key's per-minute rate or daily quota is exceeded
429server busy, retry laterThe server's concurrency slots are full (only 2 heavy requests at a time); retry after Retry-After seconds
500query errorThe query failed on the server; you may retry