Integrations

Admin API

Manage projects, environments, configs, targeting rules, segments, metrics, tags, webhooks, and analytics integrations over HTTPS with an API token. The base URL, authentication, permissions, error responses, usage counting, the endpoints, and the OpenAPI document.

Introduction

The Admin API is the HTTPS interface to everything you manage in the dashboard for a project: projects, environments, configs and their targeting rules, segments, and tags. It also manages the metrics an experiment measures and your organization's webhooks and analytics integrations. The Terraform provider and the MCP server are built on it, and anything they can do, a script of yours can do too.

Every request goes through the same validations as the dashboard, so a value that the dashboard would refuse is refused here with the same message. Every change shows in the audit log with a source of API and the name of the token that made it.

The API describes itself with an OpenAPI 3.1 document, which needs no authentication:

https://api.configdirector.com/v1/openapi.json

It holds the exact request and response schema of every endpoint on this page, including the targeting rule and segment condition shapes, and the base URL below as its server, so it is the file to hand to an OpenAPI client generator.

Base URL

https://api.configdirector.com/v1

Requests and responses are JSON. Send Content-Type: application/json with every request that has a body. Projects, environments, tags, webhooks, and integrations are addressed by their id, a UUID; configs and segments are addressed by their key, so a URL reads the way the dashboard does:

GET https://api.configdirector.com/v1/projects/{projectId}/configs/new-checkout

Authentication

Create an API token in the dashboard under API tokens and send it as a bearer token:

Authorization: Bearer YOUR-API-TOKEN

A token belongs to the member who created it, and only that member can see, rename, or revoke it. When it is created, it is given a subset of the permissions below, and it never has more than its creator's role grants, even if the role changes later. A token can have an expiration date, which is recommended for tokens stored on a workstation. Expired tokens are deleted 7 days after they expire. Keep tokens out of source control, and provide them through an environment variable or a secret store.

A request that is not authenticated, or that the token's permissions do not allow, is refused with 403 and a body that says why:

{
  "error": "The Authorization header is missing. Send `Authorization: Bearer <api token>`.",
  "code": "AUTHORIZATION_HEADER_MISSING"
}
codeMeaning
AUTHORIZATION_HEADER_MISSINGThe request has no Authorization header.
AUTHORIZATION_HEADER_INVALIDThe header is not of the form Bearer <api token>.
API_TOKEN_NOT_FOUNDNo token matches. It may have been revoked, deleted 7 days after it expired, or its organization disabled.
API_TOKEN_EXPIREDThe token's expiration date has passed. The message says when. You get this code for 7 days after the token expires. Create a new token.
API_TOKEN_OWNER_REMOVEDThe member who created the token no longer belongs to the organization. Create a new token.
INSUFFICIENT_PERMISSIONSThe token is valid but lacks the permission the endpoint needs. The endpoint table below names each one.

Permissions

Each endpoint needs one permission, named in the endpoints table, except the targeting rules reference and the API token endpoint, which any valid API token can read. The permissions the Admin API uses are:

ResourcePermissions
Projectsprojects:read, projects:create, projects:update, projects:delete
Environmentsenvironments:read, environments:create, environments:update, environments:delete
Configsconfigs:read, configs:create, config-settings:update, config-targeting-rules:update, configs:archive
Segmentssegments:read, segments:create, segments:update, segments:delete
Metricsmetrics:read, metrics:create, metrics:update, metrics:delete
Tagstags:read, tags:create, tags:update, tags:delete
Code referencescode-references:read, code-references:update
Contextscontexts:read, to evaluate a config for a saved context
Webhookswebhooks:manage, for every webhook endpoint. Only owners and admins can give it to a token.
Integrationsintegrations:manage, for every integration endpoint. Only owners and admins can give it to a token.

Creating a config needs only configs:create, with or without tags: the tag ids you send need no other permission. Finding an existing tag by name needs tags:read, and making a new tag before you create the config needs tags:create, so a config with some existing tags found by name and some new ones needs all three. Evaluating a config for a saved context needs contexts:read as well as configs:read; that is the only thing the Admin API does with contexts, which are otherwise browsed in the dashboard. Members, API tokens, SDK keys, and the audit log are managed in the dashboard only.

Terraform, OpenTofu, the CLI, and the audit log

Every change made through the API is recorded in the audit log with the source API and the token's name, except uploading or removing a repository scan, whose record is the repository's scan time. A request from Terraform, OpenTofu, or the ConfigDirector CLI names its client in the X-SourceClient header, so the audit log shows which one made the change. The accepted values are terraform, opentofu, and cli; any other value is recorded as API. The Terraform provider and the CLI send the header for you.

Responses and errors

StatusWhen
200The request succeeded and the body holds the resource.
204The request succeeded and there is nothing to return: updating a project or targeting rules, archiving a config, and deletions.
400The body failed validation. The response lists each problem, with the field it concerns when there is one. A config key that is already in use in the project is reported this way too, and so are a metric with the event name, filter, and value field of another metric in the project, a ratio metric with the numerator and denominator of another, a funnel metric with the steps of another in the same order, a project's 51st metric, and an update that names another event name, filter, value field, ratio, or funnel for a metric. A repository scan over one of its bounds is reported this way, naming the bound; a scan that would give a project its 51st scanned repository is refused with { "error": "...", "code": "REPOSITORY_LIMIT_REACHED" } instead. A webhook URL that is not https:// or whose host is private or cannot be found, an organization's 11th webhook or 11th integration, an integration whose settings do not fit its kind, and a test or resend on a disabled webhook or integration are reported this way too. Deleting a project or environment whose deletion protection is on, or a project with a protected environment, is reported this way too, naming where to turn it off.
403Not authenticated, or the token lacks the permission. See Authentication.
404No resource with that id or key exists in the project or organization. The body says which, { "error": "...", "code": "CONFIG_NOT_FOUND" }, with code one of PROJECT_NOT_FOUND, ENVIRONMENT_NOT_FOUND, CONFIG_NOT_FOUND, SEGMENT_NOT_FOUND, METRIC_NOT_FOUND, TAG_NOT_FOUND, SCANNED_REPOSITORY_NOT_FOUND, CONTEXT_NOT_FOUND, WEBHOOK_NOT_FOUND, WEBHOOK_DELIVERY_NOT_FOUND, INTEGRATION_NOT_FOUND, INTEGRATION_DELIVERY_NOT_FOUND, API_TOKEN_NOT_FOUND or EXPERIMENT_RUN_NOT_FOUND. A project id that no project of the organization has gets PROJECT_NOT_FOUND on every endpoint under /projects/{projectId}. An id in the path that is not a UUID gets an empty body.
409Deleting a segment that the targeting rules of a config still use. The body's usages lists each config and the environments whose rules use it. Deleting a metric while an experiment it is attached to has an open run (METRIC_IN_USE), or removing a kind that an experiment's primary metric decides on (METRIC_KIND_IN_USE); the body's usages lists those experiments.
413The request body is larger than 4 MB, or larger than 32 MB when uploading a repository scan.
429Service is suspended, because a Free organization has stayed over its free allowance past the billing grace period or a Pay as you go organization has reached its spending limit. The body is { "error": "Service suspended", "code": "SERVICE_SUSPENDED" } with a Retry-After header. A Free organization that has used up an hourly JSON Schema budget gets 429 too, with a message that says when the budget resets.

