Workflow Secrets API
Store, list and delete workflow secrets with the Workflow Secrets API, so credentials stay out of step settings and resolve at run time.
A workflow secret is a named credential, such as a provider API token, stored for one workflow. Steps refer to it as {{secrets.KEY}}, so the value never appears in the workflow definition. Values are encrypted before they are stored and are never returned by the API.
| Scope | Endpoints |
|---|---|
secrets:read | List |
secrets:write | Create, update, delete |
The workflow must belong to your company, otherwise every endpoint returns 404.
Secret object
| Field | Type | Meaning |
|---|---|---|
id | string (UUID) | |
workflowId | string (UUID) | |
key | string | The name used in {{secrets.KEY}} |
maskedValue | string | •••• followed by the last 4 characters when the value has 12 or more characters, otherwise •••• alone |
lastUsedAt | string or null | When a run last read it |
createdAt, updatedAt | string (ISO 8601) |
key is UPPER_SNAKE_CASE: it starts with a letter, uses only A-Z, 0-9 and _, and has at most 64 characters. A value is 1 to 8,192 characters.
List secrets
GET /api/v1/workflows/{workflowId}/secretsReturns the workflow's secrets in data, sorted by key. No values are included.
Create a secret
POST /api/v1/workflows/{workflowId}/secrets| Field | Type | Required | Meaning |
|---|---|---|---|
key | string | Yes | Secret name |
value | string | Yes | Secret value |
curl -X POST 'https://workflow.loopfour.ai/api/v1/workflows/c3a1f7d2-58e4-4b9a-8f21-6d0e9b7c4a15/secrets' \
-H 'x-api-key: wfk_live_your_api_key' \
-H 'Content-Type: application/json' \
-d '{ "key": "BANK_PORTAL_TOKEN", "value": "your_token_value_here" }'{
"success": true,
"data": {
"id": "a3d5f8e2-1c7b-4e9a-8b40-2f6d1c9e7a53",
"workflowId": "c3a1f7d2-58e4-4b9a-8f21-6d0e9b7c4a15",
"key": "BANK_PORTAL_TOKEN",
"maskedValue": "••••here",
"lastUsedAt": null,
"createdAt": "2026-02-12T09:00:00.000Z",
"updatedAt": "2026-02-12T09:00:00.000Z"
}
}The response is 200. A key that already exists for the workflow returns 409 (Secret key already exists for this workflow).
Update a secret
PUT /api/v1/workflows/{workflowId}/secrets/{key}Takes value and replaces the stored value. The next run uses the new value. An unknown key returns 404.
Delete a secret
DELETE /api/v1/workflows/{workflowId}/secrets/{key}Returns { "deleted": true }. A run of a workflow whose steps still refer to the key fails with Missing required secrets: KEY.
Use a secret in a step
Refer to the key in any step setting, for example an API Request header:
{
"id": "fetch_balances",
"type": "action",
"name": "Fetch bank balances",
"action": "api.request",
"config": {
"url": "https://bank.example.com/v1/balances",
"method": "GET",
"headers": { "Authorization": "Bearer {{secrets.BANK_PORTAL_TOKEN}}" }
}
}The value is filled in when the step runs. See Variable references for the other references.
Errors
| Status | Code | Cause |
|---|---|---|
400 | ZodError in error.name | Invalid key format, empty or too long value |
401 | UNAUTHORIZED | Missing or invalid API key |
403 | FORBIDDEN | Key lacks the scope |
404 | NOT_FOUND | Workflow or secret not found |
409 | CONFLICT | The key already exists |
Connections API
List the connections of your company and check their status with the Connections API, with the parameters and responses for each endpoint.
Agents API
Create and run agents with the Agents API, with the parameters, request bodies and responses of each endpoint and the scopes they require.
Loopfour