latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-1983295742.1 KB

060c53b503ce

portal

Exchange portal code

Exchange a short-lived code for a long-lived portal access token.

This endpoint is unauthenticated. The code itself serves as proof of authorization. Each code can only be redeemed once; subsequent attempts return 401.

The returned access token is valid for 24 hours and should be stored as an httpOnly cookie or used in the Authorization header for subsequent API calls.

post/v2/portal.exchangeCode

Request body

codestring required

The exchange code carried by the portal URL from portal.createSession. Must be valid, unexpired, and not previously redeemed.

Example request

{
  "code": "pst_abc123def456"
}

Response

Code exchanged successfully. Use the returned access token for subsequent API calls.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": {
    "accessToken": "pat_xyz789abc123",
    "expiresAt": 1711386400000
  }
}