> ## Documentation Index
> Fetch the complete documentation index at: https://statsig-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Gate



## OpenAPI

````yaml api-reference/statsig_openapi.json post /console/v1/gates
openapi: 3.0.0
info:
  title: Console API
  description: >-
    The "Console API" is the CRUD API for performing the actions offered on
    console.statsig.com without needing to go through the web UI.

    If you have any feature requests, drop on in to our [slack
    channel](https://www.statsig.com/slack) and let us know.

    <br /><br />

    <b>Authorization</b>

    <br />

    All requests must include the **STATSIG-API-KEY** field in the header. The
    value should be a **Console API Key** which can be created in the Project
    Settings on
    [console.statsig.com/api_keys](https://console.statsig.com/api_keys)

    <br /><br />

    <b>Rate Limiting</b>

    <br />

    Requests to the Console API are limited to <code>~ 100reqs / 10secs and ~
    900reqs / 15 mins</code>.

    <br /><br />

    <b>Keyboard Search</b>

    <br />

    Use <code>Ctrl/Cmd + K</code> to search for specific endpoints.
  version: 20240601.0.0
  contact: {}
servers:
  - url: https://statsigapi.net
security: []
tags: []
paths:
  /console/v1/gates:
    post:
      tags:
        - Gates
      summary: Create Gate
      parameters:
        - name: x-respect-review-settings
          in: header
          description: Optional header to respect review settings for mutation endpoints.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GateCreateDto'
      responses:
        '200':
          description: Create gate response
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SingleDataResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/ExternalGateDto'
                example:
                  message: Gate created successfully.
                  data:
                    id: 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
              example:
                message: Gate created successfully.
                data:
                  id: 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
      security:
        - STATSIG-API-KEY: []
components:
  schemas:
    GateCreateDto:
      type: object
      properties:
        isEnabled:
          type: boolean
        description:
          type: string
          maxLength: 1000
        rules:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: The name of this rule.
              passPercentage:
                type: number
                minimum: 0
                maximum: 100
                multipleOf: 0.01
                description: >-
                  Of the users that meet the conditions of this rule, what
                  percent should return true.
              conditions:
                type: array
                items:
                  type: object
                  properties:
                    targetValue:
                      oneOf:
                        - type: array
                          items:
                            type: string
                        - type: array
                          items:
                            type: number
                        - type: string
                        - type: number
                      nullable: true
                    operator:
                      type: string
                    field:
                      type: string
                      nullable: true
                    customID:
                      type: string
                      nullable: true
                    type:
                      type: string
                      enum:
                        - 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
                        - url
                        - javascript
                        - device_model
                        - target_app
                  required:
                    - type
                description: An array of Condition objects.
              environments:
                type: array
                items:
                  type: string
                nullable: true
                description: The environments this rule is enabled for.
              id:
                type: string
                description: The Statsig ID of this rule.
              baseID:
                type: string
                description: >-
                  The base ID of this rule, i.e. without any added metadata.
                  Will remain the exact same throughout
              returnValue:
                type: object
                additionalProperties: {}
                description: The return value of the rule.
            required:
              - name
              - passPercentage
              - conditions
        tags:
          type: array
          items:
            type: string
        type:
          type: string
          enum:
            - PERMANENT
            - TEMPORARY
        idType:
          type: string
        targetApps:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        creatorID:
          type: string
          nullable: true
        creatorEmail:
          type: string
          nullable: true
        team:
          type: string
          nullable: true
        teamID:
          type: string
          nullable: true
        measureMetricLifts:
          type: boolean
        monitoringMetrics:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
            required:
              - name
              - type
        reviewSettings:
          type: object
          properties:
            requiredReview:
              type: boolean
          required:
            - requiredReview
          description: >-
            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.
        precommitWebhook:
          type: object
          properties:
            url:
              type: string
            internalStatusUrl:
              type: string
          required:
            - url
            - internalStatusUrl
          nullable: true
        name:
          type: string
          maxLength: 100
          minLength: 3
          pattern: ^[a-zA-Z0-9_\-. ]*$
        id:
          type: string
          maxLength: 100
          minLength: 3
          pattern: ^[a-zA-Z0-9_\-.]*$
      description: Create a new gate
      example:
        name: a_verbose_gate
        idType: userID
        isEnabled: false
        description: helpful summary of what this gate does
        lastModifierName: CONSOLE API
        lastModifierID: 5rfuqoxLIYTscuSaaCOlB8
        targetApps:
          - my_app
        team: team
        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
        checksPerHour: 0
        tags: []
        monitoringMetrics:
          - name: dau
            type: user
    SingleDataResponse:
      type: object
      properties:
        message:
          type: string
          description: A simple string explaining the result of the operation.
        data:
          type: object
          description: A single result.
      required:
        - message
        - data
    ExternalGateDto:
      type: object
      properties:
        id:
          type: string
          description: ID
        name:
          type: string
          description: Optional name for the configuration.
        idType:
          type: string
        description:
          type: string
          maxLength: 1000
        lastModifierID:
          type: string
          nullable: true
          description: ID of the last modifier.
        lastModifiedTime:
          type: number
          nullable: true
          description: Time of the last modification.
        lastModifierEmail:
          type: string
          nullable: true
          description: Email of the last modifier.
        lastModifierName:
          type: string
          nullable: true
          description: Name of the last modifier.
        creatorID:
          type: string
          nullable: true
        createdTime:
          type: number
          description: Timestamp when the entity was created.
        creatorName:
          type: string
          nullable: true
          description: Name of the creator.
        creatorEmail:
          type: string
          nullable: true
        tags:
          type: array
          items:
            type: string
        targetApps:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        holdoutIDs:
          type: array
          items:
            type: string
          description: Holdouts applied to this configuration.
        team:
          type: string
          nullable: true
        teamID:
          type: string
          nullable: true
        version:
          type: number
          description: Version number
        checksPerHour:
          type: number
          nullable: true
        status:
          type: string
          enum:
            - In Progress
            - Launched
            - Disabled
            - Archived
        type:
          type: string
          enum:
            - TEMPORARY
            - PERMANENT
            - STALE
            - TEMPLATE
        typeReason:
          type: string
          enum:
            - 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
        owner:
          type: object
          properties:
            ownerID:
              type: string
              description: ID of the owner
              example: abc123
            ownerType:
              type: string
              description: Type of the owner (e.g., SDK_KEY or USER)
              example: USER
            ownerName:
              type: string
              description: The name of the owner. This field is optional.
              example: John Doe
            ownerEmail:
              type: string
              description: The email of the owner. This field is optional.
          description: >-
            Schema for owner data including ID, type, name. Note that if Entity
            is created by CONSOLE API, owner will be undefined.
          example:
            ownerID: user123
            ownerType: USER
            ownerName: John Doe
            ownerEmail: owner123@test.com
          nullable: true
        isEnabled:
          type: boolean
        rules:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: The name of this rule.
              passPercentage:
                type: number
                minimum: 0
                maximum: 100
                multipleOf: 0.01
                description: >-
                  Of the users that meet the conditions of this rule, what
                  percent should return true.
              conditions:
                type: array
                items:
                  type: object
                  properties:
                    targetValue:
                      oneOf:
                        - type: array
                          items:
                            type: string
                        - type: array
                          items:
                            type: number
                        - type: string
                        - type: number
                      nullable: true
                    operator:
                      type: string
                    field:
                      type: string
                      nullable: true
                    customID:
                      type: string
                      nullable: true
                    type:
                      type: string
                      enum:
                        - 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
                        - url
                        - javascript
                        - device_model
                        - target_app
                  required:
                    - type
                description: An array of Condition objects.
              environments:
                type: array
                items:
                  type: string
                nullable: true
                description: The environments this rule is enabled for.
              id:
                type: string
                description: The Statsig ID of this rule.
              baseID:
                type: string
                description: >-
                  The base ID of this rule, i.e. without any added metadata.
                  Will remain the exact same throughout
              returnValue:
                type: object
                additionalProperties: {}
                description: The return value of the rule.
            required:
              - name
              - passPercentage
              - conditions
        measureMetricLifts:
          type: boolean
        monitoringMetrics:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
            required:
              - name
              - type
        reviewSettings:
          type: object
          properties:
            requiredReview:
              type: boolean
            allowedReviewers:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  email:
                    type: string
                required:
                  - id
                  - name
                  - email
              nullable: true
          required:
            - requiredReview
        precommitWebhook:
          type: object
          properties:
            url:
              type: string
            internalStatusUrl:
              type: string
          required:
            - url
            - internalStatusUrl
          nullable: true
        activeReview:
          type: object
          properties:
            reviewID:
              type: string
            reviewStatus:
              type: string
            description:
              type: string
          required:
            - reviewID
            - reviewStatus
            - description
      required:
        - id
        - description
        - lastModifierID
        - lastModifiedTime
        - lastModifierEmail
        - lastModifierName
        - createdTime
        - creatorName
        - checksPerHour
        - status
        - type
        - typeReason
        - isEnabled
        - rules
  securitySchemes:
    STATSIG-API-KEY:
      type: apiKey
      name: STATSIG-API-KEY
      in: header

````