Trusted workloads is in beta and is rolling out to workspaces gradually. If Settings → API Keys → Trusted workloads doesn’t appear in your dashboard, your workspace doesn’t have it yet.
website project’s production deployment” or “this is a workflow in acme/app”. The token expires within hours. With trusted workloads, you tell Phaseo which of these workloads to trust, and they send that token instead of an API key. Nothing long-lived has to be stored in your project settings or CI secrets.
API keys keep working. Use trusted workloads for code that runs on Vercel or in GitHub Actions, and keep API keys for everything else, such as servers elsewhere, local scripts and mobile apps.
How it works
- A workspace owner or admin creates a trust policy in Settings → API Keys → Trusted workloads. The policy names the platform, your Vercel team or GitHub owner, and optional conditions such as a project, repository, branch or environment.
- Your code requests a token from the platform for the audience
https://api.phaseo.appand sends it asAuthorization: Bearer <token>. - Phaseo checks the token’s signature and expiry, then looks for exactly one active policy that matches it.
- The request runs as that policy’s key. It gets the same rate limits, budgets, logs and billing as a request made with an API key.
Why the audience matters
Tokens must be issued for the audiencehttps://api.phaseo.app. By default, Vercel and GitHub Actions issue tokens for an audience shared by every service your workload calls. If Phaseo accepted those, a token you sent to another service could be reused to call Phaseo. Phaseo refuses tokens with any other audience.
Create a trust policy
1
Open Trusted workloads
Go to Settings → API Keys → Trusted workloads and select New policy. Only workspace owners and admins can manage policies.
2
Choose the platform and fill in the IDs
- Vercel
- GitHub Actions
- Team slug: the team’s slug, as in
vercel.com/<team-slug>. Leave it empty if your project uses Vercel’s global issuer mode (issuerhttps://oidc.vercel.cominstead ofhttps://oidc.vercel.com/<team-slug>). - Team ID: starts with
team_. Find it in your Vercel team settings. - Project ID (recommended): starts with
prj_. Find it in your Vercel project settings. Without it, every project in the team is trusted. - Environment: production, preview or development. Leave all unticked to accept any environment.
3
Set the longest token accepted
In Longest token accepted (hours), set the longest lifetime you accept. Tokens issued to last longer are refused. The maximum is 12 hours, which covers Vercel development tokens.
Manage policies with Terraform or the API
You can also manage policies as code with a management key that has thekeys:read, keys:write and keys:delete capabilities. Only workspaces with trusted workloads can use them.
With Terraform, use the phaseo_trusted_workload resource:
platform is vercel or github_actions. For Vercel, also set issuer to https://oidc.vercel.com/<team-slug>, or https://oidc.vercel.com for global issuer mode, and use conditions such as project_id and environment. Changing the platform, issuer or owner replaces the policy. A policy has no secret, so nothing sensitive is stored in Terraform state.
With the API, send the same fields to /v1/workload-identity/policies. The API calls the platform provider:
Call Phaseo with a token
Every Phaseo SDK accepts a function in place of the API key and calls it before each request and retry, so each request uses a current token. Each SDK except C++ includes a helper for each platform. It fetches a token issued forhttps://api.phaseo.app and reuses it until a minute before it expires:
The helpers need the next release of each SDK. On Vercel, the helper exchanges the deployment’s token from
VERCEL_OIDC_TOKEN_FILE or VERCEL_OIDC_TOKEN. In Vercel Functions the token arrives on each request as the x-vercel-oidc-token header; pass it to the helper as its token source.
- Vercel
- GitHub Actions
Use Passing a function as Don’t store the token in a module-level variable: Vercel can change it between requests.
getVercelOidcToken from the server entry of @vercel/oidc 4.x. Passing audience exchanges the deployment’s token for one issued to Phaseo.With the TypeScript SDK, pass a function as apiKey. The SDK calls it before every request, so each request uses a current token:apiKey needs a version of @phaseo/sdk newer than 3.0.0.With any HTTP client, request a token per request and send it as a bearer token:Behaviour and limits
- Same controls as a key. Requests run as the policy’s key, so key rate limits, budgets, department links, IP allowlists, logging settings and billing apply as usual.
- Model calls only. Workload tokens work where a gateway API key works. Management APIs refuse them.
- One matching policy. If two workspaces trust the same workload, Phaseo can’t tell which one you mean and refuses the request. Send the workspace ID in the
x-phaseo-workspaceheader to choose one. - Token lifetime. Tokens issued to last longer than the policy’s Longest token accepted are refused.
- API keys are unaffected. Trusted workloads add a second way to authenticate; they don’t change or disable API keys.
Troubleshooting
A refused token returns401 with one of these messages: