---
title: Create Dynamic Config
description: Create Dynamic Config
product: general
token_estimate: 4019
---
# Create Dynamic Config

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Create Dynamic Config

**POST** `/console/v1/dynamic_configs`

Full URL: `https://statsigapi.net/console/v1/dynamic_configs`

Create Dynamic Config

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| STATSIG-API-KEY | string | Yes | — | apiKey (header) |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | string | Yes | my_config | The dynamic config display name Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| isEnabled | boolean | No | true | Is the dynamic config enabled |
| description | string | No | — | Constraints: max length: 1000 |
| rules | object[] | No | — | An array of Rule objects |
| rules.name | string | Yes | — | The name of this rule. |
| rules.passPercentage | number | No | — | Of the users that meet the conditions of this rule, what percent should return true. Constraints: min: 0, max: 100 |
| rules.conditions | object[] | Yes | — | An array of Condition objects. |
| rules.conditions.targetValue | oneOf | No | — | Constraints: nullable, string[], number[], string, number |
| rules.conditions.operator | string | No | — | — |
| rules.conditions.field | string | No | — | Constraints: nullable |
| rules.conditions.customID | string | No | — | Constraints: nullable |
| rules.conditions.type | string | Yes | — | Allowed values: app_version, browser_name, browser_version, country, custom_field, email, environment_tier, fails_gate, fails_segment, ip_address, locale, os_name, os_version, passes_gate, passes_segment, public, time, unit_id, user_id, user_agent, url, javascript, device_model, target_app, experiment_group |
| rules.environments | string[] | No | — | Constraints: nullable |
| rules.id | string | No | — | The Statsig ID of this rule. |
| rules.baseID | string | No | — | The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout |
| rules.returnValue | object | No | — | — |
| rules.completedAutomatedRollouts | object[] | No | — | Read-only: Automated rollout phases that have already completed. |
| rules.completedAutomatedRollouts.time | number | No | — | — |
| rules.completedAutomatedRollouts.passPercent | number | Yes | — | — |
| rules.pendingAutomatedRollouts | object[] | No | — | Read-only: Automated rollout phases that are scheduled but not yet complete. |
| rules.pendingAutomatedRollouts.time | number | No | — | — |
| rules.pendingAutomatedRollouts.passPercent | number | Yes | — | — |
| rules.returnValueJson5 | string | No | — | — |
| rules.variants | object[] | No | — | — |
| rules.variants.id | string | No | — | — |
| rules.variants.name | string | Yes | — | — |
| rules.variants.passPercentage | number | Yes | — | Constraints: min: 0, max: 100 |
| rules.variants.returnValue | object | No | — | — |
| rules.variants.returnValueJson5 | string | No | — | — |
| defaultValue | object | No | — | The fallback JSON object when no rules are triggered |
| defaultValueJson5 | string | No | — | Can include comments. If provided with defaultValue, must parse to the same JSON |
| idType | string | No | userID | The type of ID which the dynamic config is based on. |
| tags | string[] | No | — | The list of tag names attached to the dynamic config |
| creatorID | string | No | — | Constraints: nullable |
| owner | object | No | {"ownerID":"user123","ownerType":"USER","ownerName":"John Doe","ownerEmail":"owner123@test.com"} | Schema for owner data including ID, type, name. Constraints: nullable |
| owner.ownerID | string | No | abc123 | ID of the owner |
| owner.ownerType | string | No | USER | Type of the owner (e.g., SDK_KEY or USER) |
| owner.ownerName | string | No | John Doe | The name of the owner. This field is optional. |
| owner.ownerEmail | string | No | — | The email of the owner. This field is optional. |
| creatorEmail | string | No | — | Constraints: nullable |
| schema | string | No | — | A schema using JSON Schema Draft 2020-12 to enforce return values of this dynamic config's rules. Constraints: nullable |
| schemaJson5 | string | No | — | `schema` except with Json5 comments. Optional and should parse to same json as `schema`. Constraints: nullable |
| targetApps | oneOf | No | — | Constraints: string, string[] |
| team | string | No | — | The team name associated with the dynamic config, Enterprise only. Constraints: nullable |
| teamID | string | No | — | The team ID associated with the dynamic config, Enterprise only. Constraints: nullable |
| releasePipelineID | string | No | — | The release pipeline ID associated with the dynamic config Constraints: nullable |
| id | string | No | — | The dynamic config name ID Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-.]*$ |
| isTemplate | boolean | No | — | — |

