Skip to main content

Admin SDK API Reference

Complete API documentation for the Admin SDK.

new ReplaneAdmin(options)

Creates a new Admin API client.

Options

OptionTypeRequiredDescription
apiKeystringYesAdmin API key (starts with rpa_)
baseUrlstringYesReplane instance URL
agentstringNoCustom User-Agent identifier
fetchFntypeof fetchNoCustom fetch implementation (default: global)
Admin API keys vs SDK keys

The apiKey option expects an admin API key (prefixed rpa_), not an SDK key (rp_). Admin API keys are created in Workspace Settings > API Keys in the Replane dashboard. They grant management access to your workspace — creating, updating, and deleting resources.

SDK keys are a different concept: they are used by the runtime SDKs to read config values in your application.

Example

import { ReplaneAdmin } from '@replanejs/admin'

const admin = new ReplaneAdmin({
baseUrl: 'https://app.replane.dev',
apiKey: process.env.REPLANE_ADMIN_API_KEY, // rpa_...
})

Projects

admin.projects.list()

Lists all projects accessible to the API key.

Returns: Promise<{ projects: Project[] }>

const { projects } = await admin.projects.list()

admin.projects.get(request)

Gets a project by ID.

ParameterTypeRequiredDescription
projectIdstringYesProject ID

Returns: Promise<Project>

const project = await admin.projects.get({ projectId: 'proj-123' })

admin.projects.create(request)

Creates a new project in a workspace.

ParameterTypeRequiredDescription
workspaceIdstringYesParent workspace ID
namestringYesProject name
descriptionstringYesProject description

Returns: Promise<{ id: string }>

const { id } = await admin.projects.create({
workspaceId: 'ws-123',
name: 'My Project',
description: 'Production configs',
})

admin.projects.update(request)

Updates a project's name or description.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
namestringNoNew name
descriptionstringNoNew description

Returns: Promise<{ id: string }>

await admin.projects.update({
projectId: 'proj-123',
description: 'Updated description',
})

admin.projects.delete(request)

Deletes a project and all its resources.

ParameterTypeRequiredDescription
projectIdstringYesProject ID

Returns: Promise<void>

await admin.projects.delete({ projectId: 'proj-123' })

Configs

admin.configs.list(request)

Lists all configs in a project.

ParameterTypeRequiredDescription
projectIdstringYesProject ID

Returns: Promise<{ configs: ConfigListItem[] }>

const { configs } = await admin.configs.list({ projectId: 'proj-123' })

admin.configs.get(request)

Gets a config by name, including its full definition with base value, variants, and overrides.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
configNamestringYesConfig name

Returns: Promise<Config>

const config = await admin.configs.get({
projectId: 'proj-123',
configName: 'api-rate-limit',
})

admin.configs.create(request)

Creates a new config.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
namestringYesConfig name
descriptionstringYesConfig description
editorsstring[]YesList of editor email addresses
baseConfigBaseYesBase value, schema, and overrides
variantsConfigVariant[]YesPer-environment values

Returns: Promise<{ id: string }>

await admin.configs.create({
projectId: 'proj-123',
name: 'feature-new-ui',
description: 'Enable the new UI redesign',
editors: ['alice@example.com'],
base: {
value: false,
schema: null,
overrides: [],
},
variants: [],
})

admin.configs.update(request)

Updates a config's definition. Replaces the entire config — include all fields.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
configNamestringYesConfig name
descriptionstringYesConfig description
editorsstring[]YesList of editor email addresses
baseConfigBaseYesBase value, schema, and overrides
variantsConfigVariant[]YesPer-environment values

Returns: Promise<{ id: string, version: number }>

const { version } = await admin.configs.update({
projectId: 'proj-123',
configName: 'feature-new-ui',
description: 'Enable the new UI redesign',
editors: ['alice@example.com'],
base: {
value: true, // changed from false to true
schema: null,
overrides: [],
},
variants: [],
})

admin.configs.delete(request)

Deletes a config.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
configNamestringYesConfig name

Returns: Promise<void>

await admin.configs.delete({
projectId: 'proj-123',
configName: 'feature-new-ui',
})

Environments

admin.environments.list(request)

Lists all environments in a project.

ParameterTypeRequiredDescription
projectIdstringYesProject ID

Returns: Promise<{ environments: Environment[] }>

const { environments } = await admin.environments.list({
projectId: 'proj-123',
})
// [{ id: 'env-1', name: 'production', order: 0 }, ...]

SDK Keys

admin.sdkKeys.list(request)

Lists all SDK keys in a project. Does not include the key token — tokens are only returned on creation.

ParameterTypeRequiredDescription
projectIdstringYesProject ID

Returns: Promise<{ sdkKeys: SdkKey[] }>

const { sdkKeys } = await admin.sdkKeys.list({ projectId: 'proj-123' })

admin.sdkKeys.create(request)

Creates a new SDK key. The returned key field contains the token — it is only returned once and cannot be retrieved again.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
namestringYesKey name
descriptionstringNoKey description
environmentIdstringYesEnvironment to bind to

