---
title: Create Gate
description: Reference for the POST /console/v1/gates API endpoint.
product: general
token_estimate: 7909
---
# Create Gate

> 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 Gate

**POST** `/console/v1/gates`

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

Create Gate

## Authorizations

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

## Query parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| includeArchiveMetadata (query) | string | No | — | When "true", populate archivedAt / archivedBy* / archiveReason on the gate when it is currently archived. When omitted or "false", those fields are absent from the response. Allowed values: true, false |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | string | No | — | The gate display name Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| isEnabled | boolean | No | — | — |
| description | string | No | — | Constraints: max length: 1000 |
| rules | object[] | No | — | — |
| rules.name | string | Yes | — | The name of this rule. |
| rules.passPercentage | number | Yes | — | 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 | — | Allowed values: any, none, any_case_sensitive, none_case_sensitive, str_contains_any, str_contains_none, gt, lt, lte, gte, version_gt, version_lt, version_gte, version_lte, version_eq, after, before, on, is_null, is_not_null, str_matches, encoded_any, array_contains_any, array_contains_none, array_contains_all, not_array_contains_all |
| 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 | — | The environments this rule is enabled for. 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 | — | The return value of the rule. |
| 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 | — | — |
| tags | string[] | No | — | — |
| type | string | No | — | Allowed values: PERMANENT, TEMPORARY |
| idType | string | No | — | — |
| targetApps | oneOf | No | — | Constraints: string, string[] |
| creatorID | string | No | — | Constraints: nullable |
| creatorEmail | string | No | — | Constraints: nullable |
| team | string | No | — | Constraints: nullable |
| teamID | string | No | — | Constraints: nullable |
| measureMetricLifts | boolean | No | — | — |
| monitoringMetrics | object[] | No | — | — |
| monitoringMetrics.name | string | Yes | — | — |
| monitoringMetrics.type | string | Yes | — | — |
| reviewSettings | object | No | — | Whether reviews are required for this gate. If a gate has reviews required due to a project-level or team-level setting, setting this will have no effect. |
| reviewSettings.requiredReview | boolean | Yes | — | — |
| releasePipelineID | string | No | — | Constraints: nullable |
| gradual_rollout_strategy | object | No | — | Optional safe-change strategy for risky gate rule increases. When required by policy, clients should retry with this field set after user confirmation. |
| gradual_rollout_strategy.type | string | Yes | — | Use "gradual" to apply a gradual rollout to risky gate rule increases, or "bypass" to explicitly apply the direct change. Allowed values: gradual, bypass |
| gradual_rollout_strategy.phases | object[] | No | — | Optional rollout phases in the same shape used by the product rollout editor. If omitted for "gradual", the server default schedule is used. |
| gradual_rollout_strategy.phases.time | number | No | — | — |
| gradual_rollout_strategy.phases.pass_percent | number | Yes | — | — |
| gradual_rollout_strategy.phases.isComplete | boolean | Yes | — | — |
| gradual_rollout_strategy.phases.timeString | string | No | — | — |
| gradual_rollout_strategy.phases.phaseDurationMs | number | No | — | Used for progressive rollouts to calculate when the next phase can start |
| id | string | No | — | The gate name ID Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-.]*$ |
| isTemplate | boolean | No | — | — |

## Response (application/json)

