Skip to main content

Access Token API

Usageโ€‹

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.accessToken.createAccessToken(...)

Tree-shakeable importโ€‹

import { getClient, authorize } from '@epilot/sdk/access-token'

const accessTokenClient = getClient()
authorize(accessTokenClient, () => '<token>')
const { data } = await accessTokenClient.createAccessToken(...)

Operationsโ€‹

Access Tokens

Public

Schemas

createAccessTokenโ€‹

Access Token type: API (default if not specified):

POST /v1/access-tokens

const { data } = await client.createAccessToken(
null,
{
name: 'Postman Access Token',
token_type: 'api',
assignments: ['123:owner'],
expires_in: 3600
},
)
Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...",
"id": "api_5ZugdRXasLfWBypHi93Fk",
"created_at": "1970-01-01T00:00:00.000Z",
"name": "Postman Access Token",
"token_type": "api",
"journey_id": "string",
"portal_id": "string",
"assignments": ["123:owner"],
"last_used": "2026-02-24"
}

listAccessTokensโ€‹

Lists all Access Tokens for current user (by default excludes system generated tokens)

GET /v1/access-tokens

const { data } = await client.listAccessTokens({
token_type: ['...'],
})
Response
[
{
"id": "api_5ZugdRXasLfWBypHi93Fk",
"created_at": "1970-01-01T00:00:00.000Z",
"name": "Postman Access Token",
"token_type": "api",
"journey_id": "string",
"portal_id": "string",
"assignments": ["123:owner"],
"last_used": "2026-02-24"
}
]

revokeAccessTokenโ€‹

Revokes an Access Token so it can't be used anymore.

DELETE /v1/access-tokens/{id}

