Skip to content

Authentication ​

Every request carries two credentials: an API key and a service credential. The gateway attaches both. Endpoints that act for a signed-in user also need that user's token.

Credentials ​

CredentialHeaderSent onDescription
API keyx-api-keyEvery requestIdentifies the calling application
Service credentialAuthorizationEvery requestAuthorizes the calling system
User tokenAuthorizationUser-scoped endpointsIdentifies the signed-in user. Sent with the service credential

Do not put keys, tokens, or account identifiers in this repository. Use placeholders such as NaN and in examples.

User-scoped endpoints ​

These endpoints take the user from the bearer token, not from the request body:

EndpointWhat it does
Change passwordChanges the signed-in user's password
User agreementReads or records the signed-in user's agreement

A missing or invalid token returns 401.

Get a user token ​

  1. Call Start login to get the login address. Open it for the user.
  2. Call Login authorize with the returned code, or with a username and password. The response has the tokens.
  3. Use tokens.access_token on later calls. tokens.expires_in is the number of seconds until it expires.
  4. Call Logout with at least one token to end the session. When you send an id token, open the returned logout_url in the browser to finish logout.

Token fields ​

FieldTypeDescription
tokens.access_tokenstringToken for later calls
tokens.refresh_tokenstringPresent when a refresh token was issued
tokens.id_tokenstringPresent when an id token was issued
tokens.expires_innumberSeconds until the access token expires
tokens.token_typestringUsually bearer

Single sign-on accounts ​

Accounts that use single sign-on cannot change or reset a password through this API. Those calls return 400 with code SSO_ONLY_ACCOUNT.

Authentication errors ​

StatusCodeWhen
401The bearer token is missing or invalid
401The code, username, or password is not valid on Login authorize
403ENDUSER_FLOW_MISMATCHAsurion-enduser does not match the account that owns a reset code
400SSO_ONLY_ACCOUNTThe account uses single sign-on