**201** — Create gate 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 | — | The gate display name Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| data.idType | string | No | — | — |
| data.description | string | Yes | — | 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 | — | — |
| data.targetApps | oneOf | No | — | Constraints: string, string[] |
| data.holdoutIDs | string[] | No | — | Holdouts applied to this configuration. |
| data.team | string | No | — | Constraints: nullable |
| data.teamID | string | No | — | Constraints: nullable |
| data.version | number | No | — | Version number Constraints: format: double |
| data.checksPerHour | number | Yes | — | Constraints: format: double, nullable |
| data.status | string | Yes | — | Allowed values: In Progress, Launched, Disabled, Archived |
| data.type | string | Yes | — | Allowed values: TEMPORARY, PERMANENT, STALE, TEMPLATE |
| data.typeReason | string | Yes | — | Allowed values: NONE, STALE_PROBABLY_LAUNCHED, STALE_PROBABLY_UNLAUNCHED, STALE_PROBABLY_FORGOTTEN, STALE_NO_RULES, STALE_PROBABLY_DEAD_CHECK, STALE_EMPTY_CHECKS, STALE_ALL_TRUE, STALE_ALL_FALSE |
| 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.isTemplate | boolean | No | — | — |
| data.store0100Exposures | boolean | No | — | Whether this gate stores 0/100 exposures for monitoring/analysis. |
| data.permalink | string | Yes | — | A permalink to this gate in the Statsig Console. Constraints: format: uri |
| data.archivedAt | number | No | — | Timestamp (ms) of the most recent archive event when the gate is currently archived; null otherwise. May be null for gates archived before audit logging existed. Constraints: format: double, nullable |
| data.archivedByID | string | No | — | ID of the user who archived this gate, when known and the gate is currently archived; null otherwise (e.g. automated archives have no user). Constraints: nullable |
| data.archivedByName | string | No | — | Name of the user who archived this gate, when known and the gate is currently archived; null otherwise. Constraints: nullable |
| data.archivedByEmail | string | No | — | Email of the user who archived this gate, when known and the gate is currently archived; null otherwise. Constraints: nullable |
| data.archiveReason | string | No | — | Free-text reason supplied when the gate was most recently archived; null when the gate is not currently archived or no reason was given. Constraints: nullable |
| data.isEnabled | boolean | Yes | — | — |
| data.rules | object[] | Yes | — | — |
| 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 | — | Allowed values: any, none, any_case_sensitive, none_case_sensitive, str_contains_any, str_contains_none, gt, lt, lte, gte, version_gt, version_lt, version_gte, version_lte, version_eq, after, before, on, is_null, is_not_null, str_matches, encoded_any, array_contains_any, array_contains_none, array_contains_all, not_array_contains_all |
| 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 | — | The environments this rule is enabled for. 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 | — | The return value of the rule. |
| 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.measureMetricLifts | boolean | No | — | — |
| data.monitoringMetrics | object[] | No | — | — |
| data.monitoringMetrics.name | string | Yes | — | — |
| data.monitoringMetrics.type | string | Yes | — | — |
| data.reviewSettings | object | No | — | — |
| data.reviewSettings.requiredReview | boolean | Yes | — | — |
| data.reviewSettings.allowedReviewers | object[] | No | — | Constraints: nullable |
| data.reviewSettings.allowedReviewers.id | string | Yes | — | — |
| data.reviewSettings.allowedReviewers.name | string | Yes | — | — |
| data.reviewSettings.allowedReviewers.email | string | Yes | — | — |
| data.releasePipelineID | string | No | — | Constraints: nullable |
| data.activeReview | object | No | — | — |
| data.activeReview.reviewID | string | Yes | — | — |
| data.activeReview.reviewStatus | string | Yes | — | — |
| data.activeReview.description | string | Yes | — | — |

```json
{
  "message": "Gate created successfully.",
  "data": {
    "id": "a_gate",
    "permalink": "https://console.statsig.com/company_id/gates/a_gate",
    "name": "A Gate",
    "description": "description",
    "idType": "userID",
    "lastModifierID": "1vaQaBoLlkauH9iiuOSBP2",
    "lastModifiedTime": 1704929983827,
    "lastModifierName": "CONSOLE API",
    "lastModifierEmail": null,
    "creatorID": "1vaQaBoLlkauH9iiuOSBP2",
    "createdTime": 1704929979761,
    "creatorName": "CONSOLE API",
    "creatorEmail": null,
    "targetApps": [],
    "holdoutIDs": [],
    "tags": [],
    "isEnabled": true,
    "status": "In Progress",
    "rules": [],
    "checksPerHour": 0,
    "type": "PERMANENT",
    "typeReason": "NONE",
    "team": null,
    "reviewSettings": {
      "requiredReview": false,
      "allowedReviewers": []
    },
    "measureMetricLifts": true,
    "owner": {
      "ownerID": "user123",
      "ownerName": "CONSOLE API",
      "ownerType": "SDK_KEY",
      "ownerEmail": ""
    },
    "monitoringMetrics": [],
    "version": 1
  }
}
```

