Account authorization
Create provider authorization session
Creates a short-lived hosted authorization session for a WhatsApp account using auth_mode=qrcode. Open authorize_url in the user’s browser and treat the complete URL as a sensitive credential that must not be logged or shared.
https://api.unifyport.ai/v1/accounts/{account_id}/auth-sessionsSupported channels
Before you call
Use a server-side X-Api-Key for the workspace that owns the resource. Replace every placeholder before running a sample.
Prepare your parameters
- account_id
- Use data.id from account creation or an account query. Account identifiers belong to the workspace selected by X-Api-Key. Get account
Request parameters
Headers
X-Api-KeyWorkspace API key. The workspace is resolved from this header.
Path parameters
account_idIdentifier used in the authentication route.
Request body
This endpoint does not require a JSON request body.
Understand the result
Read status/auth_status and any auth_payload for the requested authorization action. Follow the channel guide when user input is needed; authorized means authorization is complete. Check runtime_status before sending messages.
Response 201 Created
{
"request_id": "<REQUEST_ID>",
"data": {
"account_id": "acc_example",
"provider": "whatsapp",
"auth_mode": "qrcode",
"status": "passkey_required",
"auth_payload": {
"type": "passkey",
"public_key": {
"challenge": "<BASE64URL_CHALLENGE>"
}
},
"authorize_url": "https://auth.example.com/authorize/whatsapp/<SESSION_TOKEN>",
"expires_at": "2026-08-12T08:10:00Z",
"switchable": false,
"available_auth_modes": [
"qrcode"
]
}
}
Response body
account_idProvider account this response refers to.
providerChannel identifier. Use the API value unchanged in later calls; see the enum below for the values returned by this endpoint.
enum: whatsapp
auth_modeAuthentication mode for this authorization session; currently qrcode.
statusCurrent authorization flow status, for example pending_auth, awaiting_qr_scan, awaiting_code, pending, passkey_required, passkey_pending, passkey_confirmation, passkey_confirmation_sent, authorized, or failed.
auth_payloadStandard payload needed for the current step. QR uses qr_code; code verification uses type=code; Passkey uses type=passkey and public_key. Mutually exclusive step payloads do not appear together.
authorize_urlShort-lived hosted authorization URL containing an opaque credential. Never log or share the complete URL.
format: uri
expires_atRFC3339 timestamp after which the current auth_payload is no longer valid.
format: date-time
switchableWhether the hosted authorization session allows the user to switch authentication modes.
available_auth_modes[]Authentication modes available within the hosted authorization session.
Responses
201201 Created
Request succeeded. See the example response body.
400Bad Request
The request body, path, or parameters are invalid.
401Unauthorized
The X-Api-Key header is missing or invalid.
409Conflict
The requested operation conflicts with an existing provider account or resource.
500Internal Server Error
The service encountered an unexpected error.
503Service Unavailable
A required backend service is temporarily unavailable.
If the request fails
Inspect HTTP status and error.code/numeric_code, and keep request_id for diagnosis. Correct invalid parameters, complete required authorization or check runtime state as appropriate. Confirm the outcome before retrying a send or another write. Error reference
- invalid_request · 10000 · 400
- Check required fields, formats and channel conditions, then correct the request.
- missing_api_key · 11000 · 401
- Check X-Api-Key and whether the workspace is active.
- invalid_api_key · 11001 · 401
- Check X-Api-Key and whether the workspace is active.