A 400 body:

{
  "errors": [
    { "name": "key", "message": "The key must be at least 4 characters long" }
  ]
}

Usage

Each request counts as one Admin API request against your organization's monthly free allowance of 10,000, and beyond it at the Pay as you go rates. Terraform applies and MCP tool calls count the same way, since both go through the API. Reading the OpenAPI document is free.

Endpoints

API token

MethodPathWhat it doesPermission
GET/api-tokenDescribe the API token that sends the request: its name, its organization's id and name, its permissions, and when it expires. Use it to tell which organization a token belongs to and what it can do.None, only a valid API token

permissions lists what the token can do now, in alphabetical order. A permission chosen for the token that its creator's role no longer grants is left out, and a token without permissions gets an empty list. expiresAt is null for a token that never expires.

Projects

MethodPathWhat it doesPermission
GET/projectsList the organization's projects, without their environments. Each carries storeCodeSnippets, whether the project stores code snippets, and deletionProtection, whether the project is protected from deletion.projects:read
POST/projectsCreate a project from a name and a slug. Returns it with its environments, Test and Production.projects:create
GET/projects/{projectId}Get a project with its environments.projects:read
PUT/projects/{projectId}Rename a project or change its slug. The project's Code snippets setting, storeCodeSnippets, and its Deletion protection setting, deletionProtection, are read-only here and change in the dashboard.projects:update
DELETE/projects/{projectId}Delete a project with everything in it.projects:delete

Environments

MethodPathWhat it doesPermission
GET/projects/{projectId}/environmentsList the project's environments. Each carries deletionProtection, whether the environment is protected from deletion.environments:read
POST/projects/{projectId}/environmentsCreate an environment from a name, a slug, a color, and whether it is live.environments:create
GET/projects/{projectId}/environments/{environmentId}Get an environment.environments:read
PUT/projects/{projectId}/environments/{environmentId}Update an environment's name, slug, color, or live flag. The environment's Deletion protection setting, deletionProtection, is read-only here and changes in the dashboard.environments:update
DELETE/projects/{projectId}/environments/{environmentId}Delete an environment and everything in it.environments:delete

Configs

MethodPathWhat it doesPermission
GET/projects/{projectId}/configsList the project's configs in key order, without targeting rules. search lists the configs whose key or description contains the text, ignoring case. role, type, status (the lifecycle state, such as settled or stale) and lifetime take one value each. Repeat tagIds to list the configs that have any of those tags, or send untagged=true for the configs without tags. A config is listed only when it matches every filter sent.configs:read
POST/projects/{projectId}/configsCreate a config from its key, role, type, and defaultValue, which becomes the default targeting rule value in every environment. lifetime is required for the config role and optional for the others, whose role decides it: flag and experiment are always temporary, kill-switch always permanent, and a value sent for those must match. Optional: description, typeOptions for the type's constraints, client and server availability, variations, tagIds, and, on an experiment, hypothesis.configs:create
GET/projects/{projectId}/configs/{configKey}Get a config with its targeting rules in every environment.configs:read
PATCH/projects/{projectId}/configs/{configKey}Update the config's settings: key, description, role, lifetime, typeOptions, variations, availability, tagIds, or, on an experiment, metrics and hypothesis. Only the fields sent change. role can only be updated from flag to kill-switch and back; an update to kill-switch makes the config permanent and resolves its open lifecycle and in-code default value mismatch alerts, an update to flag makes it temporary. A lifetime sent for a flag, kill-switch or experiment must match the role after the update. The type is never updated.config-settings:update
PUT/projects/{projectId}/configs/{configKey}/targetsReplace the targeting rules of one environment. See Updating targeting rules.config-targeting-rules:update
GET/projects/{projectId}/configs/{configKey}/activityThe time of the most recent evaluation per environment, SDK key kind, SDK name, and SDK version.configs:read
POST/projects/{projectId}/configs/{configKey}/evaluateEvaluate the config for a context in one environment and explain the result: the value served, the rule that served it, and what happened to each rule. See Evaluating a config.configs:read
POST/projects/{projectId}/configs/{configKey}/copyCopy the config into a new one under the key the body names, in this project or in the project projectId names, with its definition, tags and every environment's targeting rules. dryRun: true returns the plan without creating anything. See Copying a config.configs:create
GET/projects/{projectId}/configs/{configKey}/environments/{environmentId}/runsList an experiment's runs in one environment, newest first. See Experiment runs, shipping and stopping.configs:read
GET/projects/{projectId}/configs/{configKey}/runs/{runId}Get one run of the config.configs:read
POST/projects/{projectId}/configs/{configKey}/environments/{environmentId}/shipShip a variation in one environment: serve it to everyone and end the run. The body names the variationId and an optional note. See Experiment runs, shipping and stopping.config-targeting-rules:update
POST/projects/{projectId}/configs/{configKey}/environments/{environmentId}/stopStop the run in one environment: remove its percentage rollouts and keep the default targeting rule. The body can carry an optional note.config-targeting-rules:update
DELETE/projects/{projectId}/configs/{configKey}Archive the config. It can be restored from the dashboard for 30 days.configs:archive

A config's type is one of boolean, string, integer, float, enum, url, json, or timespan, and its role is config, flag, kill-switch, or experiment. typeOptions carries the constraints of the type: isInteger, min, and max for numbers, values and valueType for an enum, useSchema and schema for JSON, unit, min, max, and allowFractions for a timespan, and secureOnly for a URL. Configs Anatomy explains each.

An experiment's variations are a list of { id, name, value }. ConfigDirector gives each variation an id and keeps it for as long as the variation keeps its value, so renaming a variation keeps its id and changing its value gives it a new one. Create an experiment with its variations as { name, value }. To update them, send the complete list to PATCH, with or without the id that GET returns for each variation. A PATCH is refused with 400 when it sends an id that is not one of the config's variations, the same id twice, or the same value twice. A copy gives its variations new ids, and a config restored from the archive keeps the ones it had.

