Environments API
- Base URL:
https://environments.sls.epilot.io - Full API Docs: https://docs.epilot.io/api/environments
Usageโ
import { epilot } from '@epilot/sdk'
epilot.authorize(() => '<token>')
const { data } = await epilot.environments.listEnvironmentVariables(...)
Tree-shakeable importโ
import { getClient, authorize } from '@epilot/sdk/environments'
const environmentsClient = getClient()
authorize(environmentsClient, () => '<token>')
const { data } = await environmentsClient.listEnvironmentVariables(...)
Operationsโ
environments
listEnvironmentVariablescreateEnvironmentVariablelistEnvironmentGroupsputEnvironmentGroupdeleteEnvironmentGroupgetEnvironmentVariableupdateEnvironmentVariabledeleteEnvironmentVariable
Schemas
EnvironmentValueTypeStringTranslationsMapEntryMapValueJsonValueLinkValueLinkFieldsListItemTypeListOfTextListOfStringListOfSecretStringListOfNumberListOfBooleanListOfJsonListOfLinkListValueEnvironmentValueEnvironmentVariableEnvironmentVariableListItemEnvironmentVariableListEnvironmentVariableCreateRequestEnvironmentVariableUpdateRequestEnvironmentGroupEnvironmentGroupListEnvironmentGroupUpsertRequest
listEnvironmentVariablesโ
List all environment variables for the organization. Returns metadata only, no secret values.
GET /v1/environments
const { data } = await client.listEnvironmentVariables()
Response
{
"items": [
{
"key": "string",
"type": "String",
"item_type": "String",
"description": "string",
"group": "string",
"value": "string",
"protected": true,
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
]
}
createEnvironmentVariableโ
Create a new environment variable or secret for the organization. If group is provided and the group does not yet exist, it is created automatically.
POST /v1/environments
const { data } = await client.createEnvironmentVariable(
null,
{
key: 'string',
type: 'String',
description: 'string',
group: 'string',
value: 'string',
protected: true
},
)
Response
{
"key": "string",
"type": "String",
"item_type": "String",
"description": "string",
"group": "string",
"value": "string",
"protected": true,
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
listEnvironmentGroupsโ
List all environment groups for the organization.
GET /v1/environments/groups
const { data } = await client.listEnvironmentGroups()
Response
{
"items": [
{
"name": "string",
"description": "string",
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
]
}
putEnvironmentGroupโ
Create or update an environment group by name. Acts as an upsert โ creates the group if it does not exist.
PUT /v1/environments/groups/{name}
const { data } = await client.putEnvironmentGroup(
{
name: 'example',
},
{
description: 'string'
},
)
Response
{
"name": "string",
"description": "string",
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
deleteEnvironmentGroupโ
Deletes a group. Variables assigned to this group become ungrouped.
DELETE /v1/environments/groups/{name}
const { data } = await client.deleteEnvironmentGroup({
name: 'example',
})
getEnvironmentVariableโ
Get an environment variable by key. Returns value for non-secret types, omitted for SecretString.
GET /v1/environments/{key}
const { data } = await client.getEnvironmentVariable({
key: 'example',
})
Response
{
"key": "string",
"type": "String",
"item_type": "String",
"description": "string",
"group": "string",
"value": "string",
"protected": true,
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
updateEnvironmentVariableโ
Create or update an environment variable. Acts as an upsert โ creates the variable if it does not exist. If group is provided and the group does not yet exist, it is created automatically.
PUT /v1/environments/{key}
const { data } = await client.updateEnvironmentVariable(
{
key: 'example',
},
{
type: 'String',
value: 'string',
description: 'string',
group: 'string',
protected: true
},
)
Response
{
"key": "string",
"type": "String",
"item_type": "String",
"description": "string",
"group": "string",
"value": "string",
"protected": true,
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
deleteEnvironmentVariableโ
Delete an environment variable by key.
DELETE /v1/environments/{key}
const { data } = await client.deleteEnvironmentVariable({
key: 'example',
})
Schemasโ
EnvironmentValueTypeโ
The structure a variable's value holds. SecretString is encrypted at rest and
its value is never returned. Every other type
may be served to browser-facing consumers. A List inherits this from its element
type: a List<SecretString> is never served.
type EnvironmentValueType = "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Map" | "JSON" | "Link" | "List"
StringTranslationsโ
A string translated per language. Keys are language codes (e.g. de,
en-US), matching the hyphen-only BCP-47 form epilot's i18n stack uses
everywhere else: ^[a-z]{2,3}(-[A-Za-z0-9]+)*$. The server enforces
that with LANGUAGE_KEY_PATTERN in src/core/value-types.ts โ the two are
not otherwise lin
type StringTranslations = Record<string, string>
MapEntryโ
One entry of a Map. key is the token a journey submits; value is
what the customer reads โ either one string, or one string per
language. Every entry of a Map must agree on which of the two it uses.
type MapEntry = {
key: string
value: string | Record<string, string>
}
MapValueโ
type MapValue = {
fallbackLanguage?: string
options: Array<{
key: string
value: string | Record<string, string>
}>
}
JsonValueโ
Arbitrary JSON object, e.g. a flat key/value map used by integrations for enum translation: {"Mr.": 1, "Ms. / Mrs.": 2}. Max 32 KB serialised.
type JsonValue = Record<string, unknown>
LinkValueโ
One URL with a label and description a customer reads. label and
description are each either a plain string or one string per language;
the two fields decide that independently โ a plain string means "the
same in every language". A translated field must carry the fallback
language.
The URL must
type LinkValue = {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
fallbackLanguage?: string
}
LinkFieldsโ
The fields of a link, without a fallback language โ the shape a List
item carries. Inside a list the fallback belongs to the wrapper, which
owns the language tabs for every row.
Restated rather than composed with LinkValue: allOf plus
additionalProperties: false is rejected by most validato
type LinkFields = {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
}
ListItemTypeโ
The element type a List holds โ every value type except the
containers. Map is already a keyed collection and a list of lists has
no consumer. A list is exactly as client-safe and exactly as secret as
its element type: a list of SecretString is encrypted per item and its
value is never returne
type ListItemType = "String" | "SecretString" | "Text" | "Number" | "Boolean" | "JSON" | "Link"
ListOfTextโ
type ListOfText = {
itemType: "Text"
items: string[]
}
ListOfStringโ
type ListOfString = {
itemType: "String"
items: string[]
}
ListOfSecretStringโ
Write-only in effect: the items are encrypted per item at rest and the
whole value is omitted from every read response, exactly as a
SecretString variable's value is. Read item_type to learn what a
list holds when its value is withheld.
type ListOfSecretString = {
itemType: "SecretString"
items: string[]
}
ListOfNumberโ
type ListOfNumber = {
itemType: "Number"
items: number[]
}
ListOfBooleanโ
type ListOfBoolean = {
itemType: "Boolean"
items: boolean[]
}
ListOfJsonโ
type ListOfJson = {
itemType: "JSON"
items: Record<string, unknown>[]
}
ListOfLinkโ
A list of links. fallbackLanguage applies to every item's translated
label and description; items may mix plain and translated fields
freely, since a plain string is a complete answer for any language.
type ListOfLink = {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
}>
}
ListValueโ
An ordered collection of one declared element type. Items round-trip in the order written; nothing sorts them. Holds at most 100 items.
The whole value is limited to 32768 characters when serialised โ the server enforces this, and it is not expressible per-property here.
type ListValue = {
itemType: "Text"
items: string[]
} | {
itemType: "Number"
items: number[]
} | {
itemType: "Boolean"
items: boolean[]
} | {
itemType: "JSON"
items: Record<string, unknown>[]
} | {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
}>
} | {
itemType: "String"
items: string[]
} | {
itemType: "SecretString"
items: string[]
}
EnvironmentValueโ
A variable's value. The JSON type corresponds to the variable's type:
String, SecretString and Text are strings, Number is a number,
Boolean is a boolean, and Map, JSON, Link and List are objects.
Numbers are IEEE 754 doubles; integers above 2^53 may lose precision on
round-trip.
type EnvironmentValue = string | number | boolean | {
fallbackLanguage?: string
options: Array<{
key: string
value: string | Record<string, string>
}>
} | Record<string, unknown> | {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
fallbackLanguage?: string
} | {
itemType: "Text"
items: string[]
} | {
itemType: "Number"
items: number[]
} | {
itemType: "Boolean"
items: boolean[]
} | {
itemType: "JSON"
items: Record<string, unknown>[]
} | {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
}>
} | {
itemType: "String"
items: string[]
} | {
itemType: "SecretString"
items: string[]
}
EnvironmentVariableโ
type EnvironmentVariable = {
key: string
type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Map" | "JSON" | "Link" | "List"
item_type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "JSON" | "Link"
description?: string
group?: string
value?: string | number | boolean | {
fallbackLanguage?: string
options: Array<{
key: { ... }
value: { ... }
}>
} | Record<string, unknown> | {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
fallbackLanguage?: string
} | {
itemType: "Text"
items: string[]
} | {
itemType: "Number"
items: number[]
} | {
itemType: "Boolean"
items: boolean[]
} | {
itemType: "JSON"
items: Record<string, unknown>[]
} | {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: { ... }
label: { ... }
description?: { ... }
}>
} | {
itemType: "String"
items: string[]
} | {
itemType: "SecretString"
items: string[]
}
protected?: boolean
created_at: string // date-time
updated_at: string // date-time
}
EnvironmentVariableListItemโ
type EnvironmentVariableListItem = {
key: string
type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Map" | "JSON" | "Link" | "List"
item_type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "JSON" | "Link"
description?: string
group?: string
value?: string | number | boolean | {
fallbackLanguage?: string
options: Array<{
key: { ... }
value: { ... }
}>
} | Record<string, unknown> | {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
fallbackLanguage?: string
} | {
itemType: "Text"
items: string[]
} | {
itemType: "Number"
items: number[]
} | {
itemType: "Boolean"
items: boolean[]
} | {
itemType: "JSON"
items: Record<string, unknown>[]
} | {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: { ... }
label: { ... }
description?: { ... }
}>
} | {
itemType: "String"
items: string[]
} | {
itemType: "SecretString"
items: string[]
}
protected?: boolean
created_at: string // date-time
updated_at: string // date-time
}
EnvironmentVariableListโ
type EnvironmentVariableList = {
items: Array<{
key: string
type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Map" | "JSON" | "Link" | "List"
item_type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "JSON" | "Link"
description?: string
group?: string
value?: string | number | boolean | {
fallbackLanguage?: { ... }
options: { ... }
} | Record<string, unknown> | {
url: { ... }
label: { ... }
description?: { ... }
fallbackLanguage?: { ... }
} | {
itemType: { ... }
items: { ... }
} | {
itemType: { ... }
items: { ... }
} | {
itemType: { ... }
items: { ... }
} | {
itemType: { ... }
items: { ... }
} | {
itemType: { ... }
fallbackLanguage?: { ... }
items: { ... }
} | {
itemType: { ... }
items: { ... }
} | {
itemType: { ... }
items: { ... }
}
protected?: boolean
created_at: string // date-time
updated_at: string // date-time
}>
}
EnvironmentVariableCreateRequestโ
type EnvironmentVariableCreateRequest = {
key: string
type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Map" | "JSON" | "Link" | "List"
description?: string
group?: string
value?: string | number | boolean | {
fallbackLanguage?: string
options: Array<{
key: { ... }
value: { ... }
}>
} | Record<string, unknown> | {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
fallbackLanguage?: string
} | {
itemType: "Text"
items: string[]
} | {
itemType: "Number"
items: number[]
} | {
itemType: "Boolean"
items: boolean[]
} | {
itemType: "JSON"
items: Record<string, unknown>[]
} | {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: { ... }
label: { ... }
description?: { ... }
}>
} | {
itemType: "String"
items: string[]
} | {
itemType: "SecretString"
items: string[]
}
protected?: boolean
}
EnvironmentVariableUpdateRequestโ
type EnvironmentVariableUpdateRequest = {
type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Map" | "JSON" | "Link" | "List"
value?: string | number | boolean | {
fallbackLanguage?: string
options: Array<{
key: { ... }
value: { ... }
}>
} | Record<string, unknown> | {
url: string
label: string | Record<string, string>
description?: string | Record<string, string>
fallbackLanguage?: string
} | {
itemType: "Text"
items: string[]
} | {
itemType: "Number"
items: number[]
} | {
itemType: "Boolean"
items: boolean[]
} | {
itemType: "JSON"
items: Record<string, unknown>[]
} | {
itemType: "Link"
fallbackLanguage?: string
items: Array<{
url: { ... }
label: { ... }
description?: { ... }
}>
} | {
itemType: "String"
items: string[]
} | {
itemType: "SecretString"
items: string[]
}
description?: string
group?: string
protected?: boolean
}
EnvironmentGroupโ
type EnvironmentGroup = {
name: string
description?: string
created_at: string // date-time
updated_at: string // date-time
}
EnvironmentGroupListโ
type EnvironmentGroupList = {
items: Array<{
name: string
description?: string
created_at: string // date-time
updated_at: string // date-time
}>
}
EnvironmentGroupUpsertRequestโ
type EnvironmentGroupUpsertRequest = {
description?: string
}