buildkite-agent secret get or the secrets key of a pipeline step. Each Infisical secret becomes a Buildkite secret with the same key, unless you customize key names to add a prefix or suffix. You can also limit the synced secrets to selected pipelines in the cluster.
The Buildkite Secret Sync requires a Buildkite app connection. This guide walks you through creating a project-scoped app connection.
Prerequisites
- A project with secrets configured
- The maintainer role on the cluster you plan to sync to, or the administrator role in its Buildkite organization
Step 1: Create a Buildkite API access token
Infisical needs a Buildkite API access token that can read organizations, clusters, and pipelines, and read and write secrets.1
Log in to Buildkite, open the account menu in the top right, and select Personal settings. Then select API Access Tokens.

2
Select New API Access Token, and enter your password if Buildkite asks for it.

3
Fill in the form:
- Description: A name that identifies the token, such as
infisical - Credential Type: Token
- Organization Access: The organizations that own the clusters you plan to sync to
- Token Expiry: How long the token stays valid; once it expires, syncs fail until you update the connection with a new token
- REST API Scopes: READ for Organizations, Clusters, and Pipelines, and READ and WRITE for Secrets
- GraphQL API Access: Disabled, because Infisical uses only the REST API

4
Copy the token and store it securely. Buildkite shows it only once.
Step 2: Set up the sync in Infisical
1
In your project, go to Integrations and open the Secret Syncs tab. Select + Add Sync.
Then, select the Buildkite sync.
Then, select the Buildkite sync.
2
Under Source, choose which secrets to sync from Infisical:
Then select Continue.
- Environment: The project environment to retrieve secrets from
- Secret Path: The folder path to retrieve secrets from
- Include secrets from all subfolders: Also syncs the secrets in every folder beneath the path
Buildkite accepts a secret only if it meets these rules:
- The key starts with a letter, contains only letters, numbers, and underscores (
_), and doesn’t start withbuildkiteorbkin any case - No other synced secret has the same key in a different case, because Buildkite treats
API_KEYandapi_keyas the same key - The value is at most 32,767 bytes
Then select Continue.3
Under Destination, create or select the Buildkite app connection the sync will use, then choose the cluster that receives the secrets.
- Create a new app connection
- Use an existing connection
Under Buildkite Connection, select Create Connection in the dropdown, then fill in:
- Name: A descriptive name for the connection; it must be slug-friendly
- Description (optional): A note for future reference
- Method: API Token, the only method the connection supports
- Buildkite API Access Token: The token you copied when creating a Buildkite API access token
This creates a connection scoped to the current project. To share the connection across other projects, create it at the organization level first, then select it here.
- Organization: The Buildkite organization that owns the cluster
- Cluster: The Buildkite cluster to sync secrets to
-
Pipelines (optional): The pipelines in the cluster that can read the synced secrets (if you select none, the sync doesn’t set or change access policies)
4
Under Initial Sync Behavior, select Overwrite Buildkite, then select Continue.
Buildkite never returns the value of a secret through its API, so this sync can’t import existing Buildkite secrets into Infisical. Overwrite Buildkite is the only option.

5
Under Sync Options, choose how secrets are synced:
Then select Continue.
- Prevent secret deletion: When enabled, Infisical adds and updates secrets in Buildkite but never deletes them; enable this if you manage some of the cluster’s secrets outside of Infisical
- Auto-sync on changes: When enabled, secrets sync to Buildkite automatically as the source changes; turn it off to sync manually only
- Customize key names: Adds a prefix or suffix to every synced key, using
{{secretKey}}for the original name and{{environment}}for the environment slug
Then select Continue.6
Give the sync a Name and an optional Description. The name must be slug-friendly.
Then select Continue.
Then select Continue.7
Under Set up failure alerts, choose who hears about it when the sync fails after all of its retries. The failure alert is on by default under Alert on Sync Failure, with an email to the project’s admins. Select Add channel to also notify Slack, a webhook, or PagerDuty, or turn the alert off to skip this step.
Then select Continue.
Then select Continue.8
Review your Buildkite Sync configuration, then select Create Sync.

The sync is created. If Auto-sync on changes is enabled, it begins syncing secrets to Buildkite right away.
FAQ
Which builds can read the synced secrets?
Which builds can read the synced secrets?
If you select pipelines in the Pipelines field, only builds of those pipelines can read the secrets. The sync gives each secret it writes an access policy that allows only those pipelines, and replaces any other policy the secret has.If you leave Pipelines empty, every build in the cluster can read the secrets, unless a secret has an access policy in Buildkite. The sync creates secrets without a policy and changes only the value of an existing secret, so it keeps a policy you add in Buildkite, or one it set while pipelines were selected.
What happens if I change only the case of a secret's key?
What happens if I change only the case of a secret's key?
Buildkite treats keys that differ only in case as the same key, so the sync deletes the old Buildkite secret and creates one with the new key. The sync fails without changing anything if the old secret can’t be replaced:
- The sync has no pipelines selected and the old secret has an access policy, which the new secret would lose
- The sync can’t delete the old secret, because its key doesn’t match your customized key names or Prevent secret deletion is on
Why does a sync of many secrets take several minutes?
Why does a sync of many secrets take several minutes?
Buildkite limits how many API requests each user can make per minute, 50 by default, and the sync makes at least one request for every secret. When the sync reaches the limit, it waits for Buildkite to reset the limit and then continues. The sync can’t tell which values changed, because Buildkite doesn’t return them, so it writes every value on every sync.To find the limits for your organization, open Settings > Quotas in Buildkite.
Next steps
Buildkite
Create an organization-level Buildkite connection to share across projects.
Secret syncs
Learn how secret syncs work and how to manage them.