Buildkite Builds API

The Builds API from Buildkite — 6 operation(s) for builds.

OpenAPI Specification

buildkite-builds-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Buildkite REST AccessToken Builds API
  description: 'Best-effort OpenAPI 3.1 description of the Buildkite REST API for organizations, pipelines,

    builds, jobs, agents, artifacts, annotations, clusters, queues, agent tokens,

    pipeline templates, rules, teams, and access tokens.


    Authentication is via a Bearer token issued from the Buildkite UI.

    '
  version: '2.0'
  contact:
    name: Buildkite
    url: https://buildkite.com/docs/apis/rest-api
servers:
- url: https://api.buildkite.com/v2
  description: Buildkite REST API v2
security:
- bearerAuth: []
tags:
- name: Builds
paths:
  /builds:
    get:
      tags:
      - Builds
      summary: List all builds
      operationId: listAllBuilds
      responses:
        '200':
          description: Builds
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Build'
  /organizations/{org}/builds:
    parameters:
    - $ref: '#/components/parameters/Org'
    get:
      tags:
      - Builds
      summary: List org builds
      operationId: listOrgBuilds
      responses:
        '200':
          description: Builds
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Build'
  /organizations/{org}/pipelines/{slug}/builds:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    get:
      tags:
      - Builds
      summary: List pipeline builds
      operationId: listPipelineBuilds
      responses:
        '200':
          description: Builds
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Build'
    post:
      tags:
      - Builds
      summary: Create build
      operationId: createBuild
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BuildCreate'
      responses:
        '201':
          description: Build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Build'
  /organizations/{org}/pipelines/{slug}/builds/{number}:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    get:
      tags:
      - Builds
      summary: Get build
      operationId: getBuild
      responses:
        '200':
          description: Build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Build'
  /organizations/{org}/pipelines/{slug}/builds/{number}/cancel:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    put:
      tags:
      - Builds
      summary: Cancel build
      operationId: cancelBuild
      responses:
        '200':
          description: Build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Build'
  /organizations/{org}/pipelines/{slug}/builds/{number}/rebuild:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    put:
      tags:
      - Builds
      summary: Rebuild
      operationId: rebuildBuild
      responses:
        '200':
          description: New build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Build'
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: string
        graphql_id:
          type: string
        name:
          type: string
        email:
          type: string
        avatar_url:
          type: string
        created_at:
          type: string
          format: date-time
    Job:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        name:
          type: string
        step_key:
          type: string
        priority:
          type: object
        agent_query_rules:
          type: array
          items:
            type: string
        state:
          type: string
        web_url:
          type: string
        log_url:
          type: string
        raw_log_url:
          type: string
        command:
          type: string
        soft_failed:
          type: boolean
        exit_status:
          type:
          - integer
          - 'null'
        artifact_paths:
          type: string
        agent:
          $ref: '#/components/schemas/Agent'
        created_at:
          type: string
          format: date-time
        scheduled_at:
          type:
          - string
          - 'null'
          format: date-time
        runnable_at:
          type:
          - string
          - 'null'
          format: date-time
        started_at:
          type:
          - string
          - 'null'
          format: date-time
        finished_at:
          type:
          - string
          - 'null'
          format: date-time
    Pipeline:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        web_url:
          type: string
        name:
          type: string
        slug:
          type: string
        description:
          type: string
        repository:
          type: string
        cluster_id:
          type: string
        branch_configuration:
          type: string
        default_branch:
          type: string
        skip_queued_branch_builds:
          type: boolean
        provider:
          type: object
        builds_url:
          type: string
        badge_url:
          type: string
        created_at:
          type: string
          format: date-time
        archived_at:
          type:
          - string
          - 'null'
          format: date-time
    Build:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        web_url:
          type: string
        number:
          type: integer
        state:
          type: string
        message:
          type: string
        commit:
          type: string
        branch:
          type: string
        env:
          type: object
        author:
          type: object
        creator:
          $ref: '#/components/schemas/User'
        source:
          type: string
        created_at:
          type: string
          format: date-time
        scheduled_at:
          type: string
          format: date-time
        started_at:
          type:
          - string
          - 'null'
          format: date-time
        finished_at:
          type:
          - string
          - 'null'
          format: date-time
        pipeline:
          $ref: '#/components/schemas/Pipeline'
        jobs:
          type: array
          items:
            $ref: '#/components/schemas/Job'
    Agent:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        web_url:
          type: string
        name:
          type: string
        connection_state:
          type: string
        ip_address:
          type: string
        hostname:
          type: string
        user_agent:
          type: string
        version:
          type: string
        creator:
          $ref: '#/components/schemas/User'
        created_at:
          type: string
          format: date-time
        meta_data:
          type: array
          items:
            type: string
        last_job_finished_at:
          type:
          - string
          - 'null'
          format: date-time
        priority:
          type: integer
    BuildCreate:
      type: object
      required:
      - commit
      - branch
      properties:
        commit:
          type: string
        branch:
          type: string
        message:
          type: string
        author:
          type: object
          properties:
            name:
              type: string
            email:
              type: string
        env:
          type: object
          additionalProperties:
            type: string
        meta_data:
          type: object
        clean_checkout:
          type: boolean
        pull_request_id:
          type: string
        pull_request_base_branch:
          type: string
        pull_request_repository:
          type: string
  parameters:
    PipelineSlug:
      name: slug
      in: path
      required: true
      description: Pipeline slug.
      schema:
        type: string
    BuildNumber:
      name: number
      in: path
      required: true
      description: Build number.
      schema:
        type: integer
    Org:
      name: org
      in: path
      required: true
      description: Organization slug.
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token issued from your Buildkite Personal Access Tokens page.