REST API overview

The Buildkite REST API aims to give you complete programmatic access and control of Buildkite to extend, integrate and automate anything to suit your particular needs.

The current version of the Buildkite API is v2.

For the list of existing disparities between the REST API and the GraphQL API, see API differences.

Schema

All API access is over HTTPS, and accessed from the api.buildkite.com domain. All data is sent as JSON.

The following curl command:

curl https://api.buildkite.com

Generates a response like:

{"message":"đź› ","timestamp":1719276157}

where the timestamp value is the current Unix time value.

Endpoints

This section lists all the available endpoints organized by resource type. Each endpoint includes its HTTP method, path structure, and links to detailed documentation with request and response examples and additional relevant information.

Organizations

Method Endpoint Description
Method GET Endpoint /v2/organizations Description List organizations
Method GET Endpoint /v2/organizations/{org.slug} Description Get an organization

Organization members

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/members Description List organization members
Method GET Endpoint /v2/organizations/{org.slug}/members/{user.uuid} Description Get an organization member

Pipelines

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/pipelines Description List pipelines
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{slug} Description Get a pipeline
Method POST Endpoint /v2/organizations/{org.slug}/pipelines Description Create a pipeline
Method PATCH Endpoint /v2/organizations/{org.slug}/pipelines/{slug} Description Update a pipeline
Method DELETE Endpoint /v2/organizations/{org.slug}/pipelines/{slug} Description Delete a pipeline
Method POST Endpoint /v2/organizations/{org.slug}/pipelines/{slug}/archive Description Archive a pipeline
Method POST Endpoint /v2/organizations/{org.slug}/pipelines/{slug}/unarchive Description Unarchive a pipeline
Method POST Endpoint /v2/organizations/{org.slug}/pipelines/{slug}/webhook Description Add a webhook

Builds

Method Endpoint Description
Method GET Endpoint /v2/builds Description List all builds
Method GET Endpoint /v2/organizations/{org.slug}/builds Description List builds for an organization
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds Description List builds for a pipeline
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number} Description Get a build
Method POST Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds Description Create a build
Method PUT Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/cancel Description Cancel a build
Method PUT Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/rebuild Description Rebuild a build

Jobs

Method Endpoint Description
Method PUT Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/retry Description Retry a job
Method PUT Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/reprioritize Description Reprioritize a job
Method PUT Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/unblock Description Unblock a job
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/log Description Get a job's log
Method DELETE Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/log Description Delete a job's log
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/env Description Get a job's environment

Annotations

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/annotations Description List annotations
Method POST Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/annotations Description Create an annotation
Method DELETE Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/annotations/{uuid} Description Delete an annotation

Artifacts

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/artifacts Description List artifacts for a build
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/artifacts Description List artifacts for a job
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/artifacts/{id} Description Get an artifact
Method GET Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/artifacts/{id}/download Description Download an artifact
Method DELETE Endpoint /v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds/{number}/jobs/{job.id}/artifacts/{id} Description Delete an artifact

Agents

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/agents Description List agents
Method GET Endpoint /v2/organizations/{org.slug}/agents/{id} Description Get an agent
Method PUT Endpoint /v2/organizations/{org.slug}/agents/{id}/stop Description Stop an agent
Method PUT Endpoint /v2/organizations/{org.slug}/agents/{id}/pause Description Pause an agent
Method PUT Endpoint /v2/organizations/{org.slug}/agents/{id}/resume Description Resume an agent

Teams

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/teams Description List teams
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid} Description Get a team
Method POST Endpoint /v2/organizations/{org.slug}/teams Description Create a team
Method PATCH Endpoint /v2/organizations/{org.slug}/teams/{team.uuid} Description Update a team
Method DELETE Endpoint /v2/organizations/{org.slug}/teams/{team.uuid} Description Delete a team

Team members

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/members Description List team members
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/members/{user.uuid} Description Get a team member
Method POST Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/members Description Create a team member
Method PATCH Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/members/{user.uuid} Description Update a team member
Method DELETE Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/members/{user.uuid} Description Delete a team member

Team pipelines

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/pipelines Description List team pipelines
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/pipelines/{uuid} Description Get a team pipeline
Method POST Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/pipelines Description Create a team pipeline
Method PATCH Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/pipelines/{uuid} Description Update a team pipeline
Method DELETE Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/pipelines/{uuid} Description Delete a team pipeline

Team suites

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/suites Description List team suites
Method GET Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/suites/{uuid} Description Get a team suite
Method POST Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/suites Description Create a team suite
Method PATCH Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/suites/{uuid} Description Update a team suite
Method DELETE Endpoint /v2/organizations/{org.slug}/teams/{team.uuid}/suites/{uuid} Description Delete a team suite

Clusters

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/clusters Description List clusters
Method GET Endpoint /v2/organizations/{org.slug}/clusters/{id} Description Get a cluster
Method POST Endpoint /v2/organizations/{org.slug}/clusters Description Create a cluster
Method PUT Endpoint /v2/organizations/{org.slug}/clusters/{id} Description Update a cluster
Method DELETE Endpoint /v2/organizations/{org.slug}/clusters/{id} Description Delete a cluster

Cluster queues

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues Description List queues
Method GET Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues/{id} Description Get a queue
Method POST Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues Description Create a queue
Method PUT Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues/{id} Description Update a queue
Method DELETE Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues/{id} Description Delete a queue
Method POST Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues/{id}/pause_dispatch Description Pause a queue
Method POST Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/queues/{id}/resume_dispatch Description Resume a queue

