Buildkite Jobs API

The Jobs API from Buildkite — 5 operation(s) for jobs.

OpenAPI Specification

buildkite-jobs-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Buildkite REST AccessToken Jobs 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: Jobs
paths:
  /organizations/{org}/pipelines/{slug}/builds/{number}/jobs/{jobId}/retry:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    - $ref: '#/components/parameters/JobId'
    put:
      tags:
      - Jobs
      summary: Retry a job
      operationId: retryJob
      responses:
        '200':
          description: Job
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
  /organizations/{org}/pipelines/{slug}/builds/{number}/jobs/{jobId}/reprioritize:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    - $ref: '#/components/parameters/JobId'
    put:
      tags:
      - Jobs
      summary: Reprioritize a job
      operationId: reprioritizeJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                priority:
                  type: integer
      responses:
        '200':
          description: Job
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
  /organizations/{org}/pipelines/{slug}/builds/{number}/jobs/{jobId}/unblock:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    - $ref: '#/components/parameters/JobId'
    put:
      tags:
      - Jobs
      summary: Unblock a job
      operationId: unblockJob
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                unblocker:
                  type: string
                fields:
                  type: object
                  additionalProperties:
                    type: string
      responses:
        '200':
          description: Job
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
  /organizations/{org}/pipelines/{slug}/builds/{number}/jobs/{jobId}/log:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    - $ref: '#/components/parameters/JobId'
    get:
      tags:
      - Jobs
      summary: Get job log
      operationId: getJobLog
      responses:
        '200':
          description: Log
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                  content:
                    type: string
                  size:
                    type: integer
    delete:
      tags:
      - Jobs
      summary: Delete job log
      operationId: deleteJobLog
      responses:
        '204':
          description: Deleted
  /organizations/{org}/pipelines/{slug}/builds/{number}/jobs/{jobId}/env:
    parameters:
    - $ref: '#/components/parameters/Org'
    - $ref: '#/components/parameters/PipelineSlug'
    - $ref: '#/components/parameters/BuildNumber'
    - $ref: '#/components/parameters/JobId'
    get:
      tags:
      - Jobs
      summary: Get job environment variables
      operationId: getJobEnv
      responses:
        '200':
          description: Environment
          content:
            application/json:
              schema:
                type: object
                properties:
                  env:
                    type: object
                    additionalProperties:
                      type: string
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
    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
  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
    JobId:
      name: jobId
      in: path
      required: true
      description: Job ID.
      schema:
        type: string
    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.