Buildkite
GraphQL
Execute custom GraphQL queries against the Buildkite GraphQL API to retrieve specific data from your Buildkite organization, including pipelines, agents, builds, teams, and other resources.
Sync Type: Configurable (Interval-based)
Requirements
- A Buildkite organization account
- An API token with GraphQL permissions
- Knowledge of Buildkite's GraphQL schema and query structure
Creating an API Token
To create an API token for accessing Buildkite's GraphQL API:
- Navigate to Personal Settings in your Buildkite account
- Go to API Access Token section
- Click New API Access token
- Fill in a description for the token (e.g., "Monad GraphQL Access")
- Select your organization from the dropdown menu
- Check the GraphQL API checkbox to grant GraphQL access permissions
- Press Create New API token
- Copy the generated token and use it in the configuration
Note: Store the token securely as it won't be shown again once you leave the page.
Configuration
The following configuration defines the input parameters. Each field's specifications, such as type, requirements, and descriptions, are detailed below.
Settings
| Setting | Type | Required | Description |
|---|---|---|---|
| GraphQL Query | text | Yes | The GraphQL query to execute against the Buildkite API. Must be a valid GraphQL query string. |
| Interval Seconds | integer | Yes | Time interval in seconds between consecutive API calls. Default: 10 seconds. |
| Record Location | string | Yes | Location of the records array in the GraphQL response. See Record Location for syntax and examples. |
| Variables | array | No | GraphQL query variables to pass with each request. Each variable has a Name and Value. |
| Enable Pagination | boolean | Yes | Enable automatic pagination support. Default: false. |
| Pagination Cursor Path | string | No | JSONPath location for pagination cursor/token (required if pagination is enabled). |
| Has Next Page Path | string | No | JSONPath location to check if there are more pages (required if pagination is enabled). |
Secrets
| Secret | Type | Required | Description |
|---|---|---|---|
| Token | string | Yes | Buildkite API token with GraphQL API permissions. |
GraphQL Query Examples
Basic Pipeline Query
Code
Agents Query
Code
Builds Query with Variables
Code
Pagination Configuration
For queries returning large datasets, configure pagination:
- Enable Pagination: Set to
true - Pagination Cursor Path:
data.organization.pipelines.pageInfo.endCursor - Has Next Page Path:
data.organization.pipelines.pageInfo.hasNextPage - Query Variables: Include an
aftervariable in your query for cursor-based pagination
Example paginated query:
Code
Variables Configuration
Variables allow you to parameterize your queries:
| Variable Name | Value | Description |
|---|---|---|
orgSlug | your-org-slug | Your organization slug |
pipelineSlug | my-pipeline | Specific pipeline slug |
state | RUNNING | Build state filter |
first | 100 | Number of records to fetch |
Common Use Cases
- Custom Pipeline Analytics: Query specific pipeline metadata and statistics
- Agent Monitoring: Retrieve detailed agent information and status
- Build Analysis: Fetch build data with custom filters and timeframes
- Team Management: Query team memberships and permissions
- Audit Trail: Retrieve detailed activity logs and changes
- Resource Inventory: Get comprehensive lists of all organization resources
Related Articles
- Buildkite GraphQL API Documentation
- Buildkite GraphQL Explorer
- GraphQL Query Language Guide
- JSONPath Expression Guide
Sample Record
Code
Last modified on