An experiment's metrics are the metrics attached to it, a list of { metricId, role, primaryKind }: up to 10, each with a role of primary, secondary, or guardrail. At most one is the primary, and it names primaryKind, the one kind of its metric that decides the experiment; primaryKind is null on the others, and you can leave it out when you send them. GET returns the primary first, then the secondaries, then the guardrails. To change them, send the complete list as metrics to PATCH: [] detaches every metric, and leaving metrics out keeps them. A PATCH is refused with 400 when it sends a non-empty metrics for a config that is not an experiment, more than 10, two primaries, the same metric twice, a metric that is not in the project, or a primaryKind its metric does not report. A new experiment and a copy start with no metrics, and archiving an experiment detaches its metrics, so a restored one has none.

An experiment's hypothesis is what the team expects the variations to do, up to 1,000 characters. Each run keeps the hypothesis as it was when the run started, so changing it later changes neither earlier runs nor the run in progress, and the next run starts with the new text. Send hypothesis when you create the experiment or in a PATCH to write it, or null or an empty string to remove it; GET leaves it out when there is none. A create or a PATCH that sends a hypothesis for a config that is not an experiment is refused with 400. A copy gets the source's hypothesis, and an experiment restored from the archive keeps the one it had.

In the targets that GET returns, every value that is one of the config's variations comes with that variation's id: variationId beside a rule's or a percentage's value, and defaultVariationId beside defaultValue. Look it up in variations to show the variation's name. A config without variations has neither.

Targeting rules reference

MethodPathWhat it doesPermission
GET/targeting-rules-referenceThe format PUT /projects/{projectId}/configs/{configKey}/targets accepts: the JSON Schema of the request body, the condition kinds, the operators for each target type, the attributes a condition can test, the operators of context kind and segment conditions, and notes on how rules are evaluated. It is the same document the MCP server's get_targeting_rules_reference tool returns.None, only a valid API token

Segments

MethodPathWhat it doesPermission
GET/projects/{projectId}/segmentsList the project's segments, each with the configs and environments whose rules use it.segments:read
POST/projects/{projectId}/segmentsCreate a segment from a key, a name, its condition groups, and optional environment overrides, a map from environment id to that environment's own groups.segments:create
GET/projects/{projectId}/segments/{segmentKey}Get a segment.segments:read
PUT/projects/{projectId}/segments/{segmentKey}Replace the segment's key, name, and groups. When overrides is sent, the environment overrides become exactly that map, so {} removes them all; when it is left out, they stay.segments:update
DELETE/projects/{projectId}/segments/{segmentKey}Delete the segment and its overrides. Refused with 409 while any config's rules use it.segments:delete

Metrics

A metric is what an experiment measures: the tracked events with one event name, all of them or only those that match the metric's filter. eventName is the name your application reports, 1 to 150 characters, compared exactly, letter case included. kinds lists what the metric reports, at least one of conversion (the share of exposed contexts that reported the event at least once), count-per-context (the events each exposed context reported, on average), and value-per-context (the sum of the event's value, or of the metric's value field, per exposed context, on average); a response lists them in that order, whatever order you sent. direction is higher-is-better or lower-is-better. description is optional, up to 1,000 characters. usages lists the experiments the metric is attached to: each configKey with its role, its primaryKind when the role is primary, and openRuns, the id, environmentId and startedAt of each run that has not ended.

filter and valueField are optional, and null on a metric without them. filter is a list of 1 to 5 conditions on fields of the details your application sends with the event, and the metric counts only the events that match all of them. Each condition is { field, targetType, operator, targetValues }. field is a JSON pointer to a field of the details, such as /plan or /order/plan, up to 500 characters. targetValues is a list of strings:

targetTypeoperatortargetValues
textis one of, is NOT one of1 to 20 values, each up to 500 characters
number=, !=, >, >=, <, <=One number, such as "2" or "19.99"
booleanequals"true" or "false"

A condition means what the same condition means in a targeting rule, with the event's details in the place of the context's traits. A field that is missing, null, an object, or a list reads as empty text, so is NOT one of matches an event without the field. A number condition reads a number or a text that holds one, such as "3", and only != matches an event whose field holds neither. A boolean condition compares the field with true or false.

valueField is a JSON pointer to the field of the details whose number the metric sums for value-per-context, in place of the event's own value. A metric with a value field has value-per-context among its kinds. An event whose value field is missing or does not hold a number still counts as an event and adds nothing to the sum.

A run counts a metric with a filter or a value field from the moment the metric is attached to the experiment, and each run's results say since when in counting.

A metric keeps the event name, filter, and value field it was created with. A project can have several metrics for one event name as long as their filter or value field differ, and at most 50 metrics. Two filters that hold the same conditions in another order, or the same target values in another order, are the same filter. A POST body with both:

{
  "eventName": "checkout_completed",
  "filter": [{ "field": "/plan", "targetType": "text", "operator": "is one of", "targetValues": ["team"] }],
  "valueField": "/items",
  "direction": "higher-is-better",
  "kinds": ["conversion", "value-per-context"]
}

Ratio metrics

A ratio metric divides one total by another, such as revenue per order: the value of checkout_completed events divided by how many there were. Its kinds is ["ratio"], and its definition is in ratio, a numerator and a denominator. Each side is { eventName, adds, filter, valueField }:

FieldWhat it says
eventNameThe event name the side adds up, 1 to 150 characters, compared exactly. Both sides can name the same event.
addsevents, where each event adds 1, or value, where each event adds its value.
filterOptional. The same conditions a metric's filter takes; the side adds up only the events that match all of them.
valueFieldOptional, and only on a side that adds value: the field of the details whose number the side sums in place of the event's own value. null on a side that adds events.

A POST body for revenue per order:

{
  "kinds": ["ratio"],
  "ratio": {
    "numerator": { "eventName": "checkout_completed", "adds": "value" },
    "denominator": { "eventName": "checkout_completed", "adds": "events" }
  },
  "direction": "higher-is-better"
}

A ratio metric has no event name, filter, or value field of its own: a response has eventName, filter, and valueField as null, and every other metric has ratio as null. A body names one definition: an event name, a ratio, or a funnel. A ratio with kinds other than ["ratio"], a ratio beside an eventName, filter, or valueField, ratio among the kinds of a metric with an eventName, and a valueField on a side that adds events are each refused with 400, naming the field.

A ratio metric keeps the ratio it was created with, counts toward the project's 50 metrics, and takes any role on an experiment; as the primary, its primaryKind is ratio. A project cannot have two ratio metrics with the same numerator and denominator, whatever the order of their conditions and target values.

