GitLab CI/CD ci_variables API

Operations related to CI/CD variables

Operations 15

GET /api/v4/groups/{id}/variables #
POST /api/v4/groups/{id}/variables #
GET /api/v4/groups/{id}/variables/{key} #
PUT /api/v4/groups/{id}/variables/{key} #
DELETE /api/v4/groups/{id}/variables/{key} #
GET /api/v4/projects/{id}/variables #
POST /api/v4/projects/{id}/variables #
GET /api/v4/projects/{id}/variables/{key} #
PUT /api/v4/projects/{id}/variables/{key} #
DELETE /api/v4/projects/{id}/variables/{key} #
GET /api/v4/admin/ci/variables #
POST /api/v4/admin/ci/variables #
GET /api/v4/admin/ci/variables/{key} #
PUT /api/v4/admin/ci/variables/{key} #
DELETE /api/v4/admin/ci/variables/{key} #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/gitlab-ci-ci-variables-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

gitlab-ci-ci-variables-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: GitLab access_requests Ci Variables API
  version: v4
  description: Operations related to access requests
servers:
- url: https://gitlab.com
tags:
- name: ci_variables
  description: Operations related to CI/CD variables
paths:
  /api/v4/groups/{id}/variables:
    get:
      description: Get a list of group-level variables
      parameters:
      - in: path
        name: id
        description: "The ID of a group or URL-encoded path of the group owned by the authenticated\n      user"
        required: true
        schema:
          type: string
      - in: query
        name: page
        description: Current page number
        required: false
        example: 1
        schema:
          type: integer
          format: int32
          default: 1
      - in: query
        name: per_page
        description: Number of items per page
        required: false
        example: 20
        schema:
          type: integer
          format: int32
          default: 20
      responses:
        '200':
          description: Get a list of group-level variables
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
      tags:
      - ci_variables
      operationId: getApiV4GroupsIdVariables
    post:
      description: Create a new variable in a group
      parameters:
      - in: path
        name: id
        description: "The ID of a group or URL-encoded path of the group owned by the authenticated\n      user"
        required: true
        schema:
          type: string
      responses:
        '201':
          description: Create a new variable in a group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '400':
          description: 400 Bad Request
      tags:
      - ci_variables
      operationId: postApiV4GroupsIdVariables
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postApiV4GroupsIdVariables'
        required: true
  /api/v4/groups/{id}/variables/{key}:
    get:
      description: Get the details of a group’s specific variable
      parameters:
      - in: path
        name: id
        description: "The ID of a group or URL-encoded path of the group owned by the authenticated\n      user"
        required: true
        schema:
          type: string
      - in: path
        name: key
        description: The key of the variable
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Get the details of a group’s specific variable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '404':
          description: Group Variable Not Found
      tags:
      - ci_variables
      operationId: getApiV4GroupsIdVariablesKey
    put:
      description: Update an existing variable from a group
      parameters:
      - in: path
        name: id
        description: "The ID of a group or URL-encoded path of the group owned by the authenticated\n      user"
        required: true
        schema:
          type: string
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Update an existing variable from a group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '400':
          description: 400 Bad Request
        '404':
          description: Group Variable Not Found
      tags:
      - ci_variables
      operationId: putApiV4GroupsIdVariablesKey
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putApiV4GroupsIdVariablesKey'
        required: true
    delete:
      description: Delete an existing variable from a group
      parameters:
      - in: path
        name: id
        description: "The ID of a group or URL-encoded path of the group owned by the authenticated\n      user"
        required: true
        schema:
          type: string
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      responses:
        '404':
          description: Group Variable Not Found
        '204':
          description: Delete an existing variable from a group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
      tags:
      - ci_variables
      operationId: deleteApiV4GroupsIdVariablesKey
  /api/v4/projects/{id}/variables:
    get:
      description: Get project variables
      parameters:
      - in: path
        name: id
        description: The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user
        required: true
        schema:
          type: string
      - in: query
        name: page
        description: Current page number
        required: false
        example: 1
        schema:
          type: integer
          format: int32
          default: 1
      - in: query
        name: per_page
        description: Number of items per page
        required: false
        example: 20
        schema:
          type: integer
          format: int32
          default: 20
      responses:
        '200':
          description: Get project variables
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
      tags:
      - ci_variables
      operationId: getApiV4ProjectsIdVariables
    post:
      description: Create a new variable in a project
      parameters:
      - in: path
        name: id
        description: The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user
        required: true
        schema:
          type: string
      responses:
        '201':
          description: Create a new variable in a project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '400':
          description: 400 Bad Request
      tags:
      - ci_variables
      operationId: postApiV4ProjectsIdVariables
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postApiV4ProjectsIdVariables'
        required: true
  /api/v4/projects/{id}/variables/{key}:
    get:
      description: Get the details of a single variable from a project
      parameters:
      - in: path
        name: id
        description: The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user
        required: true
        schema:
          type: string
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      - in: query
        name: filter[environment_scope]
        description: The environment scope of a variable
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Get the details of a single variable from a project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '404':
          description: Variable Not Found
      tags:
      - ci_variables
      operationId: getApiV4ProjectsIdVariablesKey
    put:
      description: Update an existing variable from a project
      parameters:
      - in: path
        name: id
        description: The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user
        required: true
        schema:
          type: string
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Update an existing variable from a project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '404':
          description: Variable Not Found
      tags:
      - ci_variables
      operationId: putApiV4ProjectsIdVariablesKey
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putApiV4ProjectsIdVariablesKey'
        required: true
    delete:
      description: Delete an existing variable from a project
      parameters:
      - in: path
        name: id
        description: The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user
        required: true
        schema:
          type: string
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      - in: query
        name: filter[environment_scope]
        description: The environment scope of the variable
        required: false
        schema:
          type: string
      responses:
        '404':
          description: Variable Not Found
        '204':
          description: Delete an existing variable from a project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
      tags:
      - ci_variables
      operationId: deleteApiV4ProjectsIdVariablesKey
  /api/v4/admin/ci/variables:
    get:
      description: List all instance-level variables
      parameters:
      - in: query
        name: page
        description: Current page number
        required: false
        example: 1
        schema:
          type: integer
          format: int32
          default: 1
      - in: query
        name: per_page
        description: Number of items per page
        required: false
        example: 20
        schema:
          type: integer
          format: int32
          default: 20
      responses:
        '200':
          description: List all instance-level variables
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
      tags:
      - ci_variables
      operationId: getApiV4AdminCiVariables
    post:
      description: Create a new instance-level variable
      responses:
        '201':
          description: Create a new instance-level variable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '400':
          description: 400 Bad Request
      tags:
      - ci_variables
      operationId: postApiV4AdminCiVariables
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postApiV4AdminCiVariables'
        required: true
  /api/v4/admin/ci/variables/{key}:
    get:
      description: Get the details of a specific instance-level variable
      parameters:
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Get the details of a specific instance-level variable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '404':
          description: Instance Variable Not Found
      tags:
      - ci_variables
      operationId: getApiV4AdminCiVariablesKey
    put:
      description: Update an instance-level variable
      parameters:
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Update an instance-level variable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Ci_Variable'
        '404':
          description: Instance Variable Not Found
      tags:
      - ci_variables
      operationId: putApiV4AdminCiVariablesKey
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putApiV4AdminCiVariablesKey'
        required: true
    delete:
      description: Delete an existing instance-level variable
      parameters:
      - in: path
        name: key
        description: The key of a variable
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Instance Variable Not Found
      tags:
      - ci_variables
      operationId: deleteApiV4AdminCiVariablesKey
