Sessions

Sessions are short-lived, single-use tokens that authorize a client (web widget, mobile SDK, or hosted link) to run a single domain connect flow.

Create Session

Mint a short-lived session token for client-side use. This endpoint must be called server-to-server using your secret API key.

POST/v1/sessions

Headers

Authorization: Bearer sk_live_{your_secret_key}
Content-Type: application/json
Idempotency-Key: (optional) unique string

Request body

FieldTypeRequiredDescription
user_idstringyesYour app's user identifier.
domainstringnoDomain to connect, if known ahead of time.
allowed_providersstring[]noRestrict the flow to specific providers.
expires_inintegernoTTL in seconds (default: 3600, max: 86400).
noncestringyesUnique string for replay protection.

Example request

curl -X POST https://api.dns.global/v1/sessions \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
  "user_id": "user_456",
  "domain": "shop.example.com",
  "expires_in": 3600,
  "nonce": "a1b2c3d4"
}'

Response — 201 Created

{
  "session_token": "sess_abc123def456...",
  "expires_at": "2026-06-01T13:00:00Z"
}

Errors

CodeMeaning
401Invalid or missing secret key
422Validation error (missing required fields)
429Rate limit exceeded

Keep your secret key server-side

Session creation must happen on your backend. If a secret key is exposed in client code, rotate it immediately from your dashboard.

Next steps

Was this page helpful?