Returns: Promise<SdkKeyWithToken>

const sdkKey = await admin.sdkKeys.create({
projectId: 'proj-123',
name: 'Production Backend',
description: 'Main backend service',
environmentId: 'env-prod',
})

// Save immediately — only returned once
console.log(sdkKey.key) // "rp_..."

admin.sdkKeys.delete(request)

Deletes an SDK key. Any applications using this key will lose access.

ParameterTypeRequiredDescription
projectIdstringYesProject ID
sdkKeyIdstringYesSDK key ID

Returns: Promise<void>

await admin.sdkKeys.delete({
projectId: 'proj-123',
sdkKeyId: 'key-456',
})

Members

admin.members.list(request)

Lists all members of a project.

ParameterTypeRequiredDescription
projectIdstringYesProject ID

Returns: Promise<{ members: Member[] }>

const { members } = await admin.members.list({ projectId: 'proj-123' })
// [{ email: 'alice@example.com', role: 'admin' }, ...]

Workspaces

Workspace operations require superuser access.

admin.workspaces.list()

Lists all workspaces.

Returns: Promise<{ workspaces: Workspace[] }>

admin.workspaces.get(request)

Gets a workspace by ID.

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace ID

Returns: Promise<Workspace>

admin.workspaces.create(request)

Creates a new workspace.

ParameterTypeRequiredDescription
namestringYesWorkspace name

Returns: Promise<{ id: string }>

admin.workspaces.delete(request)

Deletes a workspace and all its projects.

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace ID

Returns: Promise<void>


Types

Project

interface Project {
id: string
name: string
description: string
createdAt: string
updatedAt: string
}

Config

interface Config {
id: string
name: string
description?: string
version: number
base: ConfigBase
variants: ConfigVariant[]
editors: string[]
createdAt: string
updatedAt: string
}

ConfigBase

interface ConfigBase {
value: unknown
schema: unknown | null
overrides: Override[]
}

ConfigVariant

interface ConfigVariant {
environmentId: string
value: unknown
schema: unknown | null
overrides: Override[]
useBaseSchema: boolean
}

ConfigListItem

Returned by configs.list() — a summary without the full config definition.

interface ConfigListItem {
id: string
name: string
description?: string
version: number
createdAt: string
updatedAt: string
}

Override

interface Override {
name: string
conditions: OverrideCondition[]
value: unknown
}

OverrideCondition

A union of all condition types:

type OverrideCondition =
| EqualsCondition
| InCondition
| NotInCondition
| LessThanCondition
| LessThanOrEqualCondition
| GreaterThanCondition
| GreaterThanOrEqualCondition
| SegmentationCondition
| AndCondition
| OrCondition
| NotCondition

Comparison conditions

interface EqualsCondition {
operator: 'equals'
property: string
value: ConditionValue
}

interface InCondition {
operator: 'in'
property: string
value: ConditionValue
}

interface NotInCondition {
operator: 'not_in'
property: string
value: ConditionValue
}

interface LessThanCondition {
operator: 'less_than'
property: string
value: ConditionValue
}

interface LessThanOrEqualCondition {
operator: 'less_than_or_equal'
property: string
value: ConditionValue
}

interface GreaterThanCondition {
operator: 'greater_than'
property: string
value: ConditionValue
}

interface GreaterThanOrEqualCondition {
operator: 'greater_than_or_equal'
property: string
value: ConditionValue
}

Segmentation condition

interface SegmentationCondition {
operator: 'segmentation'
property: string
fromPercentage: number
toPercentage: number
seed: string
}

Logical conditions

interface AndCondition {
operator: 'and'
conditions: OverrideCondition[]
}

interface OrCondition {
operator: 'or'
conditions: OverrideCondition[]
}

interface NotCondition {
operator: 'not'
condition: OverrideCondition
}

ConditionValue

Values used in conditions can be literals or references to other configs:

type ConditionValue = LiteralValue | ReferenceValue

interface LiteralValue {
type: 'literal'
value: unknown
}

interface ReferenceValue {
type: 'reference'
projectId: string
configName: string
path: (string | number)[]
}

Environment

interface Environment {
id: string
name: string
order: number
}

Workspace

interface Workspace {
id: string
name: string
createdAt: string
updatedAt: string
}

SdkKey

interface SdkKey {
id: string
name: string
description: string
environmentId: string
createdAt: string
}

SdkKeyWithToken

Returned only by sdkKeys.create(). Extends SdkKey with the actual key token.

interface SdkKeyWithToken extends SdkKey {
key: string
}

Member

interface Member {
email: string
role: string
}

ReplaneAdminError

Thrown when the API returns a non-2xx response.

Properties

PropertyTypeDescription
messagestringError message
statusnumberHTTP status code
responseApiError?Parsed error body from the server

Example

import { ReplaneAdminError } from '@replanejs/admin'

try {
await admin.configs.get({ projectId, configName: 'missing' })
} catch (error) {
if (error instanceof ReplaneAdminError) {
console.error(`${error.status}: ${error.message}`)
}
}