- Secret key (
tr_dev_…/tr_prod_…) — scoped to a single environment in a project. - Personal Access Token (PAT) (
tr_pat_…) — tied to a user account and can access all orgs, projects, and environments that user has permission to.
Both methods should only be used in backend server code. They provide full access to the project.
See the Realtime guide for frontend authentication.
Secret key
Secret key authentication scopes API access to a specific environment. Obtain a secret key from your project’s API Keys page in the Trigger.dev dashboard.Bearer token in the Authorization header for direct HTTP requests:
Personal Access Token (PAT)
A PAT grants access to all the orgs, projects, and environments the user has permission to. Because a PAT does not scope access to a specific environment, you must provide theprojectRef (and sometimes the environment) for calls that require it.
Endpoint support matrix
View which endpoints support each authentication method
View which endpoints support each authentication method
| Endpoint | Secret key | Personal Access Token |
|---|---|---|
tasks.trigger | ✅ | |
tasks.batchTrigger | ✅ | |
runs.list | ✅ | ✅ |
runs.retrieve | ✅ | |
runs.cancel | ✅ | |
runs.replay | ✅ | |
envvars.list | ✅ | ✅ |
envvars.retrieve | ✅ | ✅ |
envvars.upload | ✅ | ✅ |
envvars.create | ✅ | ✅ |
envvars.update | ✅ | ✅ |
envvars.del | ✅ | ✅ |
schedules.list | ✅ | |
schedules.create | ✅ | |
schedules.retrieve | ✅ | |
schedules.update | ✅ | |
schedules.activate | ✅ | |
schedules.deactivate | ✅ | |
schedules.del | ✅ |
Preview branch targeting
When working with preview branches you can target a specific branch by including thex-trigger-branch header (HTTP) or the previewBranch option (SDK).
- SDK
- cURL
The
x-trigger-branch header only applies to the preview environment. It has no effect on
dev, staging, or prod.