Skip to content

Latest commit

 

History

History
440 lines (333 loc) · 8.13 KB

File metadata and controls

440 lines (333 loc) · 8.13 KB

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[]