Funnel metrics

A funnel metric gives the share of exposed contexts that reached the last of its steps in order, such as viewing the cart, starting the checkout, and completing it. Its kinds is ["funnel"], and its definition is in funnel, a list of 2 to 5 steps in the order a context goes through them. Each step is { eventName, filter }:

FieldWhat it says
eventNameThe event name that reaches the step, 1 to 150 characters, compared exactly.
filterOptional. The same conditions a metric's filter takes; only an event that matches all of them reaches the step.

Two steps can name the same event when their filters differ, such as two page_view steps on different pages. A step takes no value field.

A context reaches the first step with the first matching event it reports after its exposure, and each later step with the first matching event that happened at or after the moment it reached the step before. Two events that happened at the same time can reach consecutive steps, and one event never reaches two steps, even when it matches both. Other events in between do not matter, an event that happened before the step it follows was reached counts for nothing, and nothing limits the time between steps but the run's end. A context that goes through the steps again still counts once at each step.

An event that arrives late, after ConfigDirector has already counted events that happened after it, moves its context on from the steps it has reached by then, and the events already counted are not counted again. A context whose checkout_started arrives after its checkout_completed was counted stays at the second step.

A POST body for the cart to checkout funnel:

{
  "kinds": ["funnel"],
  "funnel": {
    "steps": [
      { "eventName": "cart_viewed" },
      { "eventName": "checkout_started" },
      { "eventName": "checkout_completed" }
    ]
  },
  "direction": "higher-is-better"
}

A funnel metric has no event name, filter, value field, or ratio of its own: a response has eventName, filter, valueField, and ratio as null, and every other metric has funnel as null. A funnel with fewer than 2 or more than 5 steps, two steps with the same event name and filter, a valueField on a step, a funnel with kinds other than ["funnel"], a funnel beside an eventName, filter, valueField, or ratio, and funnel among the kinds of another metric are each refused with 400, naming the field.

A funnel metric keeps the steps it was created with and their order, counts toward the project's 50 metrics, and takes any role on an experiment; as the primary, its primaryKind is funnel. A project cannot have two funnel metrics with the same steps in the same order, whatever the order of their conditions and target values.

MethodPathWhat it doesPermission
GET/projects/{projectId}/metricsList the project's metrics by event name, with the ratio and funnel metrics after them, each with the experiments it is attached to. With ?eventName=, only the metrics of one event name with that name, or an empty list; a ratio or funnel metric is never among them, whatever events its sides or steps name.metrics:read
POST/projects/{projectId}/metricsCreate a metric from an eventName, a direction, its kinds, and an optional filter, valueField, and description, or a ratio metric from a ratio, a direction, kinds of ["ratio"], and an optional description, or a funnel metric from a funnel, a direction, kinds of ["funnel"], and an optional description.metrics:create
GET/projects/{projectId}/metrics/{metricId}Get a metric.metrics:read
PATCH/projects/{projectId}/metrics/{metricId}Change the description, direction, or kinds you send and keep the rest. Send description as null to remove it. A metric keeps its event name, filter, value field, ratio, and funnel: another eventName, filter, valueField, ratio, or funnel is refused with 400, and one that repeats the current ones is accepted. Removing value-per-context from a metric with a value field is refused with 400 too, and so is any kinds but ["ratio"] for a ratio metric or ["funnel"] for a funnel metric. Removing a kind that an experiment's primary metric decides on is refused with 409.metrics:update
DELETE/projects/{projectId}/metrics/{metricId}Delete the metric and detach it from its experiments. Refused with 409 while one of them has an open run. Events with its name keep being received and counted. What runs counted for a metric with a filter or a value field is deleted with it.metrics:delete

Tags

MethodPathWhat it doesPermission
GET/projects/{projectId}/tagsList the project's tags by name.tags:read
POST/projects/{projectId}/tagsCreate a tag. Names are trimmed, 1 to 50 characters, and unique in the project ignoring case.tags:create
GET/projects/{projectId}/tags/by-nameFind a tag by name, ignoring surrounding whitespace and case.tags:read
GET/projects/{projectId}/tags/{tagId}Get a tag.tags:read
PUT/projects/{projectId}/tags/{tagId}Rename a tag. Its id, and every config assignment, stay the same.tags:update
DELETE/projects/{projectId}/tags/{tagId}Delete a tag. Configs that had it lose the assignment.tags:delete

Scanned repositories

The CLI uploads the code references it finds in a repository with configdirector scan --upload. A project keeps one set of references per scanned repository, replaced whole by each upload, and the dashboard uses them to show where a config is read in code and to mark the configs no scanned repository reads. A repository name is its git remote path without the host and .git, such as acme/shop, with the slash URL-encoded as %2F in the path.

MethodPathWhat it doesPermission
GET/projects/{projectId}/repositoriesList the project's scanned repositories by name, each with its latest scan's remoteUrl, commit, scannedAt and filesScanned, the referenceCount of direct and indirect references, the dynamicReferenceCount the scan could not resolve, and snippetsStored, whether its latest upload's snippets were kept.code-references:read
PUT/projects/{projectId}/repositories/{repositoryName}Upload a scan: remoteUrl, commit, filesScanned, and the references and dynamicReferences exactly as configdirector scan --json prints them. Replaces every reference the repository uploaded before; the first upload creates the repository. A project holds at most 50 scanned repositories, and a scan uploads at most 10,000 references, dynamic references included. The body may be up to 32 MB.code-references:update
DELETE/projects/{projectId}/repositories/{repositoryName}Remove a scanned repository and its references, so a renamed or retired repository no longer keeps configs in code.code-references:update

Snippets

A direct or indirect reference can carry a snippet, the lines of code around it, so the dashboard shows the code without opening the repository. A snippet has firstLine, the line number of its first line, lines, 1 to 11 strings of at most 250 characters each, language, one of typescript, tsx, javascript, jsx, vue, svelte, dart, swift, kotlin, java, python, csharp, go, ruby, php, rust, scala, groovy, objective-c, c, cpp and elixir, and truncatedLines, the numbers of the lines that were cut at 250 characters. The reference's line must fall within the snippet's lines. A snippet over one of these bounds is refused with 400, naming the problem. Dynamic references take no snippet.

A project's Code snippets setting, storeCodeSnippets, says whether the project stores snippets. When it is off, an upload that carries snippets still succeeds and is stored without them, and the repository's snippetsStored reads false.

Deletion protection

A project's or environment's Deletion protection setting, deletionProtection, says whether it is protected from deletion. A project or environment created through the Admin API or the MCP server starts with it off, as does a non-live environment created in the dashboard. A project created in the dashboard, and a live environment created in the dashboard, start with it on; an organization's first project and its Production environment start with it on too. It is turned on and off only in the dashboard, under the project's or environment's settings; the Admin API returns it and ignores it in POST and PUT bodies. While it is on, DELETE of the project or environment, and DELETE of a project that holds a protected environment, is refused with 400, naming where to turn it off.

Webhooks

Webhooks belong to the organization, so their paths have no project. Webhooks explains the webhook events they receive and how to verify them.

MethodPathWhat it doesPermission
GET/webhooksList the organization's webhooks in name order, without their secrets. Each carries lastDelivery, the newest delivery's status, attempts, nextAttemptAt and createdAt, or null before the first delivery.webhooks:manage
POST/webhooksCreate a webhook from a name and a url. Optional: up to 5 custom headers as { name, value }, enabled (true when left out), the projectIds, environmentIds and tagIds filters (empty matches everything), eventTypes (every change type when left out, the four experiment_run.* types included), and alertKinds (none when left out). Returns the webhook with its secret.webhooks:manage
GET/webhooks/{webhookId}Get a webhook with its secret. While a rotated secret still signs requests, previousSecretExpiresAt says until when.webhooks:manage
PUT/webhooks/{webhookId}Replace the webhook's name, URL, custom headers, filters, subscriptions, and whether it is enabled. A header sent without a value keeps its saved value, and a header left out is removed. Leaving out enabled enables the webhook. The secret never changes here.webhooks:manage
DELETE/webhooks/{webhookId}Delete the webhook and its deliveries.webhooks:manage
POST/webhooks/{webhookId}/rotate-secretGive the webhook a new secret. The previous one keeps signing every request too for 24 hours.webhooks:manage
POST/webhooks/{webhookId}/testSend a webhook.test webhook event. Returns its delivery, pending its first attempt.webhooks:manage
GET/webhooks/{webhookId}/deliveriesList the webhook's deliveries from the last 30 days, newest first, each with its attempts, the latest response and the webhook event sent. To list only the deliveries in one status, send status as pending, succeeded, failed or abandoned. limit is at most 50, which is also the default; when there are more, send nextCursor as before for the next page.webhooks:manage
POST/webhooks/{webhookId}/deliveries/{deliveryId}/resendSend the delivery's webhook event again under the same webhook-id. Returns the delivery, pending its next attempt.webhooks:manage

A webhook's headers hold only the header names: values are never returned. disabledReason is member when someone disabled the webhook, failures when ConfigDirector disabled it after repeated failures, and null while it is enabled. Disabling a webhook abandons its pending deliveries.

Integrations

Integrations belong to the organization, so their paths have no project. The Analytics overview explains what the markers say, and each tool's page lists the settings it needs.

MethodPathWhat it doesPermission
GET/integrationsList the organization's integrations in name order, without their credentials. Each carries lastDelivery, the newest delivery's status, attempts, nextAttemptAt and createdAt, or null before the first delivery.integrations:manage
POST/integrationsCreate an integration from a kind (amplitude, mixpanel, datadog, grafana or posthog) and its settings. Amplitude: dataCenter (us or eu), apiKey and secretKey. Mixpanel: dataResidency (us, eu or in), projectId, serviceAccountUsername and serviceAccountSecret. Datadog: site and apiKey. Grafana: url and serviceAccountToken. PostHog: host (us, eu or a self-hosted https:// URL), projectId and personalApiKey. Optional: name (the tool's name when left out), settings.endpointUrl to post somewhere else, enabled (true when left out), and the projectIds, environmentIds and tagIds filters (empty matches everything). Returns the integration with the url it posts to.integrations:manage
GET/integrations/{integrationId}Get an integration with its kind, its settings and the url it posts to. Credentials are never returned; credentialsSavedAt and credentialsSavedBy say when they were last saved and by whom.integrations:manage
PUT/integrations/{integrationId}Replace the integration's name, settings, filters, and whether it is enabled; kind must stay the one it was created with. Leave the credentials out of settings to keep the saved ones, or send them all to replace them; an Amplitude or Mixpanel integration refuses one key without the other. Changing a setting recomposes url. Leaving out enabled enables the integration.integrations:manage
DELETE/integrations/{integrationId}Delete the integration and its deliveries.integrations:manage
POST/integrations/{integrationId}/testPost a marker reading ConfigDirector test to the tool at the current time. Returns its delivery, pending its first attempt.integrations:manage
GET/integrations/{integrationId}/deliveriesList the integration's deliveries from the last 30 days, newest first, each with its attempts, the latest response and the body posted. status, limit and before work as on a webhook's deliveries.integrations:manage
POST/integrations/{integrationId}/deliveries/{deliveryId}/resendPost the delivery's body again. Returns the delivery, pending its next attempt.integrations:manage

An integration's settings hold the kind's non-secret fields and endpointUrl, null unless you set it; the credentials are never part of a response. disabledReason and enabled work as on a webhook.

Examples

Check which organization a token belongs to and what it can do:

curl https://api.configdirector.com/v1/api-token \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}"
{
  "name": "Laptop",
  "organization": { "id": "0199a3c2-5b1e-7d40-9f6a-2c8e4b7d1a30", "name": "Acme" },
  "permissions": ["configs:read", "projects:read"],
  "expiresAt": "2027-01-15T00:00:00.000Z"
}

List the projects of the organization:

curl https://api.configdirector.com/v1/projects \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}"

Create a feature flag that starts off in every environment. A feature flag is always temporary, so no lifetime is sent:

curl -X POST https://api.configdirector.com/v1/projects/${PROJECT_ID}/configs \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "new-checkout",
    "description": "The redesigned checkout flow",
    "role": "flag",
    "type": "boolean",
    "defaultValue": false
  }'

Updating targeting rules

PUT /projects/{projectId}/configs/{configKey}/targets replaces the rules of one environment. The body names the environment, the default targeting rule value, and the rules in order. Each rule, condition, and percentage carries an id, a UUID you generate.

A conditional rule serves true to two named users, and the default targeting rule serves false to everyone else:

curl -X PUT https://api.configdirector.com/v1/projects/${PROJECT_ID}/configs/new-checkout/targets \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "environmentId": "'"${ENVIRONMENT_ID}"'",
    "defaultValue": false,
    "rules": [
      {
        "id": "7a6b0d1e-3b4e-4a8e-9c3b-1f2e3d4c5b6a",
        "type": "conditional",
        "order": 0,
        "target": "value",
        "value": true,
        "conditions": [
          {
            "id": "0c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
            "kind": "attribute",
            "attribute": "identifier",
            "operator": "is one of",
            "targetType": "text",
            "targetValues": ["user-101", "user-202"]
          }
        ]
      }
    ]
  }'

