Skip to main content

Organization API

Usageโ€‹

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.organization.getCurrentOrganization(...)

Tree-shakeable importโ€‹

import { getClient, authorize } from '@epilot/sdk/organization'

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

Operationsโ€‹

Organization

Organization Settings

Schemas

getCurrentOrganizationโ€‹

Get caller's current organization

GET /v2/organization/current

const { data } = await client.getCurrentOrganization()
Response
{
"id": "739224",
"name": "Epilot",
"email": "someone@epilot.cloud",
"phone": "+49123123123",
"website": "https://epilot.cloud",
"address": {
"country": "string",
"city": "string",
"postal_code": "string",
"street": "string",
"street_number": "string"
},
"organization_use": "Production",
"parent_production_org_id": "string",
"created_date": "1970-01-01T00:00:00.000Z",
"logo_url": "https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png",
"logo_thumbnail_url": "https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png",
"signature": "<p>Thanks</p>",
"is_unlicensed_org": false,
"style": {},
"type": "Vendor",
"symbol": "EPI",
"pricing_tier": "professional",
"free_user_limit": 50
}

getOrganizationโ€‹

Get an organization

GET /v2/organization/{org_id}

const { data } = await client.getOrganization({
org_id: 'example',
})
Response
{
"id": "739224",
"name": "Epilot",
"email": "someone@epilot.cloud",
"phone": "+49123123123",
"website": "https://epilot.cloud",
"address": {
"country": "string",
"city": "string",
"postal_code": "string",
"street": "string",
"street_number": "string"
},
"organization_use": "Production",
"parent_production_org_id": "string",
"created_date": "1970-01-01T00:00:00.000Z",
"logo_url": "https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png",
"logo_thumbnail_url": "https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png",
"signature": "<p>Thanks</p>",
"is_unlicensed_org": false,
"style": {},
"type": "Vendor",
"symbol": "EPI",
"pricing_tier": "professional",
"free_user_limit": 50
}

updateOrganizationโ€‹

Updates an organization

PATCH /v2/organization/{org_id}

const { data } = await client.updateOrganization(
{
org_id: 'example',
},
{
id: '739224',
name: 'Epilot',
email: 'someone@epilot.cloud',
phone: '+49123123123',
website: 'https://epilot.cloud',
address: {
country: 'string',
city: 'string',
postal_code: 'string',
street: 'string',
street_number: 'string'
},
organization_use: 'Production',
parent_production_org_id: 'string',
created_date: '1970-01-01T00:00:00.000Z',
logo_url: 'https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png',
logo_thumbnail_url: 'https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png',
signature: '<p>Thanks</p>',
is_unlicensed_org: false,
style: {},
type: 'Vendor',
symbol: 'EPI',
pricing_tier: 'professional',
free_user_limit: 50
},
)
Response
{
"id": "739224",
"name": "Epilot",
"email": "someone@epilot.cloud",
"phone": "+49123123123",
"website": "https://epilot.cloud",
"address": {
"country": "string",
"city": "string",
"postal_code": "string",
"street": "string",
"street_number": "string"
},
"organization_use": "Production",
"parent_production_org_id": "string",
"created_date": "1970-01-01T00:00:00.000Z",
"logo_url": "https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png",
"logo_thumbnail_url": "https://epilot-playground-organization-data.s3.eu-central-1.amazonaws.com/epilot-logo.png",
"signature": "<p>Thanks</p>",
"is_unlicensed_org": false,
"style": {},
"type": "Vendor",
"symbol": "EPI",
"pricing_tier": "professional",
"free_user_limit": 50
}

getSettingsโ€‹

Get full organization settings object

GET /v2/organization/{org_id}/settings

const { data } = await client.getSettings({
org_id: 'example',
})
Response
{
"double_opt_in": {
"enabled": true
}
}

putSettingsValueโ€‹

Updates an organization setting

PUT /v2/organization/{org_id}/settings/{key}

const { data } = await client.putSettingsValue(
{
org_id: 'example',
key: 'example',
},
{
enabled: true
},
)
Response
{
"enabled": true
}

deleteSettingsValueโ€‹

Updates an organization nsetting

DELETE /v2/organization/{org_id}/settings/{key}

const { data } = await client.deleteSettingsValue({
org_id: 'example',
key: 'example',
})

Schemasโ€‹

OrganizationIdโ€‹

type OrganizationId = string

Organizationโ€‹

type Organization = {
id?: string
name?: string
email?: string
phone?: string
website?: string
address?: {
country?: string
city?: string
postal_code?: string
street?: string
street_number?: string
}
organization_use?: "Production" | "Sandbox"
parent_production_org_id?: string
created_date?: string // date-time
logo_url?: string
logo_thumbnail_url?: string
signature?: string
is_unlicensed_org?: boolean
style?: Record<string, unknown>
type?: "Vendor" | "Partner"
symbol?: string
pricing_tier?: string
free_user_limit?: number
}

InternalOrganizationโ€‹

type InternalOrganization = {
id?: string
name?: string
email?: string
phone?: string
website?: string
address?: {
country?: string
city?: string
postal_code?: string
street?: string
street_number?: string
}
organization_use?: "Production" | "Sandbox"
parent_production_org_id?: string
created_date?: string // date-time
logo_url?: string
logo_thumbnail_url?: string
signature?: string
is_unlicensed_org?: boolean
style?: Record<string, unknown>
type?: "Vendor" | "Partner"
symbol?: string
pricing_tier?: string
free_user_limit?: number
}

SettingKeyโ€‹

type SettingKey = string

Settingsโ€‹

type Settings = Record<string, unknown>

SettingsValueโ€‹

type SettingsValue = string | number | boolean | Record<string, unknown>[] | Record<string, unknown>

CreateOrganizationRequestโ€‹

type CreateOrganizationRequest = {
organization_detail?: {
name: string
email_address?: string
type: string
organization_use?: "Production" | "Sandbox"
pricing_tier_id: string
}
owner_user?: {
full_name?: string
email_address: string
}
}

DataPointsResponseโ€‹

type DataPointsResponse = Array<{
id?: number
max_customer?: number
actual_customer?: number
}>

DataPointโ€‹

type DataPoint = {
id?: number
max_customer?: number
actual_customer?: number
}

OrganizationToCleanupโ€‹

type OrganizationToCleanup = {
org_id: string
deleted_at: string // date-time
deleted_by: string
}

OrganizationCleanupStatusโ€‹

type OrganizationCleanupStatus = {
org_id: string
service_name: string
operations?: Array<{
action?: string
resource?: string
extra_info?: string | number | boolean | Record<string, unknown>[] | Record<string, unknown>
}>
}