canonical: https://jentic.com/apis/buildkite.com/buildkite

# Buildkite API

Jentic publishes the only available OpenAPI specification for Buildkite API, keeping it validated and agent-ready. Buildkite is a CI/CD platform that runs build jobs on customer-controlled agents while providing a hosted control plane for organisations, pipelines, builds, and self-hosted agents. The v2 REST API covers the operator surface: listing and managing pipelines, triggering and cancelling builds, rebuilding past runs, and inspecting connected agents. Use it to script pipeline provisioning, kick off ad-hoc deploys, surface build status in a custom dashboard, or wire CI events into chat and incident tools.

## For AI agents

Trigger builds, manage pipelines, and inspect agents inside a Buildkite organisation across 18 REST endpoints.

## Scope

Does not handle build artefact storage, agent installation on hosts, or test result reporting - use for managing pipelines, triggering and inspecting builds, and listing agents only.

## Capabilities

- List, create, update, and delete pipelines inside a Buildkite organisation
- Trigger a new build on a pipeline with a commit SHA, branch, and message
- List builds across the whole account, an organisation, or a single pipeline
- Cancel an in-flight build or rebuild a previously completed build
- List connected agents and stop a specific agent gracefully
- Read organisation metadata and the current authenticated user profile
- Inspect a specific build by pipeline slug and build number

## Use cases

### ChatOps Deploy Triggers

Let engineers trigger releases from Slack with a slash command. The agent translates the command into a POST /organizations/{org_slug}/pipelines/{pipeline_slug}/builds call, supplies the branch and commit, and replies with the build URL. Combined with the cancel and rebuild endpoints it covers the full deploy controls without anyone touching the dashboard.

Example prompt: Trigger a build on the deploy-prod pipeline at branch main with commit SHA abc123 and message Manual deploy from Slack.

### Pipeline Provisioning at Scale

Create Buildkite pipelines programmatically when new repositories are onboarded. POST /organizations/{org_slug}/pipelines accepts pipeline YAML and repository URL so a script can spin up CI for every new service. Pair it with PATCH to update steps as the standard pipeline template evolves across the organisation.

Example prompt: Create a Buildkite pipeline named payments-service in the example-org organisation, pointing at github.com/example/payments-service with the standard build steps.

### Build Health Dashboard

Power a custom dashboard that surfaces flaky pipelines and long-running builds. Poll GET /organizations/{org_slug}/builds with state filters, group by pipeline, and compute pass rate and median duration. Use the rebuild endpoint to retry suspected flakes automatically and tag the rebuild reason in the message.

Example prompt: List all builds in the last 24 hours, group by pipeline, and post the top 3 pipelines with the most failures to a Slack channel.

### AI Agent Release Captain via Jentic

An on-call agent connected via Jentic can act as a release captain - triggering builds, cancelling ones that fail review, and confirming the rebuild succeeded. The agent searches Jentic for trigger a build, loads the POST .../builds schema, and executes against the operator's vault-stored Buildkite token without ever exposing the secret.

Example prompt: Search Jentic for trigger a Buildkite build, load the schema, execute it for pipeline deploy-prod on branch main, and poll until the build state is passed or failed.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /organizations/{org_slug}/pipelines/{pipeline_slug}/builds | Create a build |
| PUT | /organizations/{org_slug}/pipelines/{pipeline_slug}/builds/{build_number}/cancel | Cancel a build |
| PUT | /organizations/{org_slug}/pipelines/{pipeline_slug}/builds/{build_number}/rebuild | Rebuild a build |
| POST | /organizations/{org_slug}/pipelines | Create a pipeline |
| GET | /organizations/{org_slug}/builds | List builds in an organisation |
| GET | /organizations/{org_slug}/agents | List agents |
| PUT | /organizations/{org_slug}/agents/{agent_id} | Stop an agent |

## Key resources

- **Organizations** — List organisations the token has access to and read organisation metadata
- **Pipelines** — Create, list, update, and delete pipelines inside an organisation
- **Builds** — List builds, create new builds, and read build details by pipeline and number
- **Build Actions** — Cancel an in-flight build or rebuild a previously completed one
- **Agents** — List connected agents and stop an agent by ID
- **User** — Read the current authenticated user profile

## Why Jentic

- **Setup:** Wiring Buildkite by hand means learning its bearer token auth against api.buildkite.com/v2 and passing the organization and pipeline slugs through every build call yourself. Through Jentic you install once, import Buildkite from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Buildkite puts the organization and pipeline slugs in the URL path (/organizations/{org_slug}/pipelines/{pipeline_slug}/builds/...), so a rule can pin your agent to one pipeline: it can trigger, cancel, and rebuild builds there and nothing else. You choose the operations it may call, so it can trigger builds without being able to create new pipelines or update agents unless you add those.
- **Credential handling:** Your Buildkite API access token is stored once, encrypted, by your own Jentic One instance and injected as the Authorization header at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'trigger a build' or 'cancel a build', and Jentic returns the matching Buildkite operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **CircleCI API** — CircleCI is a hosted CI/CD platform that runs jobs on its own infrastructure, while Buildkite runs jobs on customer-controlled agents.
- **Bugsnag API** — Bugsnag captures runtime errors in builds Buildkite has shipped to production.
- **Bugfender API** — Bugfender captures device logs from mobile builds shipped via Buildkite pipelines.

## FAQ

### Why is there no official OpenAPI spec for Buildkite API?

Buildkite documents its REST API in human-readable form but does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Buildkite API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Buildkite API use?

Buildkite uses HTTP bearer authentication with an API access token generated from your personal settings. Each request must include Authorization: Bearer <token>. Through Jentic, the token is stored encrypted in the vault and the header is constructed at execution time.

### Can I trigger a Buildkite build through the API?

Yes. POST /organizations/{org_slug}/pipelines/{pipeline_slug}/builds creates a new build with parameters for branch, commit SHA, message, and environment variables. The response includes the build number and URL so you can poll its status afterwards.

### Can I cancel or rebuild a Buildkite build through the API?

Yes. PUT /organizations/{org_slug}/pipelines/{pipeline_slug}/builds/{build_number}/cancel cancels an in-flight build, and PUT on the same path with /rebuild retries a completed build. Both return the updated build resource.

### What are the rate limits for the Buildkite API?

Buildkite enforces per-token rate limits that are not encoded in the OpenAPI spec. Add retry-with-backoff for HTTP 429 responses and avoid tight polling on the builds endpoints - prefer webhooks for build state change notifications when possible.

### How do I trigger a Buildkite build from an AI agent through Jentic?

Run pip install jentic and authenticate with your ak_* key. Search Jentic with trigger a Buildkite build, load the POST .../builds operation, and execute it with org_slug, pipeline_slug, branch, and commit. Jentic injects the bearer token from your stored credential.

### Can I limit what my agent is allowed to do with the Buildkite API?

Yes. Because Jentic One runs self-hosted, your own rules decide which Buildkite operations and credentials the agent may use. Buildkite puts the organization and pipeline slugs in the URL path, so a rule can pin the agent to a single pipeline where it may trigger, cancel, and rebuild builds and nothing else. You choose the exact operations it can call, so it can trigger builds without also being able to create new pipelines or stop agents unless you grant those.
