POST/api/v1/widget/token
Live animation widget: exchange an embed token (server side only)
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
| Parameter | Type | required | Example | Description |
|---|---|---|---|---|
| config | string | required | Id of a published configuration, e.g. wgt_1a2b3c4d (required, JSON body) | |
| origin | string | required | Address of the embedding page, e.g. https://www.example.com (required, JSON body; must be among the enabled embed domains) | |
| ttl | integer | optional | Token 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
| HTTP | message | When |
|---|---|---|
| 401 | missing API key / unauthorized | No X-API-Key, or the key is invalid or disabled |
| 403 | The live animation widget isn't enabled. Please contact sales. | The organization has no access to the live animation widget, or the access is suspended |
| 400 | Invalid request. Expected {config, origin, ttl}. | The body is not JSON, or fields are missing |
| 403 | The origin isn't one of the authorized embed domains. | The origin's domain is not among the embed domains registered for the access |
| 403 | Your plan doesn't include this view. | The view used by the configuration (2.5D / 3D) is not part of the access |
| 404 | Configuration not found. | Wrong configuration id, or it does not belong to this organization |
| 409 | This configuration hasn't been published yet. | The configuration is a draft; publish it in the console first |
| 403 | explicit endpoint and data-domain entitlement required | This endpoint and its data domain must be enabled separately |
| 429 | rate limit exceeded / daily quota exceeded | The key's per-minute rate or daily quota is exceeded |
| 429 | server busy, retry later | The server's concurrency slots are full (only 2 heavy requests at a time); retry after Retry-After seconds |
| 500 | query error | The query failed on the server; you may retry |