DevCycle Variables API

The Variables API from DevCycle — 3 operation(s) for variables.

OpenAPI Specification

devcycle-variables-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: DevCycle Bucketing Audiences Variables API
  description: Documents the DevCycle Bucketing API which provides an API interface to User Bucketing and for Server SDKs configured to use Cloud Bucketing.
  version: 1.3.0
servers:
- url: https://bucketing-api.devcycle.com/
tags:
- name: Variables
paths:
  /v1/projects/{project}/variables:
    post:
      operationId: VariablesController_create
      summary: Create a Variable
      parameters:
      - name: project
        required: true
        in: path
        description: A Project key or ID
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVariableDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variable'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorResponse'
        '401':
          description: ''
        '403':
          description: ''
        '404':
          description: ''
        '409':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictErrorResponse'
      tags:
      - Variables
    get:
      operationId: VariablesController_findAll
      summary: List Variables
      parameters:
      - name: page
        required: false
        in: query
        schema:
          minimum: 1
          default: 1
          type: number
      - name: perPage
        required: false
        in: query
        schema:
          minimum: 1
          maximum: 1000
          default: 100
          type: number
      - name: sortBy
        required: false
        in: query
        schema:
          default: createdAt
          enum:
          - createdAt
          - updatedAt
          - name
          - key
          - propertyKey
          type: string
      - name: sortOrder
        required: false
        in: query
        schema:
          default: desc
          enum:
          - asc
          - desc
          type: string
      - name: search
        required: false
        in: query
        schema:
          minLength: 3
          type: string
      - name: feature
        required: false
        in: query
        schema:
          type: string
      - name: type
        required: false
        in: query
        schema:
          enum:
          - String
          - Boolean
          - Number
          - JSON
          type: string
      - name: status
        required: false
        in: query
        schema:
          enum:
          - active
          - archived
          type: string
      - name: project
        required: true
        in: path
        description: A Project key or ID
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Variable'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorResponse'
        '401':
          description: ''
        '403':
          description: ''
        '404':
          description: ''
      tags:
      - Variables
  /v1/projects/{project}/variables/{key}:
    get:
      operationId: VariablesController_findOne
      summary: Get a Variable
      parameters:
      - name: key
        required: true
        in: path
        description: A Variable key or ID
        schema:
          type: string
      - name: project
        required: true
        in: path
        description: A Project key or ID
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variable'
        '401':
          description: ''
        '403':
          description: ''
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
      tags:
      - Variables
    patch:
      operationId: VariablesController_update
      summary: Update a Variable
      parameters:
      - name: key
        required: true
        in: path
        description: A Variable key or ID
        schema:
          type: string
      - name: project
        required: true
        in: path
        description: A Project key or ID
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateVariableDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variable'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorResponse'
        '401':
          description: ''
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
        '409':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictErrorResponse'
      tags:
      - Variables
    delete:
      operationId: VariablesController_remove
      summary: Delete a Variable
      parameters:
      - name: key
        required: true
        in: path
        description: A Variable key or ID
        schema:
          type: string
      - name: project
        required: true
        in: path
        description: A Project key or ID
        schema:
          type: string
      responses:
        '200':
          description: ''
        '401':
          description: ''
        '403':
          description: ''
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
        '412':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreconditionFailedErrorResponse'
      tags:
      - Variables
  /v1/projects/{project}/variables/{key}/status:
    patch:
      operationId: VariablesController_updateStatus
      summary: Update a Variable status to archived or active
      parameters:
      - name: key
        required: true
        in: path
        description: A Variable key or ID
        schema:
          type: string
      - name: project
        required: true
        in: path
        description: A Project key or ID
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateVariableStatusDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variable'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorResponse'
        '401':
          description: ''
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
        '412':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreconditionFailedErrorResponse'
      tags:
      - Variables