A rule has a type of conditional or percentage. A conditional rule holds conditions, every one of which must match, and either a target of value with the value to serve or a target of percentage with percentages, a list of { id, percentage, value } that adds up to 100. A percentage rule holds only percentages. An attribute condition tests identifier, kind, name, appName, appVersion, or traits with a trait JSON pointer, read as the targetType text, number, semver, datetime, array, or boolean, each with its own operators. A segment condition is { id, kind: "segment", operator: "in" | "not in", segmentId }. The targeting rules reference and the OpenAPI document list every operator per target type, and the Terraform provider page shows the same rules in HCL.

Rules are validated against the config's type and constraints before they are saved, exactly as in the dashboard: a value outside an integer's range, a URL that is not HTTPS on a secure-only config, or a JSON value that fails the config's schema is refused with 400.

Experiment runs, shipping and stopping

An experiment has a run in an environment for as long as a percentage rollout is saved in that environment's targeting rules. The targeting rules save that adds the first rollout starts the run, and the save that removes the last one ends it; changing a rollout's shares, or adding or removing a rollout, ends the run as replaced and starts a new one. Only experiments have runs: a percentage rollout on a feature flag starts none.

GET /projects/{projectId}/configs/{configKey}/environments/{environmentId}/runs lists the environment's runs, newest first, and GET /projects/{projectId}/configs/{configKey}/runs/{runId} returns one. A run carries who started it and, once it has ended, who ended it (startedBy and endedBy: the member, the sourceClient and the API token when one was used), the startedAt and endedAt times, the outcome (shipped, stopped or replaced), the shippedVariationId when a variation was shipped, the replacedRunId when the run started because a split change ended the run it names, the hypothesis the experiment had when the run started, the note given when the run was shipped or stopped, and rollouts, the rollouts as they were when the run started: for each rollout rule its ruleId, its conditions in one line when it is a conditional rule, its controlVariationId (the variation the default targeting rule was serving when the run started, when the rollout holds it, otherwise its first share's; absent on runs that started before this field existed), and its shares with their variationId and percentage.

{
  "id": "0193a9c2-6f4e-7d2a-9b1c-3e5f7a9b1d2e",
  "configId": "0193a9c2-0000-7000-8000-000000000001",
  "environmentId": "0193a9c2-0000-7000-8000-000000000002",
  "startedAt": "2026-11-03T12:00:00.000Z",
  "startedBy": { "member": { "id": "…", "name": "Dana", "email": "dana@example.com" }, "sourceClient": "dashboard" },
  "endedAt": "2026-11-17T10:00:00.000Z",
  "endedBy": { "member": { "id": "…", "name": "Deploy bot", "email": "ops@example.com" }, "sourceClient": "api", "apiToken": { "id": "…", "name": "release-pipeline" } },
  "outcome": "shipped",
  "shippedVariationId": "0193a9c2-0000-7000-8000-000000000011",
  "replacedRunId": "0193a9c2-5e3d-7c1b-8a0f-2d4e6f8a0b1c",
  "hypothesis": "Urgency copy raises checkout completion by 5% without raising support tickets",
  "note": "Shipping urgency copy; social proof made no difference",
  "rollouts": [
    {
      "ruleId": "7d3e9b2f-0000-4000-8000-00000000bb00",
      "controlVariationId": "0193a9c2-0000-7000-8000-000000000010",
      "shares": [
        { "id": "7d3e9b2f-0000-4000-8000-00000000bb01", "variationId": "0193a9c2-0000-7000-8000-000000000010", "percentage": 50 },
        { "id": "7d3e9b2f-0000-4000-8000-00000000bb02", "variationId": "0193a9c2-0000-7000-8000-000000000011", "percentage": 50 }
      ]
    }
  ]
}

A run also says how each variation is doing against its control on the metrics attached to the experiment, in results, and how those numbers moved day by day, in series. They come from what the run has counted so far, so a metric you attach or a kind you tick after the run started shows the run's full history. A metric with a filter or a value field, a ratio metric and a funnel metric are the exception: a run counts each from the moment it is attached, and its counting says since when.

results.rollouts has one entry per rollout: its ruleId, the controlVariationId the other variations are compared against, its state, and crossovers, the contexts that were exposed to more than one variation of that rollout and are left out of every number. The state is needs-more-exposures until every variation of the rollout has enough exposures to compare, and ready from then on.

results.primary, results.secondary and results.guardrail list the attached metrics by role. Each metric has its metricId, eventName, filter, valueField, ratio, funnel and direction (a ratio metric has its ratio, a funnel metric its funnel, and each has null in the others), the primaryKind the primary metric decides on (null for the others), its counting, and kinds, one entry per kind it reports. Each kind has its rollouts, and each of those lists its variations, the control first:

FieldWhat it says
variationIdThe variation.
exposuresThe contexts counted for the variation, without its crossovers.
convertersOn a conversion kind: the contexts that reported the event. On a funnel kind: the contexts that reached the last step.
contextsThatReachedEachStepOn a funnel kind only: how many of the variation's contexts reached each step, in the order of the steps. The last number is converters.
numeratorTotalOn a ratio kind only: what the numerator added up over the variation's contexts.
denominatorTotalOn a ratio kind only: what the denominator added up over the variation's contexts.
valueThe share of contexts that reported the event on a conversion kind, the share that reached the last step on a funnel kind, the average per context on count-per-context and value-per-context, and numeratorTotal divided by denominatorTotal on a ratio kind, where it is absent while denominatorTotal is zero.
standardDeviationOn count-per-context and value-per-context: how far the numbers of single contexts spread around value, once the variation has two exposures. On a ratio kind: how far single contexts pull the ratio away from value, once the variation has two exposures and a value.
liftThe change against the control, as a fraction: 0.12 is 12% higher. On a conversion or funnel kind it allows for how few contexts were counted, so it can differ a little from the change between the two values. On the other kinds it is absent when the control's value is zero or negative.
intervallow and high, the range the lift is likely in. On the kinds other than conversion and funnel it is absent when the control's value is too close to zero for a range to mean anything.
chanceToBeatControlThe chance, from 0 to 1, that the variation is better than the control, respecting the metric's direction.
chanceToBeBestWith three or more variations in the rollout: the chance, from 0 to 1, that the variation is the best of them.
verdictlikely-better, likely-worse or no-clear-difference against the control. The verdict is a reading: nothing ships or stops on its own.

A variation of the cart to checkout funnel that exposed 4 contexts, of which 3 viewed the cart, 3 went on to start the checkout and 2 completed it, reads { "exposures": 4, "converters": 2, "contextsThatReachedEachStep": [3, 3, 2], "value": 0.5 }. The steps have no lift or verdict of their own.

