The entitlement read tells your server the access keys and the subscription state of 1 reader, with 1 call and no view of an article. Use it for the apps of your publisher, for a CRM and to check an event.
These 3 rules hold:
- The server check of part 5 decides each view of an article. Do not use the read for that.
- The server key stays on your server. An app calls your server, and your server calls the read. Never put the key in an app or in a browser.
- The read writes no wall view, changes no meter and opens no site session.
See also the API reference for POST /api/v1/entitlements.
The request
Call POST /api/v1/entitlements with Authorization: Bearer <server key> and a JSON body of 4 KiB at most. The body is a strict object with 1 of these 2 fields. A body with both fields or with no field gives 400 invalid_request.
| Request field | Type | You send |
|---|---|---|
reader | string, 4,096 characters at most | The value of the reader cookie of part 4, as your server read it. |
readerId | string, UUID | The reader ID from data.reader.id in a webhook event or from an earlier answer. A non-UUID string gives 400 invalid_request. |
A reader token ends with its site session. After the reader logs out, or after the session ends, the token names no reader, and the read gives known: false. Treat that answer as a visitor. A reader ID does not end with a session.
The answer
The answer is HTTP 200 with JSON, with Cache-Control: private, no-store. Each field is always present. A token or an ID that names no live reader of this publication also gives HTTP 200, with known: false. It is no error.
| Answer field | Type | Value |
|---|---|---|
known | boolean | true when the request names a live reader of the publication. |
readerId | string, UUID or null | The reader ID, or null when known is false. |
subscription | object or null | The newest subscription of the reader: id, status, plan with id and name, currentPeriodEnd, cancelAtPeriodEnd and endsAt. null for a reader with no subscription. |
accessKeys | array of strings | The access keys that the reader has now. The array is empty for a reader with no access. |
Request
curl -sS https://konto.example.no/api/v1/entitlements \
-H "Authorization: Bearer $SERVER_KEY" \
-H "Content-Type: application/json" \
-d '{"readerId": "0193f0b2-1111-7a4e-9d2b-3f6a8c1e2d4f"}'
Response 200
{
"known": true,
"readerId": "0193f0b2-1111-7a4e-9d2b-3f6a8c1e2d4f",
"subscription": {
"id": "0193f0b2-2222-7a4e-9d2b-3f6a8c1e2d4f",
"status": "active",
"plan": { "id": "0193f0b2-3333-7a4e-9d2b-3f6a8c1e2d4f", "name": "Monthly A1" },
"currentPeriodEnd": "2027-02-10T09:00:00Z",
"cancelAtPeriodEnd": false,
"endsAt": null
},
"accessKeys": ["paid"]
}
Which status gives keys
trialing,activeandpast_duegive the access keys of the plan of the subscription.endedgives an empty list. A subscription that ends at the end of its period isendedfrom its end date, also before the next background run.- A reader with no subscription gives an empty list.
Errors
Each error is application/problem+json, as in part 13. The read has the 9 codes of the table. The causes of part 13 hold, and the wrong-key gate of part 13 counts each 401 after a key lookup.
| Status | code | Cause |
|---|---|---|
| 400 | invalid_request | The body has both reader and readerId, or neither. Or readerId is not a UUID, or the body has an unknown field. Fix your server. |
| 401 | unauthenticated | No key, a key of the wrong form, an unknown key, a revoked key, or a key of another publication. Replace the key. Do not retry. |
| 401 | key_mode_mismatch | The key belongs to the other mode. A ns_sk_test_ key fails on production. A ns_sk_live_ key fails on development and sandbox. |
| 403 | browser_request | The request came from a browser. Call from your server. |
| 404 | no_site | The host has no publication. Check the subscription host. |
| 413 | too_large | The body is above 4 KiB. |
| 415 | unsupported_media_type | The body is not JSON. |
| 429 | rate_limited | The request reached a limit. Wait for the time in Retry-After. |
| 503 | busy | Norspire is busy. Wait for the time in Retry-After, 1 second. |
Limits
The entitlement read shares connections and limits with the server check. Those limits include 4 KiB body size, 800 milliseconds server time, the publication gate and the proxy limits. A call to the read takes a place that a server check can use.
- Call the read when an app starts and after an event, and not for each view of an article.
- Keep 1 answer for each reader for 1 minute or less, and read it from your own store in between.
- Limit the path of your app that calls the read, for example to 1 call for each reader in each minute.
- A 429, a 503, a time-out and a 5xx are failures. Wait for
Retry-After. Add a circuit breaker as in part 5 when your server calls the read in a loop.