Skip to main content
POST
/
agents
/
auth
/
runs
/
{run_id}
/
exchange
JavaScript
import Kernel from '@onkernel/sdk';

const client = new Kernel({
  apiKey: 'My API Key',
});

const response = await client.agents.auth.runs.exchange('run_id', { code: 'otp_abc123xyz' });

console.log(response.run_id);
{
  "run_id": "abc123xyz",
  "jwt": "eyJ0eXAi..."
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

run_id
string
required

Run ID from start endpoint

Body

application/json

Request to exchange handoff code for JWT

code
string
required

Handoff code from start endpoint

Example:

"otp_abc123xyz"

Response

Exchange successful, JWT returned

Response from exchange endpoint

run_id
string
required

Run ID

Example:

"abc123xyz"

jwt
string
required

JWT token with run_id claim (30 minute TTL)

Example:

"eyJ0eXAi..."