lift, interval, chanceToBeatControl, chanceToBeBest and verdict appear once the rollout is ready. The control has no lift, interval, chanceToBeatControl or verdict, since it is what the others are compared against. On a ratio kind, a variation without a value has none of the five; when that variation is the control, no variation of the rollout has lift, interval, chanceToBeatControl or verdict, and while any variation of the rollout lacks a value, none has chanceToBeBest.

While a run is open, the primary metric's primaryKind also gives each ready rollout a runLengthEstimate: how long the run needs before a variation whose real lift is a given size has a good chance of reading likely-better. It covers lifts of 2%, 5%, 10%, 20% and 50% in the metric's better direction, so they are negative when lower is better. Each is a lift a variation might really have, not the one measured so far.

FieldWhat it says
analyzedExposuresThe rollout's exposures so far, all its variations together, without its crossovers.
exposuresPerDayHow many new exposures the rollout gets a day, counted since paceMeasuredSince.
paceMeasuredSinceThe end of the latest day in the primary metric's series that ended at least 7 days ago, or the run's start when the run, or that series, began less than 7 days ago.
liftsOne entry per lift: the lift, the exposuresNeeded, all variations together, and daysRemaining at the current pace. daysRemaining is 0 once the rollout has enough exposures, and absent when no new contexts were exposed since paceMeasuredSince.

A lift that would take a conversion, or a funnel's share, past 100% has no entry. runLengthEstimate is absent once the run ends, while the rollout needs more exposures, and when the control's numbers give nothing to estimate from, such as when none of the control's contexts has reported the event yet or reached a funnel's last step, or when a ratio's control has no value. New contexts usually arrive more slowly as a run goes on, so take daysRemaining as the least the run needs. How long a run needs says what else the estimate assumes.

For a control that converts 12.7%, split 50/50, with 2,400 exposures so far and about 400 more a day, runLengthEstimate reads:

{
  "analyzedExposures": 2400,
  "exposuresPerDay": 400,
  "paceMeasuredSince": "2026-11-04T00:00:00.000Z",
  "lifts": [
    { "lift": 0.02, "exposuresNeeded": 428610, "daysRemaining": 1066 },
    { "lift": 0.05, "exposuresNeeded": 69439, "daysRemaining": 168 },
    { "lift": 0.1, "exposuresNeeded": 17714, "daysRemaining": 39 },
    { "lift": 0.2, "exposuresNeeded": 4601, "daysRemaining": 6 },
    { "lift": 0.5, "exposuresNeeded": 813, "daysRemaining": 0 }
  ]
}

An ended run reports its final numbers, as of the moment it ended, and results.asOf gives that moment. For up to 25 minutes after a run ends, asOf is absent and the numbers are the ones counted so far. A run that ended without any exposures, or before ConfigDirector kept these numbers, never gets asOf.

counting says how much of the run a metric's numbers cover:

countingWhat it says
{ "kind": "whole-run" }The numbers cover the whole run. A metric of one event name without a filter or a value field always reads this way, and so does any other metric that was attached when the run started.
{ "kind": "since", "since": "<time>" }The metric was attached while the run was open, and only the events that happened at or after since count.
{ "kind": "not-counted" }The metric was never attached while the run was open, such as when the run ended before it was attached. The metric has no kinds.

Detaching a metric with a filter or a value field, a ratio metric or a funnel metric, and attaching it again while a run is open starts that run's counting over from the second attachment; changing its role or primary kind does not. A run that ended keeps what it counted. Conversion, the two averages and a funnel still divide by every exposure of the rollout, including the contexts exposed before since, and a funnel leaves out a first step reached before since; a ratio divides its two totals, both counted from since.

series has one entry per metric and kind: its metricId, its kind, its counting, and per rollout the days, one for each UTC day of the run once that day has ended, each with the day and the value of each variation at the end of that UTC day; a ratio's variation has no value on a day its denominator had added up nothing yet. series stops at the run's last UTC midnight, and results holds the numbers that include the time since. A metric counted since a time has its first day on the UTC day of that time, and a not-counted metric has no days.