components:
  schemas:
    API_Entities_Ci_Variable:
      type: object
      properties:
        variable_type:
          type: string
          example: env_var
        key:
          type: string
          example: TEST_VARIABLE_1
        value:
          type: string
          example: TEST_1
        hidden:
          type: boolean
        protected:
          type: boolean
        masked:
          type: boolean
        raw:
          type: boolean
        environment_scope:
          type: string
          example: '*'
        description:
          type: string
          example: This variable is being used for ...
      required:
      - variable_type
      - key
      - value
      description: API_Entities_Ci_Variable model
    postApiV4ProjectsIdVariables:
      type: object
      properties:
        key:
          type: string
          description: The key of a variable
        value:
          type: string
          description: The value of a variable
        protected:
          type: boolean
          description: Whether the variable is protected
        masked:
          type: boolean
          description: Whether the variable is masked
        masked_and_hidden:
          type: boolean
          description: Whether the variable is masked and hidden
        raw:
          type: boolean
          description: Whether the variable will be expanded
        variable_type:
          type: string
          description: 'The type of the variable. Default: env_var'
          enum:
          - env_var
          - file
        environment_scope:
          type: string
          description: The environment_scope of the variable
        description:
          type: string
          description: The description of the variable
      required:
      - key
      - value
      description: Create a new variable in a project
    putApiV4GroupsIdVariablesKey:
      type: object
      properties:
        value:
          type: string
          description: The value of a variable
        protected:
          type: boolean
          description: Whether the variable is protected
        masked:
          type: boolean
          description: Whether the variable is masked
        raw:
          type: boolean
          description: Whether the variable will be expanded
        variable_type:
          type: string
          description: 'The type of the variable. Default: env_var'
          enum:
          - env_var
          - file
        environment_scope:
          type: string
          description: The environment scope of the variable
        description:
          type: string
          description: The description of the variable
      description: Update an existing variable from a group
    postApiV4AdminCiVariables:
      type: object
      properties:
        key:
          type: string
          description: The key of the variable. Max 255 characters
        description:
          type: string
          description: The description of the variable
        value:
          type: string
          description: The value of a variable
        protected:
          type: boolean
          description: Whether the variable is protected
        masked:
          type: boolean
          description: Whether the variable is masked
        raw:
          type: boolean
          description: Whether the variable will be expanded
        variable_type:
          type: string
          description: 'The type of a variable. Available types are: env_var (default) and file'
          enum:
          - env_var
          - file
      required:
      - key
      - value
      description: Create a new instance-level variable
    postApiV4GroupsIdVariables:
      type: object
      properties:
        key:
          type: string
          description: "The ID of a group or URL-encoded path of the group owned by the\n        authenticated user"
        value:
          type: string
          description: The value of a variable
        protected:
          type: boolean
          description: Whether the variable is protected
        masked_and_hidden:
          type: boolean
          description: Whether the variable is masked and hidden
        masked:
          type: boolean
          description: Whether the variable is masked
        raw:
          type: boolean
          description: Whether the variable will be expanded
        variable_type:
          type: string
          description: 'The type of the variable. Default: env_var'
          enum:
          - env_var
          - file
        environment_scope:
          type: string
          description: The environment scope of the variable
        description:
          type: string
          description: The description of the variable
      required:
      - key
      - value
      description: Create a new variable in a group
    putApiV4ProjectsIdVariablesKey:
      type: object
      properties:
        value:
          type: string
          description: The value of a variable
        protected:
          type: boolean
          description: Whether the variable is protected
        masked:
          type: boolean
          description: Whether the variable is masked
        environment_scope:
          type: string
          description: The environment_scope of a variable
        raw:
          type: boolean
          description: Whether the variable will be expanded
        variable_type:
          type: string
          description: 'The type of the variable. Default: env_var'
          enum:
          - env_var
          - file
        filter:
          type: object
          description: 'Available filters: [environment_scope]. Example: filter[environment_scope]=production'
          properties:
            environment_scope:
              type: string
              description: The environment scope of a variable
        description:
          type: string
          description: The description of the variable
      description: Update an existing variable from a project
    putApiV4AdminCiVariablesKey:
      type: object
      properties:
        description:
          type: string
          description: The description of the variable
        value:
          type: string
          description: The value of a variable
        protected:
          type: boolean
          description: Whether the variable is protected
        masked:
          type: boolean
          description: Whether the variable is masked
        raw:
          type: boolean
          description: Whether the variable will be expanded
        variable_type:
          type: string
          description: 'The type of a variable. Available types are: env_var (default) and file'
          enum:
          - env_var
          - file
      description: Update an instance-level variable
  securitySchemes:
    access_token_header:
      type: apiKey
      name: PRIVATE-TOKEN
      in: header
    access_token_query:
      type: apiKey
      name: private_token
      in: query