CircleCI Self-Hosted Runner API

The CircleCI Self-Hosted Runner API enables management and execution of jobs on self-hosted runner infrastructure. It provides endpoints for listing available runners, managing runner tasks, and querying resource classes. The API is hosted separately from the main CircleCI API at runner.circleci.com and supports multiple authentication methods depending on the endpoint. Developers can use this API to integrate self-hosted runner management into their infrastructure automation workflows.

OpenAPI Specification

circleci-runner-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CircleCI REST API v1 Artifact Runner 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
  description: Endpoints for listing and querying self-hosted runners and their status within a namespace or resource class.
paths:
  /runner:
    get:
      operationId: listRunners
      summary: List self-hosted runners
      description: Retrieves a list of self-hosted runners filtered by namespace or resource class. At least one filter parameter must be provided to return results. Returns details including hostname, name, connection timestamps, version, and resource class.
      tags:
      - Runner
      parameters:
      - name: namespace
        in: query
        description: The namespace to filter runners by. Cannot be used together with resource-class.
        schema:
          type: string
      - name: resource-class
        in: query
        description: The resource class to filter runners by. Cannot be used together with namespace.
        schema:
          type: string
      responses:
        '200':
          description: Successfully retrieved runners
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/Runner'
                    description: List of runners
        '400':
          description: Bad request - at least one filter parameter must be provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Runner:
      type: object
      properties:
        resource_class:
          type: string
          description: The resource class the runner belongs to in namespace/name format
        hostname:
          type: string
          description: The hostname of the machine running the runner agent
        name:
          type: string
          description: The name assigned to the runner
        first_connected:
          type: string
          format: date-time
          description: When the runner first connected to CircleCI
        last_connected:
          type: string
          format: date-time
          description: When the runner last connected to CircleCI
        last_used:
          type: string
          format: date-time
          description: When the runner last executed a task
        version:
          type: string
          description: The version of the runner agent
        ip:
          type: string
          description: The IP address of the runner
        os:
          type: string
          description: The operating system of the runner
        arch:
          type: string
          description: The CPU architecture of the runner
    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/