## Code samples

### cURL

```bash
curl -X POST "https://statsigapi.net/console/v1/gates" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY" \
  -d '{
  "name": "a_verbose_gate",
  "isEnabled": false,
  "description": "helpful summary of what this gate does",
  "rules": [
    {
      "name": "All Conditions",
      "passPercentage": 10,
      "conditions": [
        {
          "type": "public"
        },
        {
          "type": "user_id",
          "targetValue": [
            "111",
            "222"
          ],
          "operator": "any"
        },
        {
          "type": "email",
          "targetValue": [
            "@outlook.com",
            "@gmail.com"
          ],
          "operator": "str_contains_any"
        },
        {
          "type": "custom_field",
          "targetValue": 31,
          "operator": "gt",
          "field": "age"
        },
        {
          "type": "app_version",
          "targetValue": "1.1.1",
          "operator": "version_gt"
        },
        {
          "type": "browser_name",
          "targetValue": [
            "Android",
            "Chrome"
          ],
          "operator": "any"
        },
        {
          "type": "browser_version",
          "targetValue": [
            "94.0.4606.81",
            "94.0.4606.92"
          ],
          "operator": "any"
        },
        {
          "type": "os_name",
          "targetValue": [
            "Android",
            "Windows"
          ],
          "operator": "none"
        },
        {
          "type": "os_version",
          "targetValue": "11.0.0",
          "operator": "version_lte"
        },
        {
          "type": "country",
          "targetValue": [
            "NZ",
            "US"
          ],
          "operator": "any"
        },
        {
          "type": "passes_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "fails_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "time",
          "targetValue": 1643070357193,
          "operator": "after"
        },
        {
          "type": "environment_tier",
          "targetValue": [
            "production"
          ],
          "operator": "any"
        },
        {
          "type": "passes_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "fails_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "ip_address",
          "targetValue": [
            "1.1.1.1",
            "8.8.8.8"
          ],
          "operator": "any"
        }
      ],
      "environment": null
    }
  ],
  "idType": "userID",
  "targetApps": [
    "my_app"
  ],
  "team": "team",
  "monitoringMetrics": [
    {
      "name": "dau",
      "type": "user"
    }
  ]
}'
```

### Python

