CircleCI Runner Task API

Endpoints for querying task counts and managing tasks assigned to self-hosted runners.

OpenAPI Specification

circleci-runner-task-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CircleCI REST API v1 Artifact Runner Task API
  description: The CircleCI REST API v1 is the legacy API that provides access to build information, project details, and user data. While still available, CircleCI recommends migrating to the v2 API for newer features and improved functionality. The v1 API supports operations for retrieving build details, triggering builds, managing SSH keys, and accessing test metadata. Authentication is handled through API tokens passed as query parameters or HTTP headers.
  version: '1.1'
  contact:
    name: CircleCI Support
    url: https://support.circleci.com
  termsOfService: https://circleci.com/terms-of-service/
servers:
- url: https://circleci.com/api/v1.1
  description: CircleCI Production API v1.1
security:
- apiToken: []
tags:
- name: Runner Task
  description: Endpoints for querying task counts and managing tasks assigned to self-hosted runners.
paths:
  /runner/tasks:
    get:
      operationId: getUnclaimedTaskCount
      summary: Get unclaimed task count
      description: Returns the number of unclaimed tasks for a given resource class. This endpoint is scoped to a single resource class, so it must be called per resource class to get totals across all classes.
      tags:
      - Runner Task
      parameters:
      - name: resource-class
        in: query
        required: true
        description: The resource class to query unclaimed tasks for
        schema:
          type: string
      responses:
        '200':
          description: Successfully retrieved unclaimed task count
          content:
            application/json:
              schema:
                type: object
                properties:
                  unclaimed_task_count:
                    type: integer
                    description: Number of unclaimed tasks for the resource class
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /runner/tasks/running:
    get:
      operationId: getRunningTaskCount
      summary: Get running task count
      description: Returns the number of running tasks for a given resource class. This endpoint is scoped to a single resource class, so it must be called per resource class to get totals across all classes.
      tags:
      - Runner Task
      parameters:
      - name: resource-class
        in: query
        required: true
        description: The resource class to query running tasks for
        schema:
          type: string
      responses:
        '200':
          description: Successfully retrieved running task count
          content:
            application/json:
              schema:
                type: object
                properties:
                  running_runner_tasks:
                    type: integer
                    description: Number of running tasks for the resource class
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: Circle-Token
      description: Personal API token for authenticating with the CircleCI API. Can also be passed as a query parameter.
externalDocs:
  description: CircleCI API v1 Reference
  url: https://circleci.com/docs/api/v1/