Documentation / API reference / POST /access

POST /api/v1/access

Check the access of 1 view of 1 article.

Method and path
POST /api/v1/access
Authentication
Server key
Status codes
  • 200
  • 400
  • 401
  • 403
  • 404
  • 413
  • 415
  • 429
  • 503

Authenticate with a server key in Authorization: Bearer <key>. Send a strict JSON object of 4 KiB at most. An unknown field returns 400.

For circuit breaker rules and timeouts, read part 5 of the integration guide.

Request body

Body fields
FieldTypeRequiredDescription
article string, ^[!-~]{1,200}$ yes The article reference from your CMS, 1 to 200 characters from ! to ~. Norspire stores it to attribute each sale.
level free, metered or paid yes The access level that your CMS sets for the article. A free article returns full with no meter read and no write.
reader string, 4,096 characters at most no The value of the reader cookie on your site, when the browser sent one. A value that names no reader returns clearReader: true.
meter string, 4,096 characters at most no The value of the meter cookie on your site, when the browser sent one. A wrong value counts as an empty meter.
accessKey string, ^[a-z][a-z0-9-]{0,39}$ no The access key of a paid article, 1 to 40 lowercase letters, digits or hyphens that starts with a letter. Only level: paid accepts this field, and no field means paid. An unknown key returns 400 unknown_access_key.

Response 200

Response fields
FieldTypeAlways presentDescription
access full, registration_wall or paywall yes The access decision for this view. For full, send the paid part. For each other value, send the teaser and <norspire-wall>, and no paid part.
freeLeft integer, 0 or more or null yes The free articles that remain in the meter month after this view, or null. Render <norspire-meter> only when this field is a number.
known boolean yes true when reader names a live reader account of the publication. Add the known attribute to the Norspire elements on the page.
setMeter string or null yes The new value of the meter cookie, or null for no change. When this field is a string, set the meter cookie for 31 days.
clearReader boolean yes true when reader names no live reader. Delete the reader cookie and render the page for a visitor.
tierWall month or year or null yes Set only with access: paywall when the plan of the subscriber lacks the article access key. The value is the interval of that plan. Add tier-wall and access-key to <norspire-wall>.

Example

Request

curl -sS https://konto.example.no/api/v1/access \
  -H "Authorization: Bearer $SERVER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"article": "budget-plan", "level": "paid"}'

Response 200

{
  "access": "paywall",
  "freeLeft": null,
  "known": false,
  "setMeter": null,
  "clearReader": false,
  "tierWall": null
}

Errors

Error status codes for this operation
Statuscode
400invalid_request, unknown_access_key
401unauthenticated, key_mode_mismatch
403browser_request
404no_site
413too_large
415unsupported_media_type
429rate_limited
503busy

Read the cause and action for each code in the Errors reference.