Tekscopes Developers

Server API and webhooks

Your product's server can look up people who have signed in to your product, and hear when something changes about them: a new name, email or phone, identity verification, or a sign-out.

Server API

Your server gets a token with your product's client id and client secret, then calls /private/cts-product/….

Webhooks

Tekscopes POSTs signed JSON events to your https address. You check the signature and answer 2xx.

Getting access

  1. Ask Tekscopes to switch on Server API access for your product and choose the scopes (tekscopes.users.read, tekscopes.kyc.read).
  2. For webhooks, send your https address and the events you want. You get a signing secret (whsec_…) once.
  3. Use the same client id and secret your product already signs people in with. Browser-only products have no secret and can't use the server API.

Base address for the environment selected at the top: https://sso-api-dev.tekscopes.com. Everything on this page runs in your browser. Your secrets are sent only to that address, and are never saved.

1. Get a token

POST /oauth2/token with grant_type=client_credentials. Ask for the scopes you need; none are granted otherwise. Cache the token until it expires.

Scopes

2. Look up a person

Only people who have signed in to your product (and haven't removed its access) are found. Anyone else answers 25, so you can't tell whether they have a Tekscopes account. Fields your product's sign-in scopes don't cover are left out.

3. Webhooks

Each event is a POST to your address with Content-Type: application/json.

HeaderValue
Tekscopes-Webhook-IdThe event id. The same on every retry: use it to ignore repeats.
Tekscopes-Webhook-DeliveryThis delivery's id.
Tekscopes-Webhook-TimestampUnix seconds.
Tekscopes-Signaturet=<unix>,v1=<hex>. Two v1 values during a secret rotation.

Body: { "id", "type", "createdAt", "data" }

typedataWhen
user.updated{userId, changed: ["name","email","phone"]}A name, email or phone changed. Read the new values with the server API.
user.kyc_updated{userId, level, previousLevel, checks}Identity verification changed. level is your product's own level (you name them, e.g. "basic"); null until identity verification launches.
session.revoked{userId, sessions: "all" | "browser" | "device", reason, sid?, deviceId?}The person signed out, signed out everywhere, removed your product's access (reason: "access_removed"), or Tekscopes locked the account. Drop your sessions for them.
user.deleted{userId}Coming later.
ping{webhookId, clientId, message}A test sent by Tekscopes.

Answering and retries

  • Answer any 2xx within 5 seconds, and do slow work afterwards. Redirects aren't followed.
  • Retries after 1 min, 5 min, 30 min, 2 h, 6 h and 12 h. After that the delivery is marked failed; Tekscopes can send it again.
  • A webhook is switched off after 50 failures in a row, or after 3 days of failing.
  • Order isn't guaranteed. Use createdAt, and read the current state with the server API when it matters.

Signature checker

Paste a delivery your server received to see whether its signature is valid, or make a signed example to send to your own server. This runs in your browser only; nothing is sent anywhere.

Code samples

# Token
curl -s https://sso-api-dev.tekscopes.com/oauth2/token \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d grant_type=client_credentials \
  -d scope=tekscopes.users.read

# A person by id (the sub in your ID tokens)
curl -s https://sso-api-dev.tekscopes.com/private/cts-product/read/user/$USER_ID \
  -H "Authorization: Bearer $TOKEN"

# By phone: encode the + as %2B
curl -s "https://sso-api-dev.tekscopes.com/private/cts-product/read/user-by-phone?phone=%2B2348031234567" \
  -H "Authorization: Bearer $TOKEN"

Response codes

Token endpoint (OAuth errors)

errorMeaning
invalid_clientWrong client id or secret, or the secret is disabled.
unauthorized_clientServer API access isn't switched on for this product.
invalid_scopeA scope your product wasn't given.

Server API

responseCodeMeaning