PrivyPrivy
Sign in
  • Documentation
Information
Sessions
    Create a verification sessionpostExchange a verification codepost
Service
    Get the JSON Web Key SetgetGet service healthget
Schemas
powered by Zudoku
Sign in
Privy Digital ID API
Privy Digital ID API

Sessions

Server
Download schema

Create a verification session and exchange its result code.


Create a verification session

POST
https://stg-api-digitalid.privy.id
/v1/sessions
X-API-Key (header)

Creates a verification session and returns the widget URL to embed. This request has no body. Privy configures the data package (Contact or Identity), its data items, and the widget settings for each merchant at onboarding.

If the request times out, create a new session. The unused session expires automatically and is not charged.

Create a verification session › Responses

Verification session created

Session
session_id
​string · required

Unique verification-session identifier.

session_url
​string · uri · required

Widget URL to load in an iframe or WebView.

expires_at
​string · date-time · required

Time at which the session expires. Use this value. A fixed session duration is not guaranteed.

POST/v1/sessions
curl https://stg-api-digitalid.privy.id/v1/sessions \ --request POST \ --header 'X-API-Key: <api-key>'
Example Responses
{ "session_id": "9f1c2c8a-2d6f-4d60-9ab1-85a5d4aa93d0", "session_url": "https://stg-digitalid.privy.id/?t=eyJ...", "expires_at": "2026-07-21T18:15:00Z" }
json
application/json

Exchange a verification code

POST
https://stg-api-digitalid.privy.id
/v1/sessions/exchange
X-API-Key (header)

Exchanges the single-use code from the privy:success event for a verified-data JWT. The code has a short lifetime of approximately five minutes and requires the merchant API key.

This endpoint does not return the session status, and it does not accept session_id. An expired or reused code returns 404 not_found or 410 session_expired.

Exchange a verification code › Request Body

ExchangeRequest
code
​string · minLength: 1 · required

Single-use code from privy:success.payload.exchange_code.

Exchange a verification code › Responses

Code exchanged for a verified-data token

ExchangeResult
session_id
​string · required
event
​string · const · required
Const value: identity.verified
token
​string · required

Privy-signed EdDSA verified-data JWT.

POST/v1/sessions/exchange
curl https://stg-api-digitalid.privy.id/v1/sessions/exchange \ --request POST \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <api-key>' \ --data '{ "code": "exchange-code-from-privy-success" }'
Example Request Body
{ "code": "exchange-code-from-privy-success" }
json
application/json
Example Responses
{ "session_id": "9f1c2c8a-2d6f-4d60-9ab1-85a5d4aa93d0", "event": "identity.verified", "token": "eyJ...verified-data-jwt" }
json
application/json

Service