GitLab CI/CD cluster_agents API

Operations related to the GitLab agent for Kubernetes

Operations 8

GET /api/v4/projects/{id}/cluster_agents/{agent_id}/tokens List tokens for an agent #
POST /api/v4/projects/{id}/cluster_agents/{agent_id}/tokens Create an agent token #
GET /api/v4/projects/{id}/cluster_agents/{agent_id}/tokens/{token_id} Get a single agent token #
DELETE /api/v4/projects/{id}/cluster_agents/{agent_id}/tokens/{token_id} Revoke an agent token #
GET /api/v4/projects/{id}/cluster_agents List the agents for a project #
POST /api/v4/projects/{id}/cluster_agents Register an agent with a project #
GET /api/v4/projects/{id}/cluster_agents/{agent_id} Get details about an agent #
DELETE /api/v4/projects/{id}/cluster_agents/{agent_id} Delete a registered agent #

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-cluster-agents-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-cluster-agents-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: GitLab access_requests Cluster Agents API
  version: v4
  description: Operations related to access requests
servers:
- url: https://gitlab.com
tags:
- name: cluster_agents
  description: Operations related to the GitLab agent for Kubernetes
paths:
  /api/v4/projects/{id}/cluster_agents/{agent_id}/tokens:
    get:
      summary: List tokens for an agent
      description: This feature was introduced in GitLab 15.0. Returns a list of tokens for an agent.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      - in: path
        name: agent_id
        description: The ID of an agent
        required: true
        schema:
          type: integer
          format: int32
      - 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 tokens for an agent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Clusters_AgentTokenBasic'
      tags:
      - cluster_agents
      operationId: getApiV4ProjectsIdClusterAgentsAgentIdTokens
    post:
      summary: Create an agent token
      description: This feature was introduced in GitLab 15.0. Creates a new token for an agent.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      - in: path
        name: agent_id
        description: The ID of an agent
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '201':
          description: Create an agent token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Clusters_AgentTokenWithToken'
      tags:
      - cluster_agents
      operationId: postApiV4ProjectsIdClusterAgentsAgentIdTokens
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postApiV4ProjectsIdClusterAgentsAgentIdTokens'
        required: true
  /api/v4/projects/{id}/cluster_agents/{agent_id}/tokens/{token_id}:
    get:
      summary: Get a single agent token
      description: This feature was introduced in GitLab 15.0. Gets a single agent token.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      - in: path
        name: agent_id
        description: The ID of an agent
        required: true
        schema:
          type: integer
          format: int32
      - in: path
        name: token_id
        description: The ID of the agent token
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Get a single agent token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Clusters_AgentToken'
      tags:
      - cluster_agents
      operationId: getApiV4ProjectsIdClusterAgentsAgentIdTokensTokenId
    delete:
      summary: Revoke an agent token
      description: This feature was introduced in GitLab 15.0. Revokes an agent token.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      - in: path
        name: agent_id
        description: The ID of an agent
        required: true
        schema:
          type: integer
          format: int32
      - in: path
        name: token_id
        description: The ID of the agent token
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '204':
          description: Revoke an agent token
      tags:
      - cluster_agents
      operationId: deleteApiV4ProjectsIdClusterAgentsAgentIdTokensTokenId
  /api/v4/projects/{id}/cluster_agents:
    get:
      summary: List the agents for a project
      description: This feature was introduced in GitLab 14.10. Returns the list of agents registered for the project.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        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: List the agents for a project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Clusters_Agent'
      tags:
      - cluster_agents
      operationId: getApiV4ProjectsIdClusterAgents
    post:
      summary: Register an agent with a project
      description: This feature was introduced in GitLab 14.10. Registers an agent to the project.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      responses:
        '201':
          description: Register an agent with a project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Clusters_Agent'
      tags:
      - cluster_agents
      operationId: postApiV4ProjectsIdClusterAgents
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postApiV4ProjectsIdClusterAgents'
        required: true
  /api/v4/projects/{id}/cluster_agents/{agent_id}:
    get:
      summary: Get details about an agent
      description: This feature was introduced in GitLab 14.10. Gets a single agent details.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      - in: path
        name: agent_id
        description: The ID of an agent
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Get details about an agent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_Clusters_Agent'
      tags:
      - cluster_agents
      operationId: getApiV4ProjectsIdClusterAgentsAgentId
    delete:
      summary: Delete a registered agent
      description: This feature was introduced in GitLab 14.10. Deletes an existing agent registration.
      parameters:
      - in: path
        name: id
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          type: string
      - in: path
        name: agent_id
        description: The ID of an agent
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '204':
          description: Delete a registered agent
      tags:
      - cluster_agents
      operationId: deleteApiV4ProjectsIdClusterAgentsAgentId
components:
  schemas:
    API_Entities_ProjectIdentity:
      type: object
      properties:
        id:
          type: integer
          format: int32
          example: 1
        description:
          type: string
          example: desc
        name:
          type: string
          example: project1
        name_with_namespace:
          type: string
          example: John Doe / project1
        path:
          type: string
          example: project1
        path_with_namespace:
          type: string
          example: namespace1/project1
        created_at:
          type: string
          format: date-time
          example: '2020-05-07T04:27:17.016Z'
      required:
      - id
      - description
      - name
      - name_with_namespace
      - path
      - path_with_namespace
      - created_at
    API_Entities_Clusters_AgentToken:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        agent_id:
          type: string
        status:
          type: string
        created_at:
          type: string
        created_by_user_id:
          type: string
        last_used_at:
          type: string
      required:
      - id
      - name
      - description
      - agent_id
      - status
      - created_at
      - created_by_user_id
      - last_used_at
      description: API_Entities_Clusters_AgentToken model
    API_Entities_Clusters_AgentTokenBasic:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        agent_id:
          type: string
        status:
          type: string
        created_at:
          type: string
        created_by_user_id:
          type: string
      required:
      - id
      - name
      - description
      - agent_id
      - status
      - created_at
      - created_by_user_id
      description: API_Entities_Clusters_AgentTokenBasic model
    postApiV4ProjectsIdClusterAgents:
      type: object
      properties:
        name:
          type: string
          description: The name of the agent
      required:
      - name
      description: Register an agent with a project
    API_Entities_Clusters_AgentTokenWithToken:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        agent_id:
          type: string
        status:
          type: string
        created_at:
          type: string
        created_by_user_id:
          type: string
        last_used_at:
          type: string
        token:
          type: string
      required:
      - id
      - name
      - description
      - agent_id
      - status
      - created_at
      - created_by_user_id
      - last_used_at
      - token
      description: API_Entities_Clusters_AgentTokenWithToken model
    API_Entities_Clusters_Agent:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        config_project:
          $ref: '#/components/schemas/API_Entities_ProjectIdentity'
        created_at:
          type: string
        created_by_user_id:
          type: string
        is_receptive:
          type: string
      required:
      - id
      - name
      - config_project
      - created_at
      - created_by_user_id
      - is_receptive
      description: API_Entities_Clusters_Agent model
    postApiV4ProjectsIdClusterAgentsAgentIdTokens:
      type: object
      properties:
        name:
          type: string
          description: The name for the token
        description:
          type: string
          description: The description for the token
      required:
      - name
      description: Create an agent token
  securitySchemes:
    access_token_header:
      type: apiKey
      name: PRIVATE-TOKEN
      in: header
    access_token_query:
      type: apiKey
      name: private_token
      in: query