Authentication¶
Your key¶
Every request and every stream is made with an API key. A key is a secret string that starts
with sk_. It is shown to you once, when it is issued: store it in your secret manager, never
in code, URLs or logs. If a key leaks, ask us to revoke it and issue another; a revoked key stops
working within seconds, and an open stream made with it closes with 4401.
Sending it¶
On every REST call, send it in the Authorization header:
Authorization: Bearer {API_KEY}
On the stream, send the same header when you open the WebSocket. Browsers cannot set headers on a WebSocket, so the stream also accepts the key as the WebSocket subprotocol:
new WebSocket("wss://api.lineval.com/v1/stream?products=live", ["{API_KEY}"]);
Keys are never accepted in the URL (?key=): URLs end up in logs and proxies.
What a key allows¶
Each key carries:
- its products: any combination of
pregame,live,props,futures,scores,gradingandracing; - how many streams it may keep open at the same time, across all our servers;
- how many REST requests it may make per minute.
The limits come with your plan. Errors and limits explains what happens when you reach them.
grading is an add-on to a product of lines: a key has it together with live, pregame or
props (one or more), and receives the verdicts on those products only. futures is not graded.
A key with only scores receives no prices.
What needs a key¶
| Route | Key |
|---|---|
GET /v1/catalog/sports, /periods, /market-types, /market-groups, /stat-keys |
Not needed |
GET /v1/openapi.json, /v1/asyncapi.json, /docs, /docs/examples/… |
Not needed |
GET /v1/health |
Not needed; with your key it also shows your products' state |
GET /v1/catalog/leagues, /books |
Needed: they list what the products of your key carry |
Every other /v1/… route and the stream |
Needed, and it must include the product you ask for |
A request for a product your key does not include is answered 403 product_not_allowed; a
stream that asks for one closes with 4403. GET /v1/events/{eventId} only looks in the
products of your key: a game that is in none of them is 404 not_found.
Changes to a key¶
Products and limits can change while you are connected. A product added to your key is
available on your next request or your next stream. A product taken off it closes the open
streams that carry it with 4403: reconnect without it.