Skip to main content
Developer

Fetch a session#

View as Markdown
On this page

Fetch an ID Check session to get its current state.

GET https://handover.prod.idcheck.bankid.no/api/v1/session/<<SESSION_ID>>

The Handover API spec gives the full response schema.

How it fits#

Poll this endpoint to follow the state of the session. Use the state only to give feedback to the user.

  • Poll from the merchant's server, because the request needs the access token.
  • Poll at most once every 3 seconds.
  • Stop when the state is final: completed, failed, aborted or expired.
  • Get a new access token when the current one expires. The token response gives its lifetime in seconds, in expires_in.

For the full flow, see the process overview.

Request#

Send an access token with the handover:read scope. See Authentication.

Replace <<SESSION_ID>> with the id from the create response. The spec calls this path parameter bindingId. Do not send a body.

GET /api/v1/session/<<SESSION_ID>> HTTP/1.1
Host: handover.prod.idcheck.bankid.no
Authorization: Bearer <<ACCESS_TOKEN>>

Response#

A successful request returns 200 OK and the session in payload. The session has the same properties as the create response.

This example shows a session that failed because the identity document failed the checks:

{
  "payload": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "branch_id": "e2c236a3-01f2-44a6-bb2a-1350938d84e4",
    "human_id": "not-used-1234",
    "client_reference": "2e496a55-3b51-4180-be71-bfd396043065",
    "state": "failed",
    "code": "BAD_DOCUMENT",
    "reason": "REIDENTIFICATION",
    "artefact_type": "PDF",
    "success_url": "https://example.com/id-check/success?id=3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "failure_url": "https://example.com/id-check/failure?id=3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "intent_url": "https://prod.idcheck.bankid.no/start?handoverId=3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "last_update": "2021-06-22T11:56:41.020Z",
    "qr_svg_path": "<<SVG_PATH_DATA>>",
    "play_store_url": null,
    "apple_store_url": null
  },
  "request_id": "request:6c1e2f3a-8b4d-4e5f-9a6b-7c8d9e0f1a2b",
  "response_id": "response:6c1e2f3a-8b4d-4e5f-9a6b-7c8d9e0f1a2b",
  "timestamp": "2021-06-22T11:56:43.512Z"
}

Because a GET request has no body, request_id is the value of the X-Request-Id header of the request. Without this header, the Handover API makes an ID.

  • A session can skip states, so a poll does not always show each state. See Session states.
  • If the user stops, the state changes to failed with the code ABANDONED. This occurs after 15 minutes without progress, or 1 hour after the user started the session.
  • A state update can arrive late, or not at all. Set a time limit, and stop polling after that time.
  • An expired session returns 200 OK with the state expired.
  • Handle unknown states and codes. See Session states and Failure codes.

Errors#

Errors have the same format as in Create a session.

StatuscodeCause
400 Bad RequestEINVALIDREQUESTThe request has a body without request_id or payload.
401 UnauthorizedEUNAUTHORISEDThe access token is not valid or has expired.
403 ForbiddenEFORBIDDENThe request has no Authorization header, or the access token does not have the handover:read scope.
404 Not FoundESESSIONMISSINGThe session ID is not a UUID, the session does not exist, or the session belongs to a different integration.
406 Not AcceptableEINVALIDCONTENTTYPEThe request has a Content-Type header with a value other than application/json.
500 Internal Server ErrorEUNKNOWNAn error occurred in the Handover API.

Next steps#

Was this page helpful?