Documentation / API reference / POST /handoff

POST /api/v1/handoff

Exchange a hand-off code for a reader token.

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

Authenticate with a server key in Authorization: Bearer <key>. Each hand-off code lives 60 seconds and works 1 time.

For middleware and redirect rules, read part 4 of the integration guide.

Request body

Body fields
FieldTypeRequiredDescription
code string, 4,096 characters at most yes The value of the ns_handoff query parameter from the reader request. A code that expired or ran before returns 400 invalid_code.

Response 200

Response fields
FieldTypeAlways presentDescription
reader string, 1 to 512 characters yes The reader token. Keep it as opaque text and set the reader cookie to this value.
maxAge integer, 0 to 2,592,000 yes Whole seconds until the hosted session ends, 2,592,000 at most. Use this value as Max-Age on the reader cookie.

Example

Request

curl -sS https://konto.example.no/api/v1/handoff \
  -H "Authorization: Bearer $SERVER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "5qyV3m0lLzVn0nIyl2m0pQm0r9m9Qn2o1iP7c5b3d1A"}'

Response 200

{
  "reader": "ns_rt_1_...",
  "maxAge": 2591000
}

Errors

Error status codes for this operation
Statuscode
400invalid_request, invalid_code
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.