const { data } = await client.revokeAccessToken({
id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
"id": "api_5ZugdRXasLfWBypHi93Fk",
"created_at": "1970-01-01T00:00:00.000Z",
"name": "Postman Access Token",
"token_type": "api",
"journey_id": "string",
"portal_id": "string",
"assignments": ["123:owner"],
"last_used": "2026-02-24"
}

getAccessTokenJwksโ€‹

Get jwks public key set to verify access tokens generated by this API

GET /v1/access-tokens/.well-known/jwks.json

const { data } = await client.getAccessTokenJwks()
Response
{
"keys": [
{
"alg": "RS256",
"e": "AQAB",
"kid": "tXWU5mPMbRPczpbQwi6vbhLF4GgF3wlMDSyqo7pfeiw=",
"kty": "RSA",
"n": "h_QDoCjZ8W_trtYXaP7_S22wf5r5Wd9XBLED78oT44bJjQXn8ddcFV8Hik65_4IYXVX_hTTU4zpxe3H8vx2j7-Zz3O59mYMp5S0MzODNEdf5Y_2o19eis0brmAJniixsNlQ9LlYkdrVamrgaxHu3ZpP_99zkfFybYeuYoQNzb3PyrT8xVnz_USs_nlFMHpGUxvvz7gfKPqxcLvgLJr4cwI9yzaSY9CD4qW181QVcnL_WzpQ8xx6AuhhHZQ1l_3GG4InTk8ahE7U2ZHVu8RrX6d01pMgc3piEcet9RgFLnhbTg3YIiKGoAbN42wJn_x3lgIAC42T9mbmTsHyUdS6nUQ",
"use": "sig"
}
]
}

getAccessTokenOIDCโ€‹

OpenID Connect configuration for Access Token API as identity provider

GET /v1/access-tokens/.well-known/openid-configuration

const { data } = await client.getAccessTokenOIDC()
Response
{
"issuer": "https://access-token.sls.epilot.io/v1/access-tokens",
"jwks_uri": "https://access-token.sls.epilot.io/v1/access-tokens/.well-known/jwks.json"
}

getPublicTokenJwksโ€‹

Get jwks public key set to verify public tokens generated by this API

GET /v1/access-tokens/public/.well-known/jwks.json

const { data } = await client.getPublicTokenJwks()
Response
{
"keys": [
{
"alg": "RS256",
"e": "AQAB",
"kid": "tXWU5mPMbRPczpbQwi6vbhLF4GgF3wlMDSyqo7pfeiw=",
"kty": "RSA",
"n": "h_QDoCjZ8W_trtYXaP7_S22wf5r5Wd9XBLED78oT44bJjQXn8ddcFV8Hik65_4IYXVX_hTTU4zpxe3H8vx2j7-Zz3O59mYMp5S0MzODNEdf5Y_2o19eis0brmAJniixsNlQ9LlYkdrVamrgaxHu3ZpP_99zkfFybYeuYoQNzb3PyrT8xVnz_USs_nlFMHpGUxvvz7gfKPqxcLvgLJr4cwI9yzaSY9CD4qW181QVcnL_WzpQ8xx6AuhhHZQ1l_3GG4InTk8ahE7U2ZHVu8RrX6d01pMgc3piEcet9RgFLnhbTg3YIiKGoAbN42wJn_x3lgIAC42T9mbmTsHyUdS6nUQ",
"use": "sig"
}
]
}

getPublicTokenOIDCโ€‹

OpenID Connect configuration for Access Token API a a public identity provider

GET /v1/access-tokens/public/.well-known/openid-configuration

const { data } = await client.getPublicTokenOIDC()
Response
{
"issuer": "https://access-token.sls.epilot.io/v1/access-tokens",
"jwks_uri": "https://access-token.sls.epilot.io/v1/access-tokens/.well-known/jwks.json"
}

Schemasโ€‹

AccessTokenโ€‹

A JWT Access Token

type AccessToken = string

AccessTokenIdโ€‹

type AccessTokenId = string

AccessTokenNameโ€‹

Human readable name for access token

type AccessTokenName = string

AccessTokenTypeโ€‹

Access token type

type AccessTokenType = "api" | "journey" | "portal" | "assume" | "app"

AccessTokenJourneyIdโ€‹

Journey ID for access token type "journey"

type AccessTokenJourneyId = string

PortalIdโ€‹

Portal ID for access token type "portal"

type PortalId = string

TokenParametersโ€‹

type TokenParameters = {
name: string
token_type?: "api"
assignments?: string[]
expires_in?: number | string
} | {
name: string
token_type?: "journey"
journey_id: string
expires_in?: number | string
} | {
name: string
token_type?: "portal"
portal_id: string
expires_in?: number | string
} | {
name: string
token_type?: "assume"
assignments?: string[]
} | {
name: string
token_type?: "app"
assignments?: string[]
expires_in?: number | string
}

ExpiresInโ€‹

type ExpiresIn = number | string

AccessTokenParametersโ€‹

type AccessTokenParameters = {
name: string
token_type?: "api"
assignments?: string[]
expires_in?: number | string
}

JourneyTokenParametersโ€‹

type JourneyTokenParameters = {
name: string
token_type?: "journey"
journey_id: string
expires_in?: number | string
}

PortalTokenParametersโ€‹

type PortalTokenParameters = {
name: string
token_type?: "portal"
portal_id: string
expires_in?: number | string
}

AssumeTokenParametersโ€‹

type AssumeTokenParameters = {
name: string
token_type?: "assume"
assignments?: string[]
}

AppTokenParametersโ€‹

type AppTokenParameters = {
name: string
token_type?: "app"
assignments?: string[]
expires_in?: number | string
}

AccessTokenItemโ€‹

type AccessTokenItem = {
id: string
created_at: string // date-time
name: string
token_type?: "api" | "journey" | "portal" | "assume" | "app"
journey_id?: string
portal_id?: string
assignments?: string[]
last_used?: string // date
}

RoleIdโ€‹

Format: <organization_id>:<slug>

type RoleId = string

Assignmentsโ€‹

List of role ids attached to an user

type Assignments = string[]