Skip to main content
POST
/
api
/
v1
/
ws
/
token
Mint a short-lived ws_token for browser/mobile websocket auth
curl --request POST \
  --url https://api-beta.pepay.io/api/v1/ws/token \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "scope": "merchant",
  "ttl_seconds": 60
}
'
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"scope": "merchant",
"merchant_id": 123,
"network_environment": null,
"expires_at": "2025-12-21T12:34:56.000Z",
"ws_url": "wss://api-beta.pepay.io/ws/merchant/events"
}
}

Authorizations

x-api-key
string
header
required

API key for server-to-server operations (scope=merchant or commerce)

Body

application/json
scope
enum<string>
Available options:
merchant,
commerce
ttl_seconds
integer
Example:

60

Response

Token minted

Standard ws_token mint response envelope.

success
boolean
Example:

true

data
object

Minted ws_token payload. Use data.token as token=<ws_token> when connecting to /ws/* streams.