```python
import requests

response = requests.post(
    "https://statsigapi.net/console/v1/gates",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    },
    json={
  "name": "a_verbose_gate",
  "isEnabled": false,
  "description": "helpful summary of what this gate does",
  "rules": [
    {
      "name": "All Conditions",
      "passPercentage": 10,
      "conditions": [
        {
          "type": "public"
        },
        {
          "type": "user_id",
          "targetValue": [
            "111",
            "222"
          ],
          "operator": "any"
        },
        {
          "type": "email",
          "targetValue": [
            "@outlook.com",
            "@gmail.com"
          ],
          "operator": "str_contains_any"
        },
        {
          "type": "custom_field",
          "targetValue": 31,
          "operator": "gt",
          "field": "age"
        },
        {
          "type": "app_version",
          "targetValue": "1.1.1",
          "operator": "version_gt"
        },
        {
          "type": "browser_name",
          "targetValue": [
            "Android",
            "Chrome"
          ],
          "operator": "any"
        },
        {
          "type": "browser_version",
          "targetValue": [
            "94.0.4606.81",
            "94.0.4606.92"
          ],
          "operator": "any"
        },
        {
          "type": "os_name",
          "targetValue": [
            "Android",
            "Windows"
          ],
          "operator": "none"
        },
        {
          "type": "os_version",
          "targetValue": "11.0.0",
          "operator": "version_lte"
        },
        {
          "type": "country",
          "targetValue": [
            "NZ",
            "US"
          ],
          "operator": "any"
        },
        {
          "type": "passes_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "fails_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "time",
          "targetValue": 1643070357193,
          "operator": "after"
        },
        {
          "type": "environment_tier",
          "targetValue": [
            "production"
          ],
          "operator": "any"
        },
        {
          "type": "passes_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "fails_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "ip_address",
          "targetValue": [
            "1.1.1.1",
            "8.8.8.8"
          ],
          "operator": "any"
        }
      ],
      "environment": null
    }
  ],
  "idType": "userID",
  "targetApps": [
    "my_app"
  ],
  "team": "team",
  "monitoringMetrics": [
    {
      "name": "dau",
      "type": "user"
    }
  ]
}
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/gates", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  },
  body: JSON.stringify({
  "name": "a_verbose_gate",
  "isEnabled": false,
  "description": "helpful summary of what this gate does",
  "rules": [
    {
      "name": "All Conditions",
      "passPercentage": 10,
      "conditions": [
        {
          "type": "public"
        },
        {
          "type": "user_id",
          "targetValue": [
            "111",
            "222"
          ],
          "operator": "any"
        },
        {
          "type": "email",
          "targetValue": [
            "@outlook.com",
            "@gmail.com"
          ],
          "operator": "str_contains_any"
        },
        {
          "type": "custom_field",
          "targetValue": 31,
          "operator": "gt",
          "field": "age"
        },
        {
          "type": "app_version",
          "targetValue": "1.1.1",
          "operator": "version_gt"
        },
        {
          "type": "browser_name",
          "targetValue": [
            "Android",
            "Chrome"
          ],
          "operator": "any"
        },
        {
          "type": "browser_version",
          "targetValue": [
            "94.0.4606.81",
            "94.0.4606.92"
          ],
          "operator": "any"
        },
        {
          "type": "os_name",
          "targetValue": [
            "Android",
            "Windows"
          ],
          "operator": "none"
        },
        {
          "type": "os_version",
          "targetValue": "11.0.0",
          "operator": "version_lte"
        },
        {
          "type": "country",
          "targetValue": [
            "NZ",
            "US"
          ],
          "operator": "any"
        },
        {
          "type": "passes_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "fails_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "time",
          "targetValue": 1643070357193,
          "operator": "after"
        },
        {
          "type": "environment_tier",
          "targetValue": [
            "production"
          ],
          "operator": "any"
        },
        {
          "type": "passes_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "fails_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "ip_address",
          "targetValue": [
            "1.1.1.1",
            "8.8.8.8"
          ],
          "operator": "any"
        }
      ],
      "environment": null
    }
  ],
  "idType": "userID",
  "targetApps": [
    "my_app"
  ],
  "team": "team",
  "monitoringMetrics": [
    {
      "name": "dau",
      "type": "user"
    }
  ]
})
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/gates");
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);
$body = json_encode({
  "name": "a_verbose_gate",
  "isEnabled": false,
  "description": "helpful summary of what this gate does",
  "rules": [
    {
      "name": "All Conditions",
      "passPercentage": 10,
      "conditions": [
        {
          "type": "public"
        },
        {
          "type": "user_id",
          "targetValue": [
            "111",
            "222"
          ],
          "operator": "any"
        },
        {
          "type": "email",
          "targetValue": [
            "@outlook.com",
            "@gmail.com"
          ],
          "operator": "str_contains_any"
        },
        {
          "type": "custom_field",
          "targetValue": 31,
          "operator": "gt",
          "field": "age"
        },
        {
          "type": "app_version",
          "targetValue": "1.1.1",
          "operator": "version_gt"
        },
        {
          "type": "browser_name",
          "targetValue": [
            "Android",
            "Chrome"
          ],
          "operator": "any"
        },
        {
          "type": "browser_version",
          "targetValue": [
            "94.0.4606.81",
            "94.0.4606.92"
          ],
          "operator": "any"
        },
        {
          "type": "os_name",
          "targetValue": [
            "Android",
            "Windows"
          ],
          "operator": "none"
        },
        {
          "type": "os_version",
          "targetValue": "11.0.0",
          "operator": "version_lte"
        },
        {
          "type": "country",
          "targetValue": [
            "NZ",
            "US"
          ],
          "operator": "any"
        },
        {
          "type": "passes_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "fails_gate",
          "targetValue": "my_gate_2"
        },
        {
          "type": "time",
          "targetValue": 1643070357193,
          "operator": "after"
        },
        {
          "type": "environment_tier",
          "targetValue": [
            "production"
          ],
          "operator": "any"
        },
        {
          "type": "passes_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "fails_segment",
          "targetValue": "growth_org"
        },
        {
          "type": "ip_address",
          "targetValue": [
            "1.1.1.1",
            "8.8.8.8"
          ],
          "operator": "any"
        }
      ],
      "environment": null
    }
  ],
  "idType": "userID",
  "targetApps": [
    "my_app"
  ],
  "team": "team",
  "monitoringMetrics": [
    {
      "name": "dau",
      "type": "user"
    }
  ]
});
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
body := []byte("{\"name\":\"a_verbose_gate\",\"isEnabled\":false,\"description\":\"helpful summary of what this gate does\",\"rules\":[{\"name\":\"All Conditions\",\"passPercentage\":10,\"conditions\":[{\"type\":\"public\"},{\"type\":\"user_id\",\"targetValue\":[\"111\",\"222\"],\"operator\":\"any\"},{\"type\":\"email\",\"targetValue\":[\"@outlook.com\",\"@gmail.com\"],\"operator\":\"str_contains_any\"},{\"type\":\"custom_field\",\"targetValue\":31,\"operator\":\"gt\",\"field\":\"age\"},{\"type\":\"app_version\",\"targetValue\":\"1.1.1\",\"operator\":\"version_gt\"},{\"type\":\"browser_name\",\"targetValue\":[\"Android\",\"Chrome\"],\"operator\":\"any\"},{\"type\":\"browser_version\",\"targetValue\":[\"94.0.4606.81\",\"94.0.4606.92\"],\"operator\":\"any\"},{\"type\":\"os_name\",\"targetValue\":[\"Android\",\"Windows\"],\"operator\":\"none\"},{\"type\":\"os_version\",\"targetValue\":\"11.0.0\",\"operator\":\"version_lte\"},{\"type\":\"country\",\"targetValue\":[\"NZ\",\"US\"],\"operator\":\"any\"},{\"type\":\"passes_gate\",\"targetValue\":\"my_gate_2\"},{\"type\":\"fails_gate\",\"targetValue\":\"my_gate_2\"},{\"type\":\"time\",\"targetValue\":1643070357193,\"operator\":\"after\"},{\"type\":\"environment_tier\",\"targetValue\":[\"production\"],\"operator\":\"any\"},{\"type\":\"passes_segment\",\"targetValue\":\"growth_org\"},{\"type\":\"fails_segment\",\"targetValue\":\"growth_org\"},{\"type\":\"ip_address\",\"targetValue\":[\"1.1.1.1\",\"8.8.8.8\"],\"operator\":\"any\"}],\"environment\":null}],\"idType\":\"userID\",\"targetApps\":[\"my_app\"],\"team\":\"team\",\"monitoringMetrics\":[{\"name\":\"dau\",\"type\":\"user\"}]}")
req, _ := http.NewRequest("POST", "https://statsigapi.net/console/v1/gates", bytes.NewReader(body))
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/gates"))
      .method("POST", HttpRequest.BodyPublishers.ofString("{\"name\":\"a_verbose_gate\",\"isEnabled\":false,\"description\":\"helpful summary of what this gate does\",\"rules\":[{\"name\":\"All Conditions\",\"passPercentage\":10,\"conditions\":[{\"type\":\"public\"},{\"type\":\"user_id\",\"targetValue\":[\"111\",\"222\"],\"operator\":\"any\"},{\"type\":\"email\",\"targetValue\":[\"@outlook.com\",\"@gmail.com\"],\"operator\":\"str_contains_any\"},{\"type\":\"custom_field\",\"targetValue\":31,\"operator\":\"gt\",\"field\":\"age\"},{\"type\":\"app_version\",\"targetValue\":\"1.1.1\",\"operator\":\"version_gt\"},{\"type\":\"browser_name\",\"targetValue\":[\"Android\",\"Chrome\"],\"operator\":\"any\"},{\"type\":\"browser_version\",\"targetValue\":[\"94.0.4606.81\",\"94.0.4606.92\"],\"operator\":\"any\"},{\"type\":\"os_name\",\"targetValue\":[\"Android\",\"Windows\"],\"operator\":\"none\"},{\"type\":\"os_version\",\"targetValue\":\"11.0.0\",\"operator\":\"version_lte\"},{\"type\":\"country\",\"targetValue\":[\"NZ\",\"US\"],\"operator\":\"any\"},{\"type\":\"passes_gate\",\"targetValue\":\"my_gate_2\"},{\"type\":\"fails_gate\",\"targetValue\":\"my_gate_2\"},{\"type\":\"time\",\"targetValue\":1643070357193,\"operator\":\"after\"},{\"type\":\"environment_tier\",\"targetValue\":[\"production\"],\"operator\":\"any\"},{\"type\":\"passes_segment\",\"targetValue\":\"growth_org\"},{\"type\":\"fails_segment\",\"targetValue\":\"growth_org\"},{\"type\":\"ip_address\",\"targetValue\":[\"1.1.1.1\",\"8.8.8.8\"],\"operator\":\"any\"}],\"environment\":null}],\"idType\":\"userID\",\"targetApps\":[\"my_app\"],\"team\":\"team\",\"monitoringMetrics\":[{\"name\":\"dau\",\"type\":\"user\"}]}"))
.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/gates")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
request.body = "{\"name\":\"a_verbose_gate\",\"isEnabled\":false,\"description\":\"helpful summary of what this gate does\",\"rules\":[{\"name\":\"All Conditions\",\"passPercentage\":10,\"conditions\":[{\"type\":\"public\"},{\"type\":\"user_id\",\"targetValue\":[\"111\",\"222\"],\"operator\":\"any\"},{\"type\":\"email\",\"targetValue\":[\"@outlook.com\",\"@gmail.com\"],\"operator\":\"str_contains_any\"},{\"type\":\"custom_field\",\"targetValue\":31,\"operator\":\"gt\",\"field\":\"age\"},{\"type\":\"app_version\",\"targetValue\":\"1.1.1\",\"operator\":\"version_gt\"},{\"type\":\"browser_name\",\"targetValue\":[\"Android\",\"Chrome\"],\"operator\":\"any\"},{\"type\":\"browser_version\",\"targetValue\":[\"94.0.4606.81\",\"94.0.4606.92\"],\"operator\":\"any\"},{\"type\":\"os_name\",\"targetValue\":[\"Android\",\"Windows\"],\"operator\":\"none\"},{\"type\":\"os_version\",\"targetValue\":\"11.0.0\",\"operator\":\"version_lte\"},{\"type\":\"country\",\"targetValue\":[\"NZ\",\"US\"],\"operator\":\"any\"},{\"type\":\"passes_gate\",\"targetValue\":\"my_gate_2\"},{\"type\":\"fails_gate\",\"targetValue\":\"my_gate_2\"},{\"type\":\"time\",\"targetValue\":1643070357193,\"operator\":\"after\"},{\"type\":\"environment_tier\",\"targetValue\":[\"production\"],\"operator\":\"any\"},{\"type\":\"passes_segment\",\"targetValue\":\"growth_org\"},{\"type\":\"fails_segment\",\"targetValue\":\"growth_org\"},{\"type\":\"ip_address\",\"targetValue\":[\"1.1.1.1\",\"8.8.8.8\"],\"operator\":\"any\"}],\"environment\":null}],\"idType\":\"userID\",\"targetApps\":[\"my_app\"],\"team\":\"team\",\"monitoringMetrics\":[{\"name\":\"dau\",\"type\":\"user\"}]}"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

