Skip to Content
DevelopersAuthentication

Authentication

Every request carries one API key in the Authorization header. The key decides which locations and which data the request can read.

Send the key

GET /v1/business HTTP/1.1 Host: developer.selflane.com Authorization: Bearer sl_live_…
  • Use the Bearer scheme and the whole key.
  • The API accepts only API keys. A Back Office login token, username, or password is refused.
  • Use HTTPS. Plain HTTP requests are redirected; don’t send a key over them.

About keys

  • Created by owners. A business owner creates the key in Back Office and chooses its locations, scopes, and optional expiry date.
  • Shown once. Back Office shows the full key only when it’s created. Selflane stores a hash, not the key. If the key is lost, the owner creates a new one.
  • Belongs to the business. The key keeps working if the person who created it leaves. Owners can see every key, its creator, and when it was last used.
  • Fixed scopes. A key’s scopes can’t change. To get another scope, the owner creates a new key with it, and you switch to the new key before the owner revokes the old one.
  • Locations can change. An owner can add or remove locations on a key. Read GET /v1/locations instead of hard-coding the list.

Revocation and expiry

Revoking a key stops it right away, on every request. Revocation is permanent. A key with an expiry date stops working at the end of that day.

Either way the API answers 401:

codeMeaning
revoked_credentialAn owner revoked the key.
expired_credentialThe key passed its expiry date.
invalid_credentialThe key is malformed, or Selflane doesn’t recognize it.
missing_credentialThe request had no Authorization header.

Don’t retry a 401. Alert someone who can get a new key from the owner.

Keep the key safe

  • Call the API only from your server. Never ship the key in a website, mobile app, or anything a customer can download.
  • Keep it out of source control and logs.
  • Use one key per integration, so the owner can revoke one without breaking the others.
  • Repeated requests with unknown keys from one IP address are rate limited, so a misconfigured key can slow down your other requests from the same address.
Last updated on