## Response (application/json)

**201** — Create Dynamic Config

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | string | Yes | — | A simple string explaining the result of the operation. |
| data | object | Yes | — | — |
| data.id | string | Yes | — | ID |
| data.name | string | No | my_config | Optional name for the configuration. Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| data.idType | string | No | userID | The type of ID which the dynamic config is based on. |
| data.description | string | Yes | helpful summary of what this dynamic config does | A brief summary of what the dynamic config is being used for Constraints: max length: 1000 |
| data.lastModifierID | string | Yes | — | ID of the last modifier. Constraints: nullable |
| data.lastModifiedTime | number | Yes | — | Time of the last modification. Constraints: format: double, nullable |
| data.lastModifierEmail | string | Yes | — | Email of the last modifier. Constraints: nullable |
| data.lastModifierName | string | Yes | — | Name of the last modifier. Constraints: nullable |
| data.creatorID | string | No | — | Constraints: nullable |
| data.createdTime | number | Yes | — | Timestamp when the entity was created. Constraints: format: double |
| data.creatorName | string | Yes | — | Name of the creator. Constraints: nullable |
| data.creatorEmail | string | No | — | Constraints: nullable |
| data.tags | string[] | No | ["a tag"] | The list of tag names attached to the dynamic config |
| data.targetApps | oneOf | No | — | Constraints: string, string[] |
| data.holdoutIDs | string[] | No | — | Holdouts applied to this configuration. |
| data.team | string | No | — | The team name associated with the dynamic config, Enterprise only. Constraints: nullable |
| data.teamID | string | No | — | The team ID associated with the dynamic config, Enterprise only. Constraints: nullable |
| data.version | number | No | — | Version number Constraints: format: double |
| data.isEnabled | boolean | Yes | true | Is the dynamic config enabled |
| data.rules | object[] | Yes | — | An array of Rule objects |
| data.rules.name | string | Yes | — | The name of this rule. |
| data.rules.passPercentage | number | Yes | — | Of the users that meet the conditions of this rule, what percent should return true. Constraints: min: 0, max: 100 |
| data.rules.conditions | object[] | Yes | — | An array of Condition objects. |
| data.rules.conditions.targetValue | oneOf | No | — | Constraints: nullable, string[], number[], string, number |
| data.rules.conditions.operator | string | No | — | — |
| data.rules.conditions.field | string | No | — | Constraints: nullable |
| data.rules.conditions.customID | string | No | — | Constraints: nullable |
| data.rules.conditions.type | string | Yes | — | Allowed values: app_version, browser_name, browser_version, country, custom_field, email, environment_tier, fails_gate, fails_segment, ip_address, locale, os_name, os_version, passes_gate, passes_segment, public, time, unit_id, user_id, user_agent, url, javascript, device_model, target_app, experiment_group |
| data.rules.environments | string[] | No | — | Constraints: nullable |
| data.rules.id | string | No | — | The Statsig ID of this rule. |
| data.rules.baseID | string | No | — | The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout |
| data.rules.returnValue | object | No | — | — |
| data.rules.completedAutomatedRollouts | object[] | No | — | Read-only: Automated rollout phases that have already completed. |
| data.rules.completedAutomatedRollouts.time | number | No | — | — |
| data.rules.completedAutomatedRollouts.passPercent | number | Yes | — | — |
| data.rules.pendingAutomatedRollouts | object[] | No | — | Read-only: Automated rollout phases that are scheduled but not yet complete. |
| data.rules.pendingAutomatedRollouts.time | number | No | — | — |
| data.rules.pendingAutomatedRollouts.passPercent | number | Yes | — | — |
| data.rules.returnValueJson5 | string | No | — | — |
| data.rules.variants | object[] | No | — | — |
| data.rules.variants.id | string | No | — | — |
| data.rules.variants.name | string | Yes | — | — |
| data.rules.variants.passPercentage | number | Yes | — | Constraints: min: 0, max: 100 |
| data.rules.variants.returnValue | object | No | — | — |
| data.rules.variants.returnValueJson5 | string | No | — | — |
| data.defaultValue | object | No | — | The fallback JSON object when no rules are triggered |
| data.defaultValueJson5 | string | No | — | Can include comments. If provided with defaultValue, must parse to the same JSON |
| data.owner | object | No | {"ownerID":"user123","ownerType":"USER","ownerName":"John Doe","ownerEmail":"owner123@test.com"} | Schema for owner data including ID, type, name. Constraints: nullable |
| data.owner.ownerID | string | No | abc123 | ID of the owner |
| data.owner.ownerType | string | No | USER | Type of the owner (e.g., SDK_KEY or USER) |
| data.owner.ownerName | string | No | John Doe | The name of the owner. This field is optional. |
| data.owner.ownerEmail | string | No | — | The email of the owner. This field is optional. |
| data.schema | string | No | — | A schema using JSON Schema Draft 2020-12 to enforce return values of this dynamic config's rules. Constraints: nullable |
| data.schemaJson5 | string | No | — | `schema` except with Json5 comments. Optional and should parse to same json as `schema`. Constraints: nullable |
| data.releasePipelineID | string | No | — | The release pipeline ID associated with the dynamic config Constraints: nullable |
| data.isTemplate | boolean | No | — | — |
| data.status | string | No | — | Allowed values: Enabled, Disabled, Archived |
| data.checksPerHour | number | No | — | Constraints: format: double, nullable |
| data.permalink | string | Yes | — | A permalink to this dynamic config in the Statsig Console. Constraints: format: uri |
| data.type | string | Yes | — | The lifecycle type of the config (TEMPORARY, PERMANENT, or STALE). STALE classification depends on the nightly stale detection batch job having run; a config not yet processed reads as TEMPORARY. Allowed values: PERMANENT, TEMPORARY, STALE, TEMPLATE |
| data.typeReason | string | Yes | — | The reason for the current type classification. Depends on the nightly stale detection batch job having run. Allowed values: NONE, STALE_PROBABLY_DEAD_CHECK, STALE_NO_RULES, STALE_PROBABLY_FORGOTTEN, STALE_PROBABLY_LAUNCHED, STALE_PROBABLY_UNLAUNCHED |
| data.isPermanent | boolean | Yes | — | Whether the config has been explicitly marked as long-lived. |

```json
{
  "message": "Dynamic Config created successfully.",
  "data": {
    "id": "a_dynamic_config",
    "permalink": "https://console.statsig.com/company_id/dynamic_configs/a_dynamic_config",
    "name": "a dynamic config",
    "description": "helpful summary of what this dynamic config does",
    "idType": "userID",
    "lastModifierID": "1vaQaBoLlkauH9iiuOSBP2",
    "lastModifiedTime": 1707344887865,
    "lastModifierName": "CONSOLE API",
    "lastModifierEmail": null,
    "creatorID": "1vaQaBoLlkauH9iiuOSBP2",
    "createdTime": 1707344887764,
    "creatorName": "CONSOLE API",
    "creatorEmail": null,
    "targetApps": [],
    "holdoutIDs": [],
    "tags": [],
    "type": "TEMPORARY",
    "typeReason": "NONE",
    "isPermanent": false,
    "isEnabled": true,
    "rules": [],
    "defaultValue": {}
  }
}
```

**400** — Invalid request. Please check the request input and try again.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 400 |
| message | string | Yes | — | — |

```json
{
  "status": 400,
  "message": "Invalid request. Please check the request input and try again."
}
```

**401** — This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 401 |
| message | string | Yes | — | — |

```json
{
  "status": 401,
  "message": "This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx"
}
```

**403** — Forbidden. The request was valid, but the server is refusing action. You might not have the necessary permissions to access the resource.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 403 |
| message | string | Yes | — | — |

```json
{
  "status": 403,
  "message": "Forbidden. The request was valid, but the server is refusing action. You might not have the necessary permissions to access the resource."
}
```

## Code samples

### cURL

```bash
curl -X POST "https://statsigapi.net/console/v1/dynamic_configs" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.post(
    "https://statsigapi.net/console/v1/dynamic_configs",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/dynamic_configs", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/dynamic_configs");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "STATSIG-API-KEY: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("POST", "https://statsigapi.net/console/v1/dynamic_configs", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("STATSIG-API-KEY", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://statsigapi.net/console/v1/dynamic_configs"))
      .method("POST", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("STATSIG-API-KEY", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://statsigapi.net/console/v1/dynamic_configs")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

