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,
read_only: true,
anonymize: true
},
)
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",
"portal_user_id": "string",
"contact_id": "5da0a718-c822-403d-9f5d-20d4584e0528",
"allowed_operations": ["getContact", "getContracts"],
"assignments": ["123:owner"],
"read_only": true,
"anonymize": true,
"last_used": "2026-02-24",
"expires_at": "2026-03-01T12:00:00.000Z"
}

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",
"portal_user_id": "string",
"contact_id": "5da0a718-c822-403d-9f5d-20d4584e0528",
"allowed_operations": ["getContact", "getContracts"],
"assignments": ["123:owner"],
"read_only": true,
"anonymize": true,
"last_used": "2026-02-24",
"expires_at": "2026-03-01T12:00:00.000Z"
}
]

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",
"portal_user_id": "string",
"contact_id": "5da0a718-c822-403d-9f5d-20d4584e0528",
"allowed_operations": ["getContact", "getContracts"],
"assignments": ["123:owner"],
"read_only": true,
"anonymize": true,
"last_used": "2026-02-24",
"expires_at": "2026-03-01T12:00:00.000Z"
}

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"
}
]
}

getPortalPreviewTokenJwksโ€‹

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

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

const { data } = await client.getPortalPreviewTokenJwks()
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"
}

getPortalPreviewTokenOIDCโ€‹

OpenID Connect configuration for Access Token API a a portal preview identity provider

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

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

getContactIdentificationTokenJwksโ€‹

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

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

const { data } = await client.getContactIdentificationTokenJwks()
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"
}
]
}

getContactIdentificationTokenOIDCโ€‹

OpenID Connect configuration for Access Token API as a contact identification identity provider

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

const { data } = await client.getContactIdentificationTokenOIDC()
Response
{
"issuer": "https://access-token.sls.epilot.io/v1/access-tokens/contact-identification",
"jwks_uri": "https://access-token.sls.epilot.io/v1/access-tokens/contact-identification/.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" | "portal_preview" | "contact_identification"

AccessTokenJourneyIdโ€‹

Journey ID for access token type "journey"

type AccessTokenJourneyId = string

PortalIdโ€‹

Portal ID for access token type "portal"

type PortalId = string

PortalUserIdโ€‹

Portal User ID for access token type "portal_preview"

type PortalUserId = string

ContactIdโ€‹

Contact entity ID for access token type "contact_identification"

type ContactId = string

AllowedOperationsโ€‹

openapi operationIds the token may call. Enforced by the API that consumes the token, which must additionally deny any operation not on this list. Baked into the token at issue time so widening the consumer's own allowlist later cannot retroactively widen a token that is already in circulation.

type AllowedOperations = string[]

TokenParametersโ€‹

type TokenParameters = {
name: string
token_type?: "api"
assignments?: string[]
expires_in?: number | string
read_only?: boolean
anonymize?: boolean
} | {
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[]
read_only?: boolean
anonymize?: boolean
} | {
name: string
token_type?: "app"
assignments?: string[]
expires_in?: number | string
read_only?: boolean
anonymize?: boolean
} | {
name: string
token_type?: "portal_preview"
portal_id: string
portal_user_id: string
} | {
name: string
token_type?: "contact_identification"
portal_id: string
contact_id: string
surface_id: string
allowed_operations: string[]
expires_in: number
email?: string
}

ExpiresInโ€‹

type ExpiresIn = number | string

ReadOnlyโ€‹

When true, the issued token may only perform read-only actions. Any action guarded by permissions that is not read-only (i.e. not a view/export/download action) is denied, regardless of the roles the token carries.

type ReadOnly = boolean

Anonymizeโ€‹

Forces PII anonymization on all entity data returned to this token. Cannot be disabled by the token bearer. See entity-api anonymized responses.

type Anonymize = boolean

AccessTokenParametersโ€‹

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

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[]
read_only?: boolean
anonymize?: boolean
}

AppTokenParametersโ€‹

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

PortalPreviewTokenParametersโ€‹

type PortalPreviewTokenParameters = {
name: string
token_type?: "portal_preview"
portal_id: string
portal_user_id: string
}

ContactIdentificationTokenParametersโ€‹

A token that acts as one contact, issued after that contact was identified by a portal's registration identifiers rather than by logging in. Distinct from portal_preview, which impersonates an existing portal user for a 360 operator: this kind belongs to no user, is minted for an unauthenticated cal

type ContactIdentificationTokenParameters = {
name: string
token_type?: "contact_identification"
portal_id: string
contact_id: string
surface_id: string
allowed_operations: string[]
expires_in: number
email?: string
}

AccessTokenItemโ€‹

type AccessTokenItem = {
id: string
created_at: string // date-time
name: string
token_type?: "api" | "journey" | "portal" | "assume" | "app" | "portal_preview" | "contact_identification"
journey_id?: string
portal_id?: string
portal_user_id?: string
contact_id?: string
allowed_operations?: string[]
assignments?: string[]
read_only?: boolean
anonymize?: boolean
last_used?: string // date
expires_at?: string // date-time
}

RoleIdโ€‹

Format: <organization_id>:<slug>

type RoleId = string

Assignmentsโ€‹

List of role ids attached to an user

type Assignments = string[]