Loopfour
API reference

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.

ScopeEndpoints
secrets:readList
secrets:writeCreate, update, delete

The workflow must belong to your company, otherwise every endpoint returns 404.

Secret object

FieldTypeMeaning
idstring (UUID)
workflowIdstring (UUID)
keystringThe name used in {{secrets.KEY}}
maskedValuestring•••• followed by the last 4 characters when the value has 12 or more characters, otherwise •••• alone
lastUsedAtstring or nullWhen a run last read it
createdAt, updatedAtstring (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}/secrets

Returns the workflow's secrets in data, sorted by key. No values are included.

Create a secret

POST /api/v1/workflows/{workflowId}/secrets
FieldTypeRequiredMeaning
keystringYesSecret name
valuestringYesSecret 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

StatusCodeCause
400ZodError in error.nameInvalid key format, empty or too long value
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENKey lacks the scope
404NOT_FOUNDWorkflow or secret not found
409CONFLICTThe key already exists

On this page