Skip to main content
POST
/
v2
/
portal.exchangeSession
Typescript (SDK)
import { Unkey } from "@unkey/api";

const unkey = new Unkey();

async function run() {
  const result = await unkey.portal.exchangeSession({
    sessionId: "pst_abc123def456",
  });

  console.log(result);
}

run();
{
  "meta": {
    "requestId": "req_123"
  },
  "data": {
    "token": "ps_xyz789abc123",
    "expiresAt": 1711386400000
  }
}

Documentation Index

Fetch the complete documentation index at: https://unkey-mintlify-ea078f9f.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Body

application/json
sessionId
string
required

The session token ID received from portal.createSession. Must be valid, unexpired, and not previously exchanged.

Minimum string length: 1
Example:

"pst_abc123def456"

Response

Session exchanged successfully. Use the returned token for subsequent API calls.

meta
object
required

Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The requestId is particularly important when troubleshooting issues with the Unkey support team.

data
object
required
Last modified on May 21, 2026