components:
  schemas:
    PreconditionFailedErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: Response status code
          example: 412
        message:
          type: object
          description: Error details
          example: Variable does not belong to Feature
        error:
          type: string
          description: Error type
          example: Precondition Failed
      required:
      - statusCode
      - message
      - error
    VariableValidationEntity:
      type: object
      properties:
        schemaType:
          type: object
        enumValues:
          type: object
        regexPattern:
          type: string
        jsonSchema:
          type: string
        description:
          type: string
        exampleValue:
          type: object
      required:
      - schemaType
      - description
      - exampleValue
    Variable:
      type: object
      properties:
        name:
          type: string
          description: Variable name
          example: Show New Dashboard
          maxLength: 100
          minLength: 1
        description:
          type: string
          description: A description of the Variable
          example: A boolean variable that will toggle the new dashboard feature
          maxLength: 1000
        key:
          type: string
          description: 'Unique Variable identifier, can be used in the SDK / API to reference by key rather then ID.

            Must only contain lower-case characters and `_`, `-` or `.`.'
          example: show-new-dashboard
          minLength: 1
          maxLength: 100
          pattern: ^[a-z0-9-_.]+$
        _id:
          type: string
          description: A unique Variable ID
          example: 61450f3daec96f5cf4a49946
        _project:
          type: string
          description: The ID of the Project this Variable belongs to
        _feature:
          type: string
          description: The ID of the Feature this Variable belongs to
          example: 61450f3daec96f5cf4a49947
        type:
          description: The type of Variable. Must be one of [String | Boolean | Number | JSON]
          example: Boolean
          enum:
          - String
          - Boolean
          - Number
          - JSON
          type: string
        status:
          description: The status of a Variable. Must be one of [active | archived]
          example: active
          enum:
          - active
          - archived
          type: string
        source:
          description: The system that was used for the creation of the Variable.
          example: api
          enum:
          - api
          - dashboard
          - importer
          - github.code_usages
          - github.pr_insights
          - gitlab.code_usages
          - gitlab.pr_insights
          - bitbucket.code_usages
          - bitbucket.pr_insights
          - terraform
          - cli
          - slack
          - mcp
          type: string
        _createdBy:
          type: string
          description: ID of the User who created the Variable.
        createdAt:
          format: date-time
          type: string
          description: The date the Variable was created
        updatedAt:
          format: date-time
          type: string
          description: The date the Variable was last updated
        validationSchema:
          description: Validation schema for variable values
          allOf:
          - $ref: '#/components/schemas/VariableValidationEntity'
        persistent:
          type: boolean
          description: Boolean indicating if the variable is intended to be long-lived within a feature
        tags:
          description: Tags to organize Variables on the dashboard
          example:
          - Dashboard
          - QA
          type: array
          items:
            type: string
      required:
      - key
      - _id
      - _project
      - type
      - status
      - source
      - createdAt
      - updatedAt
    CreateVariableDto:
      type: object
      properties:
        name:
          type: string
          description: Variable name
          example: Show New Dashboard
          maxLength: 100
          minLength: 1
        description:
          type: string
          description: A description of the Variable
          example: A boolean variable that will toggle the new dashboard feature
          maxLength: 1000
        key:
          type: string
          description: 'Unique Variable identifier, can be used in the SDK / API to reference by key rather then ID.

            Must only contain lower-case characters and `_`, `-` or `.`.'
          example: show-new-dashboard
          minLength: 1
          maxLength: 100
          pattern: ^[a-z0-9-_.]+$
        _feature:
          type: string
          description: The ID of the Feature this Variable belongs to
          example: 61450f3daec96f5cf4a49947
        type:
          type: string
          description: The type of Variable. Must be one of [String | Boolean | Number | JSON]
          example: Boolean
          enum:
          - String
          - Boolean
          - Number
          - JSON
        validationSchema:
          description: Validation schema for variable values
          allOf:
          - $ref: '#/components/schemas/VariableValidationEntity'
        tags:
          description: Feature tags.
          example:
          - new
          - dashboard
          type: array
          items:
            type: string
      required:
      - key
      - type
    BadRequestErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: Response status code
          example: 400
        message:
          type: object
          description: Error details
          example:
          - key should not be empty
        error:
          type: string
          description: Error type
          example: Bad Request
      required:
      - statusCode
      - message
      - error
    ConflictErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: Response status code
          example: 409
        message:
          type: object
          description: Error details
          example: Duplicate key 'key-123'
        error:
          type: string
          description: Error type
          example: Conflict
        errorType:
          type: string
          example: ERR_DUPE_FEATURE_KEY
      required:
      - statusCode
      - message
      - error
      - errorType
    NotFoundErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: Response status code
          example: 404
        message:
          type: object
          description: Error details
          example: Item with key 'key-123' not found
        error:
          type: string
          description: Error type
          example: Not Found
      required:
      - statusCode
      - message
      - error
    UpdateVariableDto:
      type: object
      properties:
        name:
          type: string
          description: Variable name
          example: Show New Dashboard
          maxLength: 100
          minLength: 1
        description:
          type: string
          description: A description of the Variable
          example: A boolean variable that will toggle the new dashboard feature
          maxLength: 1000
        key:
          type: string
          description: 'Unique Variable identifier, can be used in the SDK / API to reference by key rather then ID.

            Must only contain lower-case characters and `_`, `-` or `.`.'
          example: show-new-dashboard
          minLength: 1
          maxLength: 100
          pattern: ^[a-z0-9-_.]+$
        type:
          description: The type of Variable. Must be one of [String | Boolean | Number | JSON]
          example: Boolean
          enum:
          - String
          - Boolean
          - Number
          - JSON
          type: string
        validationSchema:
          description: Validation schema for variable values
          allOf:
          - $ref: '#/components/schemas/VariableValidationEntity'
        persistent:
          type: boolean
          description: Boolean indicating if the variable is intended to be long-lived within a feature
        tags:
          description: Tags to organize Variables on the dashboard
          example:
          - Dashboard
          - QA
          type: array
          items:
            type: string
    UpdateVariableStatusDto:
      type: object
      properties:
        status:
          type: string
          description: Status field indicating whether a variable is actively being used, or is archived.
          enum:
          - active
          - archived
      required:
      - status
  securitySchemes:
    bearerAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Enter your DevCycle SDK token