---
title: "Admin API"
description: "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, request rate limits, the endpoints, and the OpenAPI document."
canonical_url: "https://docs.configdirector.com/integrations/admin-api"
---
# 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, request rate limits, 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](#metrics) an experiment measures and your organization's [webhooks](https://docs.configdirector.com/integrations/webhooks) and [analytics integrations](https://docs.configdirector.com/integrations/analytics#mark-experiment-runs-on-your-charts). The [Terraform provider](https://docs.configdirector.com/integrations/terraform) and the [MCP server](https://docs.configdirector.com/integrations/mcp) 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:

```text
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

```text
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:

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

## Authentication

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

```text
Authorization: Bearer YOUR-API-TOKEN
```

When you generate a token, you choose its kind:

- A **user API token** belongs to you. Use one on your own machine, for the [CLI](https://docs.configdirector.com/integrations/cli) or a [coding agent](https://docs.configdirector.com/integrations/agents), so the changes it makes carry your name.
- An **organization API token** belongs to the organization. Use one for CI, [Terraform](https://docs.configdirector.com/integrations/terraform), and anything shared, so it keeps working when the member who generated it changes role or leaves.

<table>
<thead>
  <tr>
    <th>
      
    </th>
    
    <th>
      User API token
    </th>
    
    <th>
      Organization API token
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Who sees it
    </td>
    
    <td>
      Only the member who generated it
    </td>
    
    <td>
      Every developer, admin, and owner
    </td>
  </tr>
  
  <tr>
    <td>
      Who can edit, revoke, or delete it
    </td>
    
    <td>
      Only the member who generated it
    </td>
    
    <td>
      A developer, admin, or owner whose role grants every permission the token holds
    </td>
  </tr>
  
  <tr>
    <td>
      The permissions it works with
    </td>
    
    <td>
      The ones chosen for it that the role of the member who generated it still grants
    </td>
    
    <td>
      Exactly the ones chosen for it
    </td>
  </tr>
  
  <tr>
    <td>
      When the member who generated it changes role
    </td>
    
    <td>
      It works only with the chosen permissions the new role grants
    </td>
    
    <td>
      Nothing changes
    </td>
  </tr>
  
  <tr>
    <td>
      When the member who generated it leaves
    </td>
    
    <td>
      It stops working: every request is refused with <code>
        API_TOKEN_OWNER_REMOVED
      </code>
    </td>
    
    <td>
      Nothing changes
    </td>
  </tr>
  
  <tr>
    <td>
      A change made with it is recorded as made by
    </td>
    
    <td>
      The member who generated it, with the token
    </td>
    
    <td>
      The token, with no member
    </td>
  </tr>
</tbody>
</table>

Both kinds work with the Admin API, Terraform, OpenTofu, the [MCP server](https://docs.configdirector.com/integrations/mcp), and the CLI. A member generating or editing a token of either kind can give it only permissions their own role grants. An organization API token shows who generated it, but who can change it depends only on what it holds: a developer can edit one an admin generated when it holds nothing beyond a developer's role, and cannot edit one they generated after an admin gave it more.

The member who generated a user API token can convert it into an organization API token from the token's page, until it expires. It keeps its secret, its expiration, and its project access, so nothing changes where it is used, and it keeps the permissions it works with at that moment: a permission chosen for it that the member's role no longer grants is dropped. A token that works with no permission at that moment cannot be converted until it is given one. A conversion cannot be undone.

A token can have an expiration date, which is recommended for tokens stored on a workstation. The expiration is chosen when the token is generated and never changes. 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 token also has **project access**: the projects it reaches. It is chosen when the token is generated and can be changed later on the **API tokens** page by whoever can edit the token. With **All projects**, the token reaches every project of the organization, including projects created later. With **Selected projects**, it reaches only the projects picked for it, and a project created later is not added. A token with selected projects cannot create projects, manage webhooks or manage integrations, since those belong to the whole organization. Listing projects returns only its selected projects, and a request that names any other project is refused with `403` and the code `PROJECT_ACCESS_DENIED`, so copying a config to another project needs a token that reaches both. If a selected project is deleted, the token keeps working on the others. A token whose selected projects are all deleted reaches no project until it is edited.

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

```json
{
  "error": "The Authorization header is missing. Send `Authorization: Bearer <api token>`.",
  "code": "AUTHORIZATION_HEADER_MISSING"
}
```

<table>
<thead>
  <tr>
    <th>
      <code>
        code
      </code>
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        AUTHORIZATION_HEADER_MISSING
      </code>
    </td>
    
    <td>
      The request has no <code>
        Authorization
      </code>
      
       header.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        AUTHORIZATION_HEADER_INVALID
      </code>
    </td>
    
    <td>
      The header is not of the form <code>
        Bearer <api token>
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        API_TOKEN_NOT_FOUND
      </code>
    </td>
    
    <td>
      No token matches. It may have been revoked, deleted 7 days after it expired, or its organization disabled.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        API_TOKEN_EXPIRED
      </code>
    </td>
    
    <td>
      The token's expiration date has passed. The message says when. You get this code for 7 days after the token expires. Generate a new token.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        API_TOKEN_OWNER_REMOVED
      </code>
    </td>
    
    <td>
      The token is a user API token, and the member who generated it no longer belongs to the organization. Generate a new token. For a token that a pipeline or anything shared uses, generate an organization API token, or have the member who generated a user API token convert it before they leave.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        INSUFFICIENT_PERMISSIONS
      </code>
    </td>
    
    <td>
      The token is valid but lacks the permission the endpoint needs. The endpoint table below names each one.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PROJECT_ACCESS_DENIED
      </code>
    </td>
    
    <td>
      The token is valid but its project access does not reach the project the request names. The message gives that project's id.
    </td>
  </tr>
</tbody>
</table>

## Permissions

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

<table>
<thead>
  <tr>
    <th>
      Resource
    </th>
    
    <th>
      Permissions
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Projects
    </td>
    
    <td>
      <code>
        projects:read
      </code>
      
      , <code>
        projects:create
      </code>
      
      , <code>
        projects:update
      </code>
      
      , <code>
        projects:delete
      </code>
      
      . Only a token with all projects can have <code>
        projects:create
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      Environments
    </td>
    
    <td>
      <code>
        environments:read
      </code>
      
      , <code>
        environments:create
      </code>
      
      , <code>
        environments:update
      </code>
      
      , <code>
        environments:delete
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Configs
    </td>
    
    <td>
      <code>
        configs:read
      </code>
      
      , <code>
        configs:create
      </code>
      
      , <code>
        config-settings:update
      </code>
      
      , <code>
        config-targeting-rules:update
      </code>
      
      , <code>
        configs:archive
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Segments
    </td>
    
    <td>
      <code>
        segments:read
      </code>
      
      , <code>
        segments:create
      </code>
      
      , <code>
        segments:update
      </code>
      
      , <code>
        segments:delete
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Metrics
    </td>
    
    <td>
      <code>
        metrics:read
      </code>
      
      , <code>
        metrics:create
      </code>
      
      , <code>
        metrics:update
      </code>
      
      , <code>
        metrics:delete
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Tags
    </td>
    
    <td>
      <code>
        tags:read
      </code>
      
      , <code>
        tags:create
      </code>
      
      , <code>
        tags:update
      </code>
      
      , <code>
        tags:delete
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Code references
    </td>
    
    <td>
      <code>
        code-references:read
      </code>
      
      , <code>
        code-references:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Contexts
    </td>
    
    <td>
      <code>
        contexts:read
      </code>
      
      , to evaluate a config for a saved context
    </td>
  </tr>
  
  <tr>
    <td>
      Webhooks
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
      
      , for every webhook endpoint. Only owners and admins can give it, and only to a token with all projects.
    </td>
  </tr>
  
  <tr>
    <td>
      Integrations
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
      
      , for every integration endpoint. Only owners and admins can give it, and only to a token with all projects.
    </td>
  </tr>
</tbody>
</table>

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 change made with a user API token is recorded as made by the member who generated it, and one made with an organization API token as made by the token, with no member. 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](https://docs.configdirector.com/integrations/cli) send the header for you.

## Responses and errors

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      When
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        200
      </code>
    </td>
    
    <td>
      The request succeeded and the body holds the resource.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        204
      </code>
    </td>
    
    <td>
      The request succeeded and there is nothing to return: updating a project or targeting rules, archiving a config, and deletions.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      The 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 retention metric with the event name, filter, and days of another, a project's 51st metric, and an update that names another event name, filter, value field, ratio, funnel, or retention 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 <code>
        { "error": "...", "code": "REPOSITORY_LIMIT_REACHED" }
      </code>
      
       instead. A webhook URL that is not <code>
        https://
      </code>
      
       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.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        403
      </code>
    </td>
    
    <td>
      Not authenticated, the token lacks the permission, or its project access does not reach the project the request names (<code>
        PROJECT_ACCESS_DENIED
      </code>
      
      ). See <a href="#authentication">
        Authentication
      </a>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        404
      </code>
    </td>
    
    <td>
      No resource with that id or key exists in the project or organization. The body says which, <code>
        { "error": "...", "code": "CONFIG_NOT_FOUND" }
      </code>
      
      , with <code>
        code
      </code>
      
       one of <code>
        PROJECT_NOT_FOUND
      </code>
      
      , <code>
        ENVIRONMENT_NOT_FOUND
      </code>
      
      , <code>
        CONFIG_NOT_FOUND
      </code>
      
      , <code>
        SEGMENT_NOT_FOUND
      </code>
      
      , <code>
        METRIC_NOT_FOUND
      </code>
      
      , <code>
        TAG_NOT_FOUND
      </code>
      
      , <code>
        SCANNED_REPOSITORY_NOT_FOUND
      </code>
      
      , <code>
        CONTEXT_NOT_FOUND
      </code>
      
      , <code>
        WEBHOOK_NOT_FOUND
      </code>
      
      , <code>
        WEBHOOK_DELIVERY_NOT_FOUND
      </code>
      
      , <code>
        INTEGRATION_NOT_FOUND
      </code>
      
      , <code>
        INTEGRATION_DELIVERY_NOT_FOUND
      </code>
      
      , <code>
        API_TOKEN_NOT_FOUND
      </code>
      
       or <code>
        EXPERIMENT_RUN_NOT_FOUND
      </code>
      
      . A project id that no project of the organization has gets <code>
        PROJECT_NOT_FOUND
      </code>
      
       on every endpoint under <code>
        /projects/{projectId}
      </code>
      
      . An id in the path that is not a UUID gets an empty body.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      Deleting a segment that the targeting rules of a config still use. The body's <code>
        usages
      </code>
      
       lists each config and the environments whose rules use it. Deleting a metric while an experiment it is attached to has an open run (<code>
        METRIC_IN_USE
      </code>
      
      ), or removing a kind that an experiment's primary metric decides on (<code>
        METRIC_KIND_IN_USE
      </code>
      
      ); the body's <code>
        usages
      </code>
      
       lists those experiments.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        413
      </code>
    </td>
    
    <td>
      The request body is larger than 4 MB, or larger than 32 MB when uploading a repository scan.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        429
      </code>
    </td>
    
    <td>
      An organization or a client address has sent more requests in the minute than a <a href="#request-rate-limits">
        request rate limit
      </a>
      
       allows. The body is <code>
        { "error": "...", "code": "REQUEST_RATE_LIMIT_REACHED" }
      </code>
      
       with a <code>
        Retry-After
      </code>
      
       header that says how many seconds to wait. A suspended service gets <code>
        429
      </code>
      
       too: 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 <code>
        { "error": "Service suspended", "code": "SERVICE_SUSPENDED" }
      </code>
      
       with a <code>
        Retry-After
      </code>
      
       header. A Free organization that has used up an hourly <a href="https://docs.configdirector.com/getting-started/json-schema-validation#hourly-budgets-on-free">
        JSON Schema budget
      </a>
      
       gets <code>
        429
      </code>
      
       too, with a message that says when the budget resets.
    </td>
  </tr>
</tbody>
</table>

A `400` body:

```json
{
  "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](https://docs.configdirector.com/getting-started/pricing-and-billing#the-free-allowance) of 10,000, and beyond it at the [Pay as you go rates](https://docs.configdirector.com/getting-started/pricing-and-billing#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, and so is a request refused with `429`.

## Request rate limits

Two limits apply to how many requests are accepted per minute. A client address is the IP address your requests come from; everyone behind the same address, such as an office, shares its count.

<table>
<thead>
  <tr>
    <th>
      Limit
    </th>
    
    <th>
      What counts toward it
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      1,200 requests from one organization
    </td>
    
    <td>
      Admin API requests made with any of the organization's API tokens. MCP tool calls do not count here; they have <a href="https://docs.configdirector.com/integrations/mcp#limits-and-billing">
        their own limit
      </a>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      3,000 requests from one client address
    </td>
    
    <td>
      Every request to the Admin API and the <a href="https://docs.configdirector.com/integrations/mcp">
        MCP server
      </a>
      
       from that address, whatever token it carries, reads of the OpenAPI document included. An IPv6 address shares its count with the other addresses of its /64 block.
    </td>
  </tr>
</tbody>
</table>

Each count covers one minute by the clock and starts again with the next. You may be served somewhat more than a limit, never less.

A request over a limit is refused with `429`, a `Retry-After` header that gives the seconds until the minute ends, and a body that names the limit, the organization's or the client address's:

```json
{
  "error": "This organization has reached its limit of 1,200 Admin API requests per minute. Retry after 23 seconds.",
  "code": "REQUEST_RATE_LIMIT_REACHED"
}
```

Wait the number of seconds in `Retry-After`, then send the request again. From version 0.12.0, the [Terraform provider](https://docs.configdirector.com/integrations/terraform) waits and sends the request again for you, up to three times, and so does the [CLI](https://docs.configdirector.com/integrations/cli) from version 0.27.0. Earlier versions of both stop with an error that mentions `429`, so run the command again a minute later.

A request with a valid token counts toward the organization's limit even when it is then refused for a missing permission or a resource that does not exist.

## Endpoints

### API token

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /api-token
      </code>
    </td>
    
    <td>
      Describe the API token that sends the request: its name, its kind, its organization's id and name, its permissions, its project access, and when it expires. Use it to tell which organization a token belongs to, what it can do, and in which projects.
    </td>
    
    <td>
      None, only a valid API token
    </td>
  </tr>
</tbody>
</table>

`kind` is `user` for a user API token and `organization` for an organization API token. `permissions` lists what the token can do now, in alphabetical order. For a user API token, a permission chosen for it that the role of the member who generated it no longer grants is left out; an organization API token lists every permission chosen for it. A token without permissions gets an empty list. `projectAccess` is `{ "kind": "all" }` for a token with all projects, and `{ "kind": "selected", "projectIds": [...] }` for a token with selected projects, with the ids of the projects it reaches. A selected project that has been deleted is left out, so a token whose selected projects are all deleted gets an empty `projectIds`. `expiresAt` is `null` for a token that never expires.

### Projects

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects
      </code>
    </td>
    
    <td>
      List the organization's projects, without their environments. Each carries <code>
        storeCodeSnippets
      </code>
      
      , whether the project stores code snippets, and <code>
        deletionProtection
      </code>
      
      , whether the project is protected from deletion. A token with selected projects gets only those projects.
    </td>
    
    <td>
      <code>
        projects:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects
      </code>
    </td>
    
    <td>
      Create a project from a <code>
        name
      </code>
      
       and a <code>
        slug
      </code>
      
      . Returns it with its environments, <code>
        Test
      </code>
      
       and <code>
        Production
      </code>
      
      .
    </td>
    
    <td>
      <code>
        projects:create
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}
      </code>
    </td>
    
    <td>
      Get a project with its environments.
    </td>
    
    <td>
      <code>
        projects:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PUT
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}
      </code>
    </td>
    
    <td>
      Rename a project or change its slug. The project's Code snippets setting, <code>
        storeCodeSnippets
      </code>
      
      , and its Deletion protection setting, <code>
        deletionProtection
      </code>
      
      , are read-only here and change in the dashboard.
    </td>
    
    <td>
      <code>
        projects:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}
      </code>
    </td>
    
    <td>
      Delete a project with everything in it.
    </td>
    
    <td>
      <code>
        projects:delete
      </code>
    </td>
  </tr>
</tbody>
</table>

### Environments

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

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

### Configs

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs
      </code>
    </td>
    
    <td>
      List the project's configs in key order, without targeting rules. <code>
        search
      </code>
      
       lists the configs whose key or description contains the text, ignoring case. <code>
        role
      </code>
      
      , <code>
        type
      </code>
      
      , <code>
        status
      </code>
      
       (the lifecycle state, such as <code>
        settled
      </code>
      
       or <code>
        stale
      </code>
      
      ) and <code>
        lifetime
      </code>
      
       take one value each. Repeat <code>
        tagIds
      </code>
      
       to list the configs that have any of those tags, or send <code>
        untagged=true
      </code>
      
       for the configs without tags. A config is listed only when it matches every filter sent.
    </td>
    
    <td>
      <code>
        configs:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs
      </code>
    </td>
    
    <td>
      Create a config from its <code>
        key
      </code>
      
      , <code>
        role
      </code>
      
      , <code>
        type
      </code>
      
      , and <code>
        defaultValue
      </code>
      
      , which becomes the default targeting rule value in every environment. <code>
        lifetime
      </code>
      
       is required for the <code>
        config
      </code>
      
       role and optional for the others, whose role decides it: <code>
        flag
      </code>
      
       and <code>
        experiment
      </code>
      
       are always <code>
        temporary
      </code>
      
      , <code>
        kill-switch
      </code>
      
       always <code>
        permanent
      </code>
      
      , and a value sent for those must match. Optional: <code>
        description
      </code>
      
      , <code>
        typeOptions
      </code>
      
       for the type's constraints, <code>
        client
      </code>
      
       and <code>
        server
      </code>
      
       availability, <code>
        variations
      </code>
      
      , <code>
        tagIds
      </code>
      
      , and, on an experiment, <code>
        hypothesis
      </code>
      
      .
    </td>
    
    <td>
      <code>
        configs:create
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}
      </code>
    </td>
    
    <td>
      Get a config with its targeting rules in every environment.
    </td>
    
    <td>
      <code>
        configs:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PATCH
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}
      </code>
    </td>
    
    <td>
      Update the config's settings: <code>
        key
      </code>
      
      , <code>
        description
      </code>
      
      , <code>
        role
      </code>
      
      , <code>
        lifetime
      </code>
      
      , <code>
        typeOptions
      </code>
      
      , <code>
        variations
      </code>
      
      , <code>
        availability
      </code>
      
      , <code>
        tagIds
      </code>
      
      , or, on an experiment, <code>
        metrics
      </code>
      
       and <code>
        hypothesis
      </code>
      
      . Only the fields sent change. <code>
        role
      </code>
      
       can only be updated from <code>
        flag
      </code>
      
       to <code>
        kill-switch
      </code>
      
       and back; an update to <code>
        kill-switch
      </code>
      
       makes the config permanent and resolves its open lifecycle and in-code default value mismatch alerts, an update to <code>
        flag
      </code>
      
       makes it temporary. A <code>
        lifetime
      </code>
      
       sent for a <code>
        flag
      </code>
      
      , <code>
        kill-switch
      </code>
      
       or <code>
        experiment
      </code>
      
       must match the role after the update. The <code>
        type
      </code>
      
       is never updated.
    </td>
    
    <td>
      <code>
        config-settings:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PUT
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/targets
      </code>
    </td>
    
    <td>
      Replace the targeting rules of one environment. See <a href="#updating-targeting-rules">
        Updating targeting rules
      </a>
      
      .
    </td>
    
    <td>
      <code>
        config-targeting-rules:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/activity
      </code>
    </td>
    
    <td>
      The time of the most recent evaluation per environment, SDK key kind, SDK name, and SDK version.
    </td>
    
    <td>
      <code>
        configs:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/evaluate
      </code>
    </td>
    
    <td>
      Evaluate 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 <a href="#evaluating-a-config">
        Evaluating a config
      </a>
      
      .
    </td>
    
    <td>
      <code>
        configs:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/copy
      </code>
    </td>
    
    <td>
      Copy the config into a new one under the <code>
        key
      </code>
      
       the body names, in this project or in the project <code>
        projectId
      </code>
      
       names, with its definition, tags and every environment's targeting rules. <code>
        dryRun: true
      </code>
      
       returns the plan without creating anything. The token's project access must reach both projects. See <a href="#copying-a-config">
        Copying a config
      </a>
      
      .
    </td>
    
    <td>
      <code>
        configs:create
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/environments/{environmentId}/runs
      </code>
    </td>
    
    <td>
      List an experiment's runs in one environment, newest first. See <a href="#experiment-runs-shipping-and-stopping">
        Experiment runs, shipping and stopping
      </a>
      
      .
    </td>
    
    <td>
      <code>
        configs:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/runs/{runId}
      </code>
    </td>
    
    <td>
      Get one run of the config.
    </td>
    
    <td>
      <code>
        configs:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/environments/{environmentId}/ship
      </code>
    </td>
    
    <td>
      Ship a variation in one environment: serve it to everyone and end the run. The body names the <code>
        variationId
      </code>
      
       and an optional <code>
        note
      </code>
      
      . See <a href="#experiment-runs-shipping-and-stopping">
        Experiment runs, shipping and stopping
      </a>
      
      .
    </td>
    
    <td>
      <code>
        config-targeting-rules:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}/environments/{environmentId}/stop
      </code>
    </td>
    
    <td>
      Stop the run in one environment: remove its percentage rollouts and keep the default targeting rule. The body can carry an optional <code>
        note
      </code>
      
      .
    </td>
    
    <td>
      <code>
        config-targeting-rules:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/configs/{configKey}
      </code>
    </td>
    
    <td>
      Archive the config. It can be restored from the dashboard for 30 days.
    </td>
    
    <td>
      <code>
        configs:archive
      </code>
    </td>
  </tr>
</tbody>
</table>

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](https://docs.configdirector.com/getting-started/configs) 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](#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

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /targeting-rules-reference
      </code>
    </td>
    
    <td>
      The format <code>
        PUT /projects/{projectId}/configs/{configKey}/targets
      </code>
      
       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 <code>
        get_targeting_rules_reference
      </code>
      
       tool returns.
    </td>
    
    <td>
      None, only a valid API token
    </td>
  </tr>
</tbody>
</table>

### Segments

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

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

### Metrics

A metric is what an experiment measures: the [tracked events](https://docs.configdirector.com/getting-started/experiments#track-the-outcome) 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:

<table>
<thead>
  <tr>
    <th>
      <code>
        targetType
      </code>
    </th>
    
    <th>
      <code>
        operator
      </code>
    </th>
    
    <th>
      <code>
        targetValues
      </code>
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        text
      </code>
    </td>
    
    <td>
      <code>
        is one of
      </code>
      
      , <code>
        is NOT one of
      </code>
    </td>
    
    <td>
      1 to 20 values, each up to 500 characters
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        =
      </code>
      
      , <code>
        !=
      </code>
      
      , <code>
        >
      </code>
      
      , <code>
        >=
      </code>
      
      , <code>
        <
      </code>
      
      , <code>
        <=
      </code>
    </td>
    
    <td>
      One number, such as <code>
        "2"
      </code>
      
       or <code>
        "19.99"
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        equals
      </code>
    </td>
    
    <td>
      <code>
        "true"
      </code>
      
       or <code>
        "false"
      </code>
    </td>
  </tr>
</tbody>
</table>

A condition means what the same condition means in a [targeting rule](https://docs.configdirector.com/getting-started/core-concepts#targeting-rules), 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`](#experiment-runs-shipping-and-stopping).

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:

```json
{
  "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 }`:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      What it says
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        eventName
      </code>
    </td>
    
    <td>
      The event name the side adds up, 1 to 150 characters, compared exactly. Both sides can name the same event.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        adds
      </code>
    </td>
    
    <td>
      <code>
        events
      </code>
      
      , where each event adds 1, or <code>
        value
      </code>
      
      , where each event adds its value.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filter
      </code>
    </td>
    
    <td>
      Optional. The same conditions a metric's <code>
        filter
      </code>
      
       takes; the side adds up only the events that match all of them.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        valueField
      </code>
    </td>
    
    <td>
      Optional, and only on a side that adds <code>
        value
      </code>
      
      : the field of the details whose number the side sums in place of the event's own value. <code>
        null
      </code>
      
       on a side that adds <code>
        events
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

A `POST` body for revenue per order:

```json
{
  "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`, a [`funnel`](#funnel-metrics), or a [`retention`](#retention-metrics). 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 }`:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      What it says
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        eventName
      </code>
    </td>
    
    <td>
      The event name that reaches the step, 1 to 150 characters, compared exactly.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filter
      </code>
    </td>
    
    <td>
      Optional. The same conditions a metric's <code>
        filter
      </code>
      
       takes; only an event that matches all of them reaches the step.
    </td>
  </tr>
</tbody>
</table>

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:

```json
{
  "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.

#### Retention metrics

A retention metric gives the share of contexts that reported an event between a first and a last day after their exposure, such as viewing the cart again in their second week. It is measured only over the contexts whose last day has passed. Its `kinds` is `["retention"]`, and its definition is in `retention`:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      What it says
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        eventName
      </code>
    </td>
    
    <td>
      The event name a context reports to count, 1 to 150 characters, compared exactly.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filter
      </code>
    </td>
    
    <td>
      Optional. The same conditions a metric's <code>
        filter
      </code>
      
       takes; only an event that matches all of them counts.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        firstDay
      </code>
    </td>
    
    <td>
      The first day an event counts on, a whole number from 1 to 90.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        lastDay
      </code>
    </td>
    
    <td>
      The last day an event counts on, a whole number from <code>
        firstDay
      </code>
      
       to 90. The same number as <code>
        firstDay
      </code>
      
       is a single day.
    </td>
  </tr>
</tbody>
</table>

Days are counted from each context's own exposure, in days of 24 hours: day 1 starts 24 hours after it, and day 7 starts 7 times 24 hours after it. Calendar days play no part. A retention takes no value field.

A `POST` body for viewing the cart again in the second week:

```json
{
  "kinds": ["retention"],
  "retention": { "eventName": "cart_viewed", "firstDay": 7, "lastDay": 13 },
  "direction": "higher-is-better"
}
```

A retention metric has no event name, filter, value field, ratio, or funnel of its own: a response has `eventName`, `filter`, `valueField`, `ratio`, and `funnel` as `null`, and every other metric has `retention` as `null`. A `firstDay` below 1, a `lastDay` above 90 or before the `firstDay`, a day that is not a whole number, a `valueField` in the `retention`, a `retention` with `kinds` other than `["retention"]`, a `retention` beside an `eventName`, `filter`, `valueField`, `ratio`, or `funnel`, and `retention` among the `kinds` of another metric are each refused with `400`, naming the field.

A context **came back** when it reported a matching event from the start of its first day to before the end of its last day. A context is **measured** once its last day has ended, `lastDay + 1` days after its exposure, and the metric's value is the share of the measured contexts that came back. So a metric for days 7 to 13 has no value for the first 14 days of a run, and the contexts exposed in a run's last 14 days are never measured, since nothing after a run's end counts. A context exposed to more than one variation of the rollout is never measured either. An event that arrives after its context was measured, having happened inside its days, still counts.

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

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/metrics
      </code>
    </td>
    
    <td>
      List the project's metrics by event name, with the ratio, funnel, and retention metrics after them, each with the experiments it is attached to. With <code>
        ?eventName=
      </code>
      
      , only the metrics of one event name with that name, or an empty list; a ratio, funnel, or retention metric is never among them, whatever events it names.
    </td>
    
    <td>
      <code>
        metrics:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/metrics
      </code>
    </td>
    
    <td>
      Create a metric from an <code>
        eventName
      </code>
      
      , a <code>
        direction
      </code>
      
      , its <code>
        kinds
      </code>
      
      , and an optional <code>
        filter
      </code>
      
      , <code>
        valueField
      </code>
      
      , and <code>
        description
      </code>
      
      , or a <a href="#ratio-metrics">
        ratio metric
      </a>
      
       from a <code>
        ratio
      </code>
      
      , a <code>
        direction
      </code>
      
      , <code>
        kinds
      </code>
      
       of <code>
        ["ratio"]
      </code>
      
      , and an optional <code>
        description
      </code>
      
      , or a <a href="#funnel-metrics">
        funnel metric
      </a>
      
       from a <code>
        funnel
      </code>
      
      , a <code>
        direction
      </code>
      
      , <code>
        kinds
      </code>
      
       of <code>
        ["funnel"]
      </code>
      
      , and an optional <code>
        description
      </code>
      
      , or a <a href="#retention-metrics">
        retention metric
      </a>
      
       from a <code>
        retention
      </code>
      
      , a <code>
        direction
      </code>
      
      , <code>
        kinds
      </code>
      
       of <code>
        ["retention"]
      </code>
      
      , and an optional <code>
        description
      </code>
      
      .
    </td>
    
    <td>
      <code>
        metrics:create
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/metrics/{metricId}
      </code>
    </td>
    
    <td>
      Get a metric.
    </td>
    
    <td>
      <code>
        metrics:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PATCH
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/metrics/{metricId}
      </code>
    </td>
    
    <td>
      Change the <code>
        description
      </code>
      
      , <code>
        direction
      </code>
      
      , or <code>
        kinds
      </code>
      
       you send and keep the rest. Send <code>
        description
      </code>
      
       as <code>
        null
      </code>
      
       to remove it. A metric keeps its event name, filter, value field, ratio, funnel, and retention: another <code>
        eventName
      </code>
      
      , <code>
        filter
      </code>
      
      , <code>
        valueField
      </code>
      
      , <code>
        ratio
      </code>
      
      , <code>
        funnel
      </code>
      
      , or <code>
        retention
      </code>
      
       is refused with <code>
        400
      </code>
      
      , and one that repeats the current ones is accepted. Removing <code>
        value-per-context
      </code>
      
       from a metric with a value field is refused with <code>
        400
      </code>
      
       too, and so is any <code>
        kinds
      </code>
      
       but <code>
        ["ratio"]
      </code>
      
       for a ratio metric, <code>
        ["funnel"]
      </code>
      
       for a funnel metric, or <code>
        ["retention"]
      </code>
      
       for a retention metric. Removing a kind that an experiment's primary metric decides on is refused with <code>
        409
      </code>
      
      .
    </td>
    
    <td>
      <code>
        metrics:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/metrics/{metricId}
      </code>
    </td>
    
    <td>
      Delete the metric and detach it from its experiments. Refused with <code>
        409
      </code>
      
       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.
    </td>
    
    <td>
      <code>
        metrics:delete
      </code>
    </td>
  </tr>
</tbody>
</table>

### Tags

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/tags
      </code>
    </td>
    
    <td>
      List the project's tags by name.
    </td>
    
    <td>
      <code>
        tags:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/tags
      </code>
    </td>
    
    <td>
      Create a tag. Names are trimmed, 1 to 50 characters, and unique in the project ignoring case.
    </td>
    
    <td>
      <code>
        tags:create
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/tags/by-name
      </code>
    </td>
    
    <td>
      Find a tag by <code>
        name
      </code>
      
      , ignoring surrounding whitespace and case.
    </td>
    
    <td>
      <code>
        tags:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/tags/{tagId}
      </code>
    </td>
    
    <td>
      Get a tag.
    </td>
    
    <td>
      <code>
        tags:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PUT
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/tags/{tagId}
      </code>
    </td>
    
    <td>
      Rename a tag. Its id, and every config assignment, stay the same.
    </td>
    
    <td>
      <code>
        tags:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/tags/{tagId}
      </code>
    </td>
    
    <td>
      Delete a tag. Configs that had it lose the assignment.
    </td>
    
    <td>
      <code>
        tags:delete
      </code>
    </td>
  </tr>
</tbody>
</table>

### Scanned repositories

The [CLI](https://docs.configdirector.com/integrations/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.

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/repositories
      </code>
    </td>
    
    <td>
      List the project's scanned repositories by name, each with its latest scan's <code>
        remoteUrl
      </code>
      
      , <code>
        commit
      </code>
      
      , <code>
        scannedAt
      </code>
      
       and <code>
        filesScanned
      </code>
      
      , the <code>
        referenceCount
      </code>
      
       of direct and indirect references, the <code>
        dynamicReferenceCount
      </code>
      
       the scan could not resolve, and <code>
        snippetsStored
      </code>
      
      , whether its latest upload's snippets were kept.
    </td>
    
    <td>
      <code>
        code-references:read
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PUT
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/repositories/{repositoryName}
      </code>
    </td>
    
    <td>
      Upload a scan: <code>
        remoteUrl
      </code>
      
      , <code>
        commit
      </code>
      
      , <code>
        filesScanned
      </code>
      
      , and the <code>
        references
      </code>
      
       and <code>
        dynamicReferences
      </code>
      
       exactly as <code>
        configdirector scan --json
      </code>
      
       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.
    </td>
    
    <td>
      <code>
        code-references:update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /projects/{projectId}/repositories/{repositoryName}
      </code>
    </td>
    
    <td>
      Remove a scanned repository and its references, so a renamed or retired repository no longer keeps configs in code.
    </td>
    
    <td>
      <code>
        code-references:update
      </code>
    </td>
  </tr>
</tbody>
</table>

#### 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](https://docs.configdirector.com/integrations/webhooks) explains the webhook events they receive and how to verify them.

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /webhooks
      </code>
    </td>
    
    <td>
      List the organization's webhooks in name order, without their secrets. Each carries <code>
        lastDelivery
      </code>
      
      , the newest delivery's <code>
        status
      </code>
      
      , <code>
        attempts
      </code>
      
      , <code>
        nextAttemptAt
      </code>
      
       and <code>
        createdAt
      </code>
      
      , or <code>
        null
      </code>
      
       before the first delivery.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /webhooks
      </code>
    </td>
    
    <td>
      Create a webhook from a <code>
        name
      </code>
      
       and a <code>
        url
      </code>
      
      . Optional: up to 5 custom <code>
        headers
      </code>
      
       as <code>
        { name, value }
      </code>
      
      , <code>
        enabled
      </code>
      
       (<code>
        true
      </code>
      
       when left out), the <code>
        projectIds
      </code>
      
      , <code>
        environmentIds
      </code>
      
       and <code>
        tagIds
      </code>
      
       filters (empty matches everything), <code>
        eventTypes
      </code>
      
       (every change type when left out, the four <code>
        experiment_run.*
      </code>
      
       types included), and <code>
        alertKinds
      </code>
      
      , by their <a href="#alert-kinds">
        identifiers
      </a>
      
       (none when left out). Returns the webhook with its <code>
        secret
      </code>
      
      .
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}
      </code>
    </td>
    
    <td>
      Get a webhook with its <code>
        secret
      </code>
      
      . While a rotated secret still signs requests, <code>
        previousSecretExpiresAt
      </code>
      
       says until when.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PUT
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}
      </code>
    </td>
    
    <td>
      Replace the webhook's name, URL, custom headers, filters, subscriptions, and whether it is enabled. A header sent without a <code>
        value
      </code>
      
       keeps its saved value, and a header left out is removed. Leaving out <code>
        enabled
      </code>
      
       enables the webhook. The secret never changes here.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}
      </code>
    </td>
    
    <td>
      Delete the webhook and its deliveries.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}/rotate-secret
      </code>
    </td>
    
    <td>
      Give the webhook a new <code>
        secret
      </code>
      
      . The previous one keeps signing every request too for 24 hours.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}/test
      </code>
    </td>
    
    <td>
      Send a <code>
        webhook.test
      </code>
      
       webhook event. Returns its delivery, pending its first attempt.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}/deliveries
      </code>
    </td>
    
    <td>
      List 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 <code>
        status
      </code>
      
       as <code>
        pending
      </code>
      
      , <code>
        succeeded
      </code>
      
      , <code>
        failed
      </code>
      
       or <code>
        abandoned
      </code>
      
      . <code>
        limit
      </code>
      
       is at most 50, which is also the default; when there are more, send <code>
        nextCursor
      </code>
      
       as <code>
        before
      </code>
      
       for the next page.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /webhooks/{webhookId}/deliveries/{deliveryId}/resend
      </code>
    </td>
    
    <td>
      Send the delivery's webhook event again under the same <code>
        webhook-id
      </code>
      
      . Returns the delivery, pending its next attempt.
    </td>
    
    <td>
      <code>
        webhooks:manage
      </code>
    </td>
  </tr>
</tbody>
</table>

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](https://docs.configdirector.com/integrations/analytics#mark-experiment-runs-on-your-charts) explains what the markers say, and each tool's page lists the settings it needs. The [Slack page](https://docs.configdirector.com/integrations/slack) explains what a Slack integration posts and who it notifies.

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Path
    </th>
    
    <th>
      What it does
    </th>
    
    <th>
      Permission
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /integrations
      </code>
    </td>
    
    <td>
      List the organization's integrations in name order, without their credentials. Each carries <code>
        lastDelivery
      </code>
      
      , the newest delivery's <code>
        status
      </code>
      
      , <code>
        attempts
      </code>
      
      , <code>
        nextAttemptAt
      </code>
      
       and <code>
        createdAt
      </code>
      
      , or <code>
        null
      </code>
      
       before the first delivery.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /integrations
      </code>
    </td>
    
    <td>
      Create an integration from a <code>
        kind
      </code>
      
       (<code>
        amplitude
      </code>
      
      , <code>
        mixpanel
      </code>
      
      , <code>
        datadog
      </code>
      
      , <code>
        grafana
      </code>
      
      , <code>
        posthog
      </code>
      
       or <code>
        slack
      </code>
      
      ) and its <code>
        settings
      </code>
      
      . Amplitude: <code>
        dataCenter
      </code>
      
       (<code>
        us
      </code>
      
       or <code>
        eu
      </code>
      
      ), <code>
        apiKey
      </code>
      
       and <code>
        secretKey
      </code>
      
      . Mixpanel: <code>
        dataResidency
      </code>
      
       (<code>
        us
      </code>
      
      , <code>
        eu
      </code>
      
       or <code>
        in
      </code>
      
      ), <code>
        projectId
      </code>
      
      , <code>
        serviceAccountUsername
      </code>
      
       and <code>
        serviceAccountSecret
      </code>
      
      . Datadog: <code>
        site
      </code>
      
       and <code>
        apiKey
      </code>
      
      . Grafana: <code>
        url
      </code>
      
       and <code>
        serviceAccountToken
      </code>
      
      . PostHog: <code>
        host
      </code>
      
       (<code>
        us
      </code>
      
      , <code>
        eu
      </code>
      
       or a self-hosted <code>
        https://
      </code>
      
       URL), <code>
        projectId
      </code>
      
       and <code>
        personalApiKey
      </code>
      
      . Slack: <code>
        webhookUrl
      </code>
      
      , the incoming webhook URL Slack created for the channel, starting with <code>
        https://hooks.slack.com/services/
      </code>
      
      ; optional <code>
        messagePrefix
      </code>
      
      , up to 200 characters (none when left out), and <code>
        postResolvedAlerts
      </code>
      
       (<code>
        true
      </code>
      
       when left out). A Slack integration also takes what it posts: <code>
        eventTypes
      </code>
      
       (<code>
        config.*
      </code>
      
       and <code>
        targeting_rules.updated
      </code>
      
       when left out), <code>
        alertKinds
      </code>
      
       (the six <a href="#alert-kinds">
        kinds
      </a>
      
       of the Application requests group when left out) and <code>
        minimumPriority
      </code>
      
       (<code>
        low
      </code>
      
      , <code>
        medium
      </code>
      
      , <code>
        high
      </code>
      
       or <code>
        critical
      </code>
      
      ; <code>
        high
      </code>
      
       when left out). Optional: <code>
        name
      </code>
      
       (the tool's name when left out), <code>
        settings.endpointUrl
      </code>
      
       for an analytics tool to post somewhere else, <code>
        enabled
      </code>
      
       (<code>
        true
      </code>
      
       when left out), and the <code>
        projectIds
      </code>
      
      , <code>
        environmentIds
      </code>
      
       and <code>
        tagIds
      </code>
      
       filters (empty matches everything). An organization can have up to 10 analytics integrations and 20 Slack integrations. Returns the integration with the <code>
        url
      </code>
      
       it posts to.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /integrations/{integrationId}
      </code>
    </td>
    
    <td>
      Get an integration with its kind, its settings and the <code>
        url
      </code>
      
       it posts to. Credentials are never returned; <code>
        credentialsSavedAt
      </code>
      
       and <code>
        credentialsSavedBy
      </code>
      
       say when they were last saved and by which member, and <code>
        credentialsSavedWithApiToken
      </code>
      
       names the API token they were saved with, by its <code>
        id
      </code>
      
       and the name it had then, or is <code>
        null
      </code>
      
       when they were saved in the dashboard or before this field existed. <code>
        credentialsSavedBy
      </code>
      
       is <code>
        null
      </code>
      
       when an organization API token saved them. A Slack integration's webhook URL is a credential, so its <code>
        url
      </code>
      
       is only <code>
        https://hooks.slack.com/services/
      </code>
      
      , and it comes with its <code>
        eventTypes
      </code>
      
      , <code>
        alertKinds
      </code>
      
       and <code>
        minimumPriority
      </code>
      
      .
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PUT
      </code>
    </td>
    
    <td>
      <code>
        /integrations/{integrationId}
      </code>
    </td>
    
    <td>
      Replace the integration's name, settings, filters, and whether it is enabled; <code>
        kind
      </code>
      
       must stay the one it was created with. Leave the credentials out of <code>
        settings
      </code>
      
       to keep the saved ones, a Slack integration's <code>
        webhookUrl
      </code>
      
       included, or send them all to replace them; an Amplitude or Mixpanel integration refuses one key without the other. Changing an analytics setting recomposes <code>
        url
      </code>
      
      . Any other field left out takes the value it takes on create, so send a Slack integration's <code>
        messagePrefix
      </code>
      
      , <code>
        postResolvedAlerts
      </code>
      
      , <code>
        eventTypes
      </code>
      
      , <code>
        alertKinds
      </code>
      
       and <code>
        minimumPriority
      </code>
      
       to keep them. Leaving out <code>
        enabled
      </code>
      
       enables the integration.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        DELETE
      </code>
    </td>
    
    <td>
      <code>
        /integrations/{integrationId}
      </code>
    </td>
    
    <td>
      Delete the integration and its deliveries.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /integrations/{integrationId}/test
      </code>
    </td>
    
    <td>
      Post a marker reading <code>
        ConfigDirector test
      </code>
      
       to the tool at the current time, or, for a Slack integration, the <a href="https://docs.configdirector.com/integrations/slack#the-test-message">
        test message
      </a>
      
      , opened by the message prefix. Returns its delivery, pending its first attempt.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GET
      </code>
    </td>
    
    <td>
      <code>
        /integrations/{integrationId}/deliveries
      </code>
    </td>
    
    <td>
      List the integration's deliveries from the last 30 days, newest first, each with its attempts, the latest response and the body posted. <code>
        status
      </code>
      
      , <code>
        limit
      </code>
      
       and <code>
        before
      </code>
      
       work as on a webhook's deliveries.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POST
      </code>
    </td>
    
    <td>
      <code>
        /integrations/{integrationId}/deliveries/{deliveryId}/resend
      </code>
    </td>
    
    <td>
      Post the delivery's body again. Returns the delivery, pending its next attempt.
    </td>
    
    <td>
      <code>
        integrations:manage
      </code>
    </td>
  </tr>
</tbody>
</table>

An analytics integration's `settings` hold the kind's non-secret fields and `endpointUrl`, `null` unless you set it, and a Slack integration's hold `messagePrefix` and `postResolvedAlerts`; the credentials are never part of a response. `disabledReason` and `enabled` work as on a webhook, and a Slack integration's `disabledReason` is `refusal` when ConfigDirector disabled it because Slack refused a message for good, such as for an archived channel.

### Alert kinds

A webhook's and a Slack integration's `alertKinds` name alert kinds by these identifiers, which are also the `kind` of an alert and of an alert webhook event. [Alerts](https://docs.configdirector.com/monitoring/alerts#alert-kinds) describes every kind.

<table>
<thead>
  <tr>
    <th>
      Identifier
    </th>
    
    <th>
      Alert kind
    </th>
    
    <th>
      Group
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        config-not-found
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#config-not-found">
        Config not found
      </a>
    </td>
    
    <td>
      Application requests
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        client-requested-server-only-config
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#client-sdk-requested-a-server-only-config">
        Client SDK requested a server-only config
      </a>
    </td>
    
    <td>
      Application requests
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        server-requested-client-only-config
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#server-sdk-requested-a-client-only-config">
        Server SDK requested a client-only config
      </a>
    </td>
    
    <td>
      Application requests
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        config-type-mismatch
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#config-type-mismatch">
        Config type mismatch
      </a>
    </td>
    
    <td>
      Application requests
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        default-value-mismatch
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#in-code-default-value-mismatch">
        In-code default value mismatch
      </a>
    </td>
    
    <td>
      Application requests
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        default-value-served-too-often
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#in-code-default-value-served-too-often">
        In-code default value served too often
      </a>
    </td>
    
    <td>
      Application requests
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        deprecated-sdk-version
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#outdated-sdk-version">
        Outdated SDK version
      </a>
    </td>
    
    <td>
      SDK versions
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sdk-cannot-evaluate-segments
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#sdk-cannot-evaluate-segments">
        SDK cannot evaluate segments
      </a>
    </td>
    
    <td>
      SDK versions
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        config-settled
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#config-settled">
        Config settled
      </a>
    </td>
    
    <td>
      Config lifecycle
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        config-archive-ready
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#config-ready-to-archive">
        Config ready to archive
      </a>
    </td>
    
    <td>
      Config lifecycle
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        experiment-split-mismatch
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#experiment-split-does-not-match-its-configured-shares">
        Experiment split does not match its configured shares
      </a>
    </td>
    
    <td>
      Experiments
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        experiment-guardrail-worse
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#experiment-guardrail-likely-worse">
        Experiment guardrail likely worse
      </a>
    </td>
    
    <td>
      Experiments
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        experiment-result-reached
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#experiment-result-reached">
        Experiment result reached
      </a>
    </td>
    
    <td>
      Experiments
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        tracked-events-daily-cap-reached
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#daily-cap-of-tracked-events-reached">
        Daily cap of tracked events reached
      </a>
    </td>
    
    <td>
      Experiments
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        spending-limit-projected
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#spend-projected-to-reach-the-spending-limit">
        Spend projected to reach the spending limit
      </a>
    </td>
    
    <td>
      Billing
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        spending-limit-reached
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#spending-limit-reached">
        Spending limit reached
      </a>
    </td>
    
    <td>
      Billing
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing-threshold-reached
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#billing-alert-threshold-reached">
        Billing alert threshold reached
      </a>
    </td>
    
    <td>
      Billing
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usage-projected-overage
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#usage-projected-to-exceed-the-free-allowance">
        Usage projected to exceed the free allowance
      </a>
    </td>
    
    <td>
      Billing
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usage-limit-exceeded
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#free-allowance-exceeded">
        Free allowance exceeded
      </a>
    </td>
    
    <td>
      Billing
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        free-allowance-service-suspended
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#service-suspended-free-allowance-exceeded">
        Service suspended: free allowance exceeded
      </a>
    </td>
    
    <td>
      Billing
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        webhook-disabled
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#webhook-disabled-after-repeated-failures">
        Webhook disabled after repeated failures
      </a>
    </td>
    
    <td>
      Integrations
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        integration-disabled
      </code>
    </td>
    
    <td>
      <a href="https://docs.configdirector.com/monitoring/alerts#integration-disabled">
        Integration disabled
      </a>
    </td>
    
    <td>
      Integrations
    </td>
  </tr>
</tbody>
</table>

## Examples

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

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

```json
{
  "name": "Laptop",
  "kind": "user",
  "organization": { "id": "0199a3c2-5b1e-7d40-9f6a-2c8e4b7d1a30", "name": "Acme" },
  "permissions": ["configs:read", "projects:read"],
  "projectAccess": { "kind": "all" },
  "expiresAt": "2027-01-15T00:00:00.000Z"
}
```

An organization API token with selected projects lists the ids of the projects it reaches:

```json
{
  "name": "Web Store CI",
  "kind": "organization",
  "organization": { "id": "0199a3c2-5b1e-7d40-9f6a-2c8e4b7d1a30", "name": "Acme" },
  "permissions": ["configs:read", "projects:read"],
  "projectAccess": { "kind": "selected", "projectIds": ["0199a3c2-6d0f-7a42-8b3e-5c9d1e2f3a40"] },
  "expiresAt": null
}
```

List the projects of the organization:

```bash
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:

```bash
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:

```bash
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](#targeting-rules-reference) and the OpenAPI document list every operator per target type, and the [Terraform provider](https://docs.configdirector.com/integrations/terraform) 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 `apiToken` when one was used; `member` is `null` when an organization API token made the change, as in the `endedBy` below), 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`.

```json
{
  "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": null, "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](#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](#metrics), a [ratio metric](#ratio-metrics) and a [funnel metric](#funnel-metrics) 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`, `retention` and `direction` (a [ratio metric](#ratio-metrics) has its `ratio`, a [funnel metric](#funnel-metrics) its `funnel`, a [retention metric](#retention-metrics) its `retention`, 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. A `retention` kind's rollout also has a `state` of its own, described below.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      What it says
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        variationId
      </code>
    </td>
    
    <td>
      The variation.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        exposures
      </code>
    </td>
    
    <td>
      The contexts counted for the variation, without its crossovers. On a <code>
        retention
      </code>
      
       kind: the variation's measured contexts, those whose last day has ended.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        analyzedExposures
      </code>
    </td>
    
    <td>
      On a <code>
        retention
      </code>
      
       kind only: the variation's exposures without its crossovers, as the other kinds give in <code>
        exposures
      </code>
      
      . The difference from <code>
        exposures
      </code>
      
       is the contexts that are not measured.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        converters
      </code>
    </td>
    
    <td>
      On a <code>
        conversion
      </code>
      
       kind: the contexts that reported the event. On a <code>
        funnel
      </code>
      
       kind: the contexts that reached the last step. On a <code>
        retention
      </code>
      
       kind: the measured contexts that came back.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        contextsThatReachedEachStep
      </code>
    </td>
    
    <td>
      On a <code>
        funnel
      </code>
      
       kind only: how many of the variation's contexts reached each step, in the order of the steps. The last number is <code>
        converters
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        numeratorTotal
      </code>
    </td>
    
    <td>
      On a <code>
        ratio
      </code>
      
       kind only: what the numerator added up over the variation's contexts.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        denominatorTotal
      </code>
    </td>
    
    <td>
      On a <code>
        ratio
      </code>
      
       kind only: what the denominator added up over the variation's contexts.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        value
      </code>
    </td>
    
    <td>
      The share of contexts that reported the event on a <code>
        conversion
      </code>
      
       kind, the share that reached the last step on a <code>
        funnel
      </code>
      
       kind, the average per context on <code>
        count-per-context
      </code>
      
       and <code>
        value-per-context
      </code>
      
      , <code>
        numeratorTotal
      </code>
      
       divided by <code>
        denominatorTotal
      </code>
      
       on a <code>
        ratio
      </code>
      
       kind, where it is absent while <code>
        denominatorTotal
      </code>
      
       is zero, and the share of the measured contexts that came back on a <code>
        retention
      </code>
      
       kind, where it is absent while the variation has no measured context.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        standardDeviation
      </code>
    </td>
    
    <td>
      On <code>
        count-per-context
      </code>
      
       and <code>
        value-per-context
      </code>
      
      : how far the numbers of single contexts spread around <code>
        value
      </code>
      
      , once the variation has two exposures. On a <code>
        ratio
      </code>
      
       kind: how far single contexts pull the ratio away from <code>
        value
      </code>
      
      , once the variation has two exposures and a <code>
        value
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        lift
      </code>
    </td>
    
    <td>
      The change against the control, as a fraction: <code>
        0.12
      </code>
      
       is 12% higher. On a <code>
        conversion
      </code>
      
      , <code>
        funnel
      </code>
      
       or <code>
        retention
      </code>
      
       kind it allows for how few contexts were counted, so it can differ a little from the change between the two <code>
        value
      </code>
      
      s. On the other kinds it is absent when the control's <code>
        value
      </code>
      
       is zero or negative.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        interval
      </code>
    </td>
    
    <td>
      <code>
        low
      </code>
      
       and <code>
        high
      </code>
      
      , the range the lift is likely in. On the kinds other than <code>
        conversion
      </code>
      
      , <code>
        funnel
      </code>
      
       and <code>
        retention
      </code>
      
       it is absent when the control's <code>
        value
      </code>
      
       is too close to zero for a range to mean anything.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        chanceToBeatControl
      </code>
    </td>
    
    <td>
      The chance, from 0 to 1, that the variation is better than the control, respecting the metric's <code>
        direction
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        chanceToBeBest
      </code>
    </td>
    
    <td>
      With three or more variations in the rollout: the chance, from 0 to 1, that the variation is the best of them.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        verdict
      </code>
    </td>
    
    <td>
      <code>
        likely-better
      </code>
      
      , <code>
        likely-worse
      </code>
      
       or <code>
        no-clear-difference
      </code>
      
       against the control. The verdict is a reading: nothing ships or stops on its own.
    </td>
  </tr>
</tbody>
</table>

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.

A variation of a retention metric for days 7 to 13 that exposed 4 contexts, 3 of them more than 14 days ago, of which 2 viewed their cart again during their days 7 to 13, reads `{ "exposures": 3, "analyzedExposures": 4, "converters": 2, "value": 0.6667 }`.

A `retention` kind compares its variations once each has enough measured contexts, however many exposures the rollout has. So each of its rollouts has a `state` of its own, `needs-more-exposures` until every variation has enough measured contexts and `ready` from then on, and its `lift`, `interval`, `chanceToBeatControl`, `chanceToBeBest`, `verdict` and `runLengthEstimate` follow that `state` in place of the rollout's.

`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.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      What it says
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        analyzedExposures
      </code>
    </td>
    
    <td>
      The rollout's exposures so far, all its variations together, without its crossovers.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        exposuresPerDay
      </code>
    </td>
    
    <td>
      How many new exposures the rollout gets a day, counted since <code>
        paceMeasuredSince
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        paceMeasuredSince
      </code>
    </td>
    
    <td>
      The end of the latest day in the primary metric's <code>
        series
      </code>
      
       that ended at least 7 days ago, or the run's start when the run, or that <code>
        series
      </code>
      
      , began less than 7 days ago.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        lifts
      </code>
    </td>
    
    <td>
      One entry per lift: the <code>
        lift
      </code>
      
      , the <code>
        exposuresNeeded
      </code>
      
      , all variations together, and <code>
        daysRemaining
      </code>
      
       at the current pace. <code>
        daysRemaining
      </code>
      
       is <code>
        0
      </code>
      
       once the rollout has enough exposures, and absent when no new contexts were exposed since <code>
        paceMeasuredSince
      </code>
      
      . For a <code>
        retention
      </code>
      
       primary, the contexts exposed and not yet measured count toward <code>
        exposuresNeeded
      </code>
      
      , <code>
        daysRemaining
      </code>
      
       includes the <code>
        lastDay + 1
      </code>
      
       days the last contexts exposed wait to be measured, and it is <code>
        0
      </code>
      
       only once enough contexts are measured. When the metric was attached while the run was open, only its measured contexts count toward <code>
        exposuresNeeded
      </code>
      
      , since the contexts exposed before then are never measured.
    </td>
  </tr>
</tbody>
</table>

A lift that would take a conversion, or a funnel's or a retention'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, reached a funnel's last step or come back for a retention metric, 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. A `retention` primary is the exception in two cases, where it is the most: a lift whose exposures are all in reads the full `lastDay + 1` days, which only the last context exposed waits, and a metric attached while the run was open leaves out the contexts already exposed that will still be measured. [How long a run needs](https://docs.configdirector.com/getting-started/experiments/how-results-are-computed#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:

```json
{
  "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:

<table>
<thead>
  <tr>
    <th>
      <code>
        counting
      </code>
    </th>
    
    <th>
      What it says
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        { "kind": "whole-run" }
      </code>
    </td>
    
    <td>
      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.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        { "kind": "since", "since": "<time>" }
      </code>
    </td>
    
    <td>
      The metric was attached while the run was open, and only the events that happened at or after <code>
        since
      </code>
      
       count.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        { "kind": "not-counted" }
      </code>
    </td>
    
    <td>
      The metric was never attached while the run was open, such as when the run ended before it was attached. The metric has no <code>
        kinds
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

Detaching a metric with a filter or a value field, a ratio metric, a funnel metric or a retention 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`. A retention metric measures only the contexts whose first day started at or after `since`, so a context that came back before the metric was attached is not read as not having come back.

`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.

```json
{
  "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:

```bash
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](https://docs.configdirector.com/integrations/webhooks#experiment-runs). 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.

```bash
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 }'
```

```json
{
  "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`, and one the token's project access does not reach is a `403` with the code `PROJECT_ACCESS_DENIED`.

### 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:

```bash
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`:

```bash
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`.


## Sitemap

See the full [sitemap](https://docs.configdirector.com/sitemap.md) for all pages.