{
  "results": {
    "asOf": "2026-11-17T10:00:00.000Z",
    "rollouts": [
      { "ruleId": "7d3e9b2f-0000-4000-8000-00000000bb00", "controlVariationId": "0193a9c2-0000-7000-8000-000000000010", "state": "ready", "crossovers": 12 }
    ],
    "primary": [
      {
        "metricId": "0193a9c2-0000-7000-8000-000000000020",
        "eventName": "checkout_completed",
        "filter": null,
        "valueField": null,
        "counting": { "kind": "whole-run" },
        "direction": "higher-is-better",
        "primaryKind": "conversion",
        "kinds": [
          {
            "kind": "conversion",
            "rollouts": [
              {
                "ruleId": "7d3e9b2f-0000-4000-8000-00000000bb00",
                "variations": [
                  { "variationId": "0193a9c2-0000-7000-8000-000000000010", "exposures": 1000, "converters": 30, "value": 0.03 },
                  {
                    "variationId": "0193a9c2-0000-7000-8000-000000000011",
                    "exposures": 1000,
                    "converters": 45,
                    "value": 0.045,
                    "lift": 0.4839,
                    "interval": { "low": -0.0444, "high": 1.3534 },
                    "chanceToBeatControl": 0.9606,
                    "verdict": "likely-better"
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "secondary": [],
    "guardrail": []
  },
  "series": [
    {
      "metricId": "0193a9c2-0000-7000-8000-000000000020",
      "kind": "conversion",
      "counting": { "kind": "whole-run" },
      "rollouts": [
        {
          "ruleId": "7d3e9b2f-0000-4000-8000-00000000bb00",
          "days": [
            {
              "day": "2026-11-04",
              "variations": [
                { "variationId": "0193a9c2-0000-7000-8000-000000000010", "value": 0.028 },
                { "variationId": "0193a9c2-0000-7000-8000-000000000011", "value": 0.041 }
              ]
            }
          ]
        }
      ]
    }
  ]
}

POST /projects/{projectId}/configs/{configKey}/environments/{environmentId}/ship ships a variation in one targeting rules save: the default targeting rule value becomes the variation's value, every percentage rollout is removed, a conditional rule left with nothing to serve is removed, and a conditional rule that serves a single value is kept. The run ends with the outcome shipped and the variation. The body names the variation and, optionally, a note of up to 1,000 characters saying why, which the run keeps:

curl -X POST https://api.configdirector.com/v1/projects/${PROJECT_ID}/configs/checkout-cta-copy/environments/${ENVIRONMENT_ID}/ship \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ "variationId": "0193a9c2-0000-7000-8000-000000000011", "note": "Shipping urgency copy; social proof made no difference" }'

POST /projects/{projectId}/configs/{configKey}/environments/{environmentId}/stop ends the run without choosing a variation: every percentage rollout is removed and the default targeting rule keeps serving. Its body is optional and holds only the note, as for a ship. It is refused with 400 when the config is not an experiment or no rollout is saved in the environment. Both actions answer with the config and its targeting rules after the save, as GET /projects/{projectId}/configs/{configKey} returns them, and both are recorded like any targeting rules update: one audit log entry and one targeting_rules.updated webhook event, beside the run's own experiment_run.shipped or experiment_run.stopped webhook event. A variationId that is not one of the config's variations, and a note longer than 1,000 characters, are refused with 400. A ship in an environment with no run keeps no note, since there is no run to keep it.

Copying a config

POST /projects/{projectId}/configs/{configKey}/copy creates a new config from an existing one: the same role, lifetime, type, constraints, variations, SDK availability, description, hypothesis and tags, and every environment's targeting rules and default targeting rule value. The copy starts as a new config with no old keys and shares nothing with the source afterwards. Every rule gets its own ids, and a percentage rollout in the copy assigns contexts to its shares on its own. The config limit and the validations of a create and of a targeting rules update apply, and an archived config cannot be copied until it is restored.

The copy stays in the same project unless the body names another project of the organization in projectId. Across projects, environments are matched by slug, tags by name and segments by key:

  • Each destination environment copies the rules and default targeting rule value of the source environment with the same slug. A source environment with no destination of its slug is skipped. A destination environment with no source of its slug has to be mapped in environments, destination slug to source slug, and the request is refused with 400 naming each unmapped environment until it is. A mapping can also replace a slug match.
  • A tag is matched to the destination tag with the same name. A missing tag is created in the destination project when the token has tags:create, and skipped otherwise.
  • A rule that tests a segment is rewritten to the destination segment with the same key. When no segment of that key exists in the destination, the rule is dropped and the plan lists it with its position and segment key. No segment is ever created, and no copy is refused over a segment.

Preview the copy first with dryRun: true. The response is the plan: for each destination environment, its slug, whether it is live, the environment the rules come from, how many rules are copied and the rules dropped; the source environments skipped; and the tags matched, created and skipped. Within a project every environment copies from itself and nothing is dropped or skipped.

curl -X POST https://api.configdirector.com/v1/projects/${PROJECT_ID}/configs/search-ranking/copy \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ "projectId": "'"${MOBILE_PROJECT_ID}"'", "key": "search-ranking", "environments": { "qa": "staging" }, "dryRun": true }'
{
  "plan": {
    "environments": [
      { "slug": "test", "live": false, "sourceSlug": "test", "rulesCopied": 2, "droppedRules": [] },
      { "slug": "qa", "live": false, "sourceSlug": "staging", "rulesCopied": 1, "droppedRules": [] },
      {
        "slug": "production",
        "live": true,
        "sourceSlug": "production",
        "rulesCopied": 2,
        "droppedRules": [{ "position": 2, "segmentKey": "beta-testers" }]
      }
    ],
    "skippedSourceEnvironments": [],
    "tags": { "matched": ["growth"], "created": ["search"], "skipped": [] }
  }
}

Here rule 2 of production tests the segment beta-testers, which the destination project does not have, so the copy carries the other two rules of that environment and leaves rule 2 out. Create the segment in the destination first and copy again to bring the rule along.

Send the same body without dryRun to create the copy. The response is 201 with the same plan and the created config, as GET /projects/{projectId}/configs/{configKey} returns it. A key already in use in the destination project, a reached config limit, or an unmapped destination environment is refused with 400 in the same shape as a create; a projectId of a project outside the organization is a 404 with the code PROJECT_NOT_FOUND.

Evaluating a config

POST /projects/{projectId}/configs/{configKey}/evaluate answers what a context gets for a config in one environment, and why. It evaluates the saved targeting rules of that environment with the same evaluator the SDKs use, so the answer is the one an application would get. Nothing is recorded: the request is not SDK activity, so it does not keep a config in use or count toward your SDK usage.

The body names the environment by id and describes the context one of three ways. An inline context carries what an application would send to the SDK; kind defaults to user, and identifier, name and traits are optional:

curl -X POST https://api.configdirector.com/v1/projects/${PROJECT_ID}/configs/new-checkout/evaluate \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "environmentId": "'"${ENVIRONMENT_ID}"'",
    "context": { "kind": "user", "identifier": "123", "name": "Ada", "traits": { "plan": "pro" } }
  }'

A saved context, one ConfigDirector has stored from an SDK's evaluations in that environment, is named by its kind and identifier and evaluated with its stored name and traits. This form needs contexts:read as well as configs:read:

curl -X POST https://api.configdirector.com/v1/projects/${PROJECT_ID}/configs/new-checkout/evaluate \
  -H "Authorization: Bearer ${CONFIGDIRECTOR_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ "environmentId": "'"${ENVIRONMENT_ID}"'", "savedContext": { "kind": "user", "identifier": "123" } }'

A body with only environmentId evaluates with an empty context, as an SDK given none would.

The response holds key, the config's current key even when the request used an old one; environment as { id, slug, name }; context, the context evaluated, or null for an empty one; value, the value served, as a string; variationId, the id of its variation when the config has one with that value; servedBy, either { "kind": "rule", "ruleId": "..." } or { "kind": "default" } for the default targeting rule; and rules, one entry per rule in evaluation order with its outcome (matched, not-matched, not-evaluated once an earlier rule served the value, or errored), its conditions with what each resolved to from the context, or which segment group matched, and the bucket a percentage rollout assigned the context to. A context without an identifier gets no bucket: a percentage rollout it reaches is skipped, which that rule reports as "outcome": "not-matched" with "rolloutSkippedNoIdentifier": true; the rules after it are evaluated and report their own outcomes, and the default targeting rule value is served when none of them matches. rolloutSkippedNoIdentifier is false on every other rule. targetingRules carries the environment's rules as GET /configs/{configKey} returns them in targets, and segments the definition of every segment those rules reference, keyed by segment id, with the groups in effect in that environment, so the response alone says what each rule tested. variations lists the config's variations as GET returns them, so an experiment's values can be shown by name.

A config, environment or saved context that does not exist is a 404 whose body says which: { "error": "...", "code": "CONFIG_NOT_FOUND" }, ENVIRONMENT_NOT_FOUND or CONTEXT_NOT_FOUND.