Cluster agent tokens

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/tokens Description List agent tokens
Method GET Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/tokens/{id} Description Get an agent token
Method POST Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/tokens Description Create an agent token
Method PUT Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/tokens/{id} Description Update an agent token
Method DELETE Endpoint /v2/organizations/{org.slug}/clusters/{cluster.id}/tokens/{id} Description Delete an agent token

Pipeline templates

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/pipeline-templates Description List pipeline templates
Method GET Endpoint /v2/organizations/{org.slug}/pipeline-templates/{uuid} Description Get a pipeline template
Method POST Endpoint /v2/organizations/{org.slug}/pipeline-templates Description Create a pipeline template
Method PATCH Endpoint /v2/organizations/{org.slug}/pipeline-templates/{uuid} Description Update a pipeline template
Method DELETE Endpoint /v2/organizations/{org.slug}/pipeline-templates/{uuid} Description Delete a pipeline template

Rules

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/rules Description List rules
Method GET Endpoint /v2/organizations/{org.slug}/rules/{uuid} Description Get a rule
Method POST Endpoint /v2/organizations/{org.slug}/rules Description Create a rule
Method DELETE Endpoint /v2/organizations/{org.slug}/rules/{uuid} Description Delete a rule

Emojis

Method Endpoint Description
Method GET Endpoint /v2/organizations/{org.slug}/emojis Description List emojis

User

Method Endpoint Description
Method GET Endpoint /v2/user Description Get current user

Access token

Method Endpoint Description
Method GET Endpoint /v2/access-token Description Get current token
Method DELETE Endpoint /v2/access-token Description Revoke current token

Meta

Method Endpoint Description
Method GET Endpoint /v2/meta Description Get meta information

Query string parameters

Some API endpoints accept query string parameters which are added to the end of the URL. For example, the builds listing APIs can be filtered by state using the following curl command:

curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/organizations/my-org/pipelines/my-pipeline/builds?state=passed"

Request body properties

Some API requests accept JSON request bodies for specifying data. For example, the build create API can be passed the required properties using the following curl command:

curl -H "Authorization: Bearer $TOKEN" \
  -X POST "https://api.buildkite.com/v2/organizations/my-org/pipelines/my-pipeline/builds" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "value"
  }'

The data encoding is assumed to be application/json. Unless explicitly stated you can not encode properties as www-form-urlencoded or multipart/form-data.

Authentication

You can authenticate with the Buildkite API using access tokens, represented by the value $TOKEN throughout this documentation.

API access tokens authenticate calls to the API and can be created from the API access tokens page. When configuring API access tokens, you can limit their access to individual organizations and permissions, and these tokens can be revoked at any time from the web interface or the REST API.

To authenticate an API call using an access token, set the Authorization HTTP header to the word Bearer, followed by a space, followed by the access token. For example:

curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/user"

API access using basic HTTP authentication is not supported.

Public key

This feature is currently available in preview.

API access tokens can be created with a public key pair instead of a static token. The private key can be used to sign JWTs to authenticate API calls. You must use the API access token's UUID as the iss claim in the JWT, have an iat within 10 seconds of the current time, and an exp within 5 minutes of your iat.

For example, in Ruby - where private_key.pem contains the private key corresponding to an access token's public key and $UUID is the UUID of the access token:

require "net/http"
require "openssl"
require "jwt" # https://rubygems.org/gems/jwt

claims = {
  "iss" => "$UUID",
  "iat" => Time.now.to_i - 5,
  "exp" => Time.now.to_i + 60,
}

private_key = OpenSSL::PKey::RSA.new(File.read("private_key.pem"))

jwt = JWT.encode(claims, private_key, "RS256")

Net::HTTP.get(URI("https://api.buildkite.com/v2/access-token"), "Authorization" => "Bearer #{jwt}")

Pagination

For endpoints which support pagination, the pagination information can be found in the Link HTTP response header containing zero or more of next, prev, first and last.

curl -i -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/organizations/my-great-org/pipelines/my-pipeline/builds"
HTTP/1.1 200 OK
...
Link: <https://api.buildkite.com/v2/organizations/my-great-org/pipelines/my-pipeline/builds?api_key=f8582f070276d764ce3dd4c6d57be92574dccf86&page=3>; rel="next", <https://api.buildkite.com/v2/organizations/my-great-org/pipelines/my-pipeline/builds?api_key=f8582f070276d764ce3dd4c6d57be92574dccf86&page=6>; rel="last"

You can set the page using the following query string parameters:

page The page of results to return

Default: 1

per_page How many results to return per-page

Default: 30

Maximum: 100

CORS headers

API responses include the following CORS headers allowing you to use the API directly from the browser:

  • Access-Controller-Allow-Origin: *
  • Access-Control-Expose-Headers: Link

For an example of this in use, see the Emojis API example on CodePen for adding emoji support to your own browser-based dashboards and build screens.

Migrating from v1 to v2

The following changes were made in v2 of our API:

  • POST /v1/organizations/{org.slug}/agents has been removed
  • DELETE /v1/organizations/{org.slug}/agents/{id} has been removed
  • All project-related properties in JSON responses and requests have been renamed to pipeline
  • The featured_build pipeline property has been removed
  • The deprecated /accounts URL has been removed
  • URLs containing /projects have been renamed to /pipelines

Clients

To make getting started easier, check out these clients available from our contributors: