---
title: Create a Layer
description: Reference for the POST /console/v1/layers API endpoint.
product: general
token_estimate: 2292
---
# Create a Layer

> 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 a Layer

**POST** `/console/v1/layers`

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

Create a Layer

## Authorizations

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

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | string | Yes | — | The unique name of the layer, formatted as an ID (e.g., "A Layer" becomes "a_layer"). Constraints: min length: 3, max length: 100, pattern: ^[A-Za-z0-9_ -]*$ |
| description | string | No | — | A helpful description of what this layer does, providing context for its purpose. Constraints: max length: 1000 |
| idType | string | Yes | — | The type of ID used for this layer, essential for validation in services. |
| targetApps | oneOf | No | — | List of target applications that this layer is associated with. Constraints: string, string[] |
| team | string | No | — | Optional identifier for the team responsible for this layer. |

## Response (application/json)

**201** — Create Layer Response

| 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 | — | Optional name for the configuration. |
| data.idType | string | Yes | — | The ID type used for this layer, important for validation. |
| data.description | string | Yes | — | A detailed description of the layer, explaining its purpose and functionality. 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 | Yes | — | ID of the user who created the entity. 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 | Yes | — | Email of the creator. Constraints: nullable |
| data.tags | string[] | No | — | Optional tags for categorization. |
| data.targetApps | oneOf | No | — | List of target applications that this layer is intended for. Constraints: string, string[] |
| data.holdoutIDs | string[] | No | — | Holdouts applied to this configuration. |
| data.team | string | No | — | Optional name for the responsible team. Constraints: nullable |
| data.teamID | string | No | — | Optional ID of the responsible team. Constraints: nullable |
| data.version | number | No | — | Version number Constraints: format: double |
| data.isImplicitLayer | boolean | Yes | — | Indicates if the layer was automatically created by Statsig during experiment creation. |
| data.parameters | object[] | Yes | — | An array of parameters associated with the layer, each defining specific attributes. |
| data.parameters.name | string | Yes | — | The name of this parameter, used for identification within the layer. |
| data.parameters.type | string | Yes | — | The data type that this parameter returns. Allowed types include: string, boolean, number, object, and array. Allowed values: string, number, boolean, object, array |
| data.parameters.defaultValue | oneOf | Yes | — | The default value for this parameter, which must match the specified type. Constraints: string, number, boolean, object, oneOf[] |
| data.parameters.description | string | No | — | An optional helpful description of what this layer parameter does, providing context for its purpose. |
| data.parameters.schema | string | No | — | Optional JSON schema for object parameters. If provided, defaultValue must satisfy the schema. Constraints: nullable |
| data.targeting_gate_parameter_values | object[] | Yes | — | Parameter values returned when a targeting gate passes during ship-with-targeting. |
| data.targeting_gate_parameter_values.targetingGateName | string | Yes | — | The name of the targeting gate for these shipped values. |
| data.targeting_gate_parameter_values.parameters | object | Yes | — | Layer parameter values returned when the targeting gate passes. |
| data.holdout_parameter_values | object[] | Yes | — | Holdout-specific parameter values for this layer. |
| data.holdout_parameter_values.holdoutID | string | Yes | — | The ID of the holdout for these layer parameter values. |
| data.holdout_parameter_values.parameters | object | Yes | — | Layer parameter values returned when the holdout gate passes. |
| data.holdout_parameter_values.excludeNewParams | boolean | Yes | — | Whether newly added layer parameters should be excluded from this holdout edge. |
| data.permalink | string | Yes | — | A permalink to this layer in the Statsig Console. Constraints: format: uri |

```json
{
  "message": "Layer created successfully.",
  "data": {
    "id": "the_best_layer",
    "description": "helpful summary of what this layer does",
    "idType": "userID",
    "lastModifierID": "4dcQUIpS8PHObBGD7HJwOx",
    "lastModifiedTime": 1720733945538,
    "lastModifierName": "CONSOLE API",
    "lastModifierEmail": null,
    "creatorID": "4dcQUIpS8PHObBGD7HJwOx",
    "createdTime": 1720733942515,
    "creatorName": "CONSOLE API",
    "creatorEmail": null,
    "targetApps": [
      "Android"
    ],
    "holdoutIDs": [
      "global_holdout",
      "test_holdout"
    ],
    "tags": [],
    "team": "Console Team",
    "isImplicitLayer": false,
    "parameters": [],
    "targeting_gate_parameter_values": [],
    "holdout_parameter_values": [],
    "permalink": "https://console.statsig.com/company_id/layers/the_best_layer"
  }
}
```

**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"
}
```

## Code samples

### cURL

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

### Python

```python
import requests

response = requests.post(
    "https://statsigapi.net/console/v1/layers",
    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/layers", {
  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/layers");
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/layers", 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/layers"))
      .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/layers")
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
```

