Background agent credentials
An agent's gateway credential identifies the agent to Willow. Integration authentication identifies the account used to call an application such as GitHub. These are separate credential sets.
Authentication
The gateway accepts the agent's access key and secret together:
Authorization: Bearer <access_key>:<secret>
The Connect dialog on Overview shows the selected gateway, the agent's MCP endpoint, and the authentication header format. Use the exact endpoint shown there, including any gateway path prefix.
The secret returned when the agent is created is its Default token. An agent can hold several tokens. Open Settings > Platform > Client Credentials to find the Tokens list and New token. Each token shows its kind, the last four characters, when it was created, and when it was last used:
| Kind | Created by | Behavior |
|---|---|---|
| Platform | Deploying the agent | Handed to the agent's platform. Every deploy replaces it, so an old copy stops working. It cannot fire API triggers. |
| Manual | New token, or when the agent is created | For callers outside the platform, such as API triggers or an MCP client. Deploying does not touch it. |
| Legacy | Agents that predate tokens, from their old secret | Works like a manual token, and can be revoked. |
Give each manual token a name for the caller that uses it. Its secret is shown once when you create or recreate it; store it before closing. The Admin API also returns a secret when creating or rotating the agent's credentials; subsequent get/list responses do not expose it.
Managed platforms receive their platform token through deployment. Use a manual token when configuring an external client or runtime.
Secret rotation
| Action | Effect |
|---|---|
| Create a manual token | Adds a token for an outside caller; its secret is shown once. |
| Recreate a token | Issues a new secret for that token; its previous secret stops working immediately. |
| Revoke a token | Rejects that token's callers immediately. Revoking the platform token cuts the agent off from the gateway until you deploy again. |
| Deploy to a managed platform | Replaces the platform token; manual tokens are not affected. |
| Disable the agent | Prevents it from authenticating and running while preserving its definition. |
Clients using a recreated or revoked token must be updated. The underlying integration account is configured separately; changing a gateway token does not establish a new integration connection.
Integration authentication
Authentication is configured per MCP server in the agent's Tools tab.
| Selection | Identity used by tool calls |
|---|---|
| Run as the initiator | The person who triggered the run, using their integration connection. Available for per-user-auth servers. |
| Connect my account | The connected account displayed in the dialog. Calls run through this account. The label includes the configured authentication method. |
| Use the MCP server default | The server's shared credential, when it has one. On a per-user server, this supplies no agent identity. |
| API Key, Client Credentials, or Server App | The credential supplied for the integration, where that method is available. |
| None | No application authentication. Suitable only for an endpoint that requires none. |
For initiator authentication, Slack provides the person's identity. API triggers and direct MCP/API connections send the person as a verified x-user-token that proves who they are (see How agents authenticate to Willow). Re-authenticate every run requests a fresh provider connection on each run when enabled.
The Admin API capability model includes integration authentication with auth_user_email for a connected account. See Update Background Agent.
Set an agent's own credential with the Admin API
To set the API Key, Client Credentials, or Server App credential of many agents or servers from a script, send capabilities.integration_auth through the Admin API. Use an API token with the admin:write scope. Update Background Agent changes an existing agent, and Create Background Agent takes the same capabilities when it creates one. The Admin MCP tools update_background_agent and create_background_agent accept the same fields.
This request sets one credential of each kind:
curl -X PATCH https://app.withwillow.ai/api/background-agents/<agent-id> \
-H "Authorization: Bearer wxt_..." \
-H "Content-Type: application/json" \
-d '{
"capabilities": {
"integration_auth": [
{
"integration_slug": "payments-api",
"auth_mode": "custom",
"use_connected_auth": false,
"custom_auth": {
"auth_type": "client-credentials",
"client_id": "my-client-id",
"secret": "my-client-secret",
"token_url": "https://idp.example.com/oauth/token",
"scopes": ["payments.read"]
}
},
{
"integration_slug": "search-api",
"auth_mode": "custom",
"use_connected_auth": false,
"custom_auth": {
"auth_type": "api-key",
"secret": "my-api-key",
"header_prefix": "Bearer"
}
},
{
"integration_slug": "github",
"auth_mode": "custom",
"use_connected_auth": false,
"custom_auth": {
"auth_type": "server-app",
"app_id": "123456",
"installation_id": "7890123",
"secret": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
}
}
]
}
}'
Each entry is for one MCP server, named by its integration_slug. auth_mode must be custom, and use_connected_auth must be false. Without auth_mode: "custom" the call succeeds but the agent keeps calling the server with the server's own credential.
custom_auth has these fields:
auth_type | Fields | What the agent sends |
|---|---|---|
client-credentials | client_id, secret (the client secret), token_url, scopes (optional), send_as_json (optional) | A bearer token that Willow gets from token_url. By default the token request is a form post; send_as_json sends it as JSON. |
api-key | secret (the key), header_name (optional, default Authorization), header_prefix (optional) | The key in header_name, after header_prefix and a space. Without header_prefix the key is sent as is, so set it to Bearer for a bearer key. |
server-app | app_id, installation_id, secret (the app's private key), scopes (optional) | A token Willow signs with the private key for the app. Only for servers that support Server App, such as GitHub. |
The secret is write-only:
- Willow encrypts it when it stores it. No call returns it.
- Get Background Agent and the other reads return the rest of
custom_authwithhas_secret: truewhen one is stored. - Leave
secretout to keep the stored one, for example to changescopesorheader_prefix. Send it again when you changeauth_type. - You can send back an entry exactly as you read it.
has_secretis ignored on write.
Things to know:
- Only the servers you send change. Entries for other servers, and the agent's
tools,skills, andrules, keep their stored value. - The change applies to the agent's next tool call. A server that needs a credential and has none stored for the agent returns an error to the agent instead of falling back to the server's own credential.
Owner visibility
Show credentials to owners controls whether owners can view access keys and create, recreate, and revoke tokens in the end-user portal. Administrative permissions are controlled separately by the Background Agents role scope.