---
title: "Create a workflow secret"
method: POST
path: "/workflows/{workflowId}/secrets"
tags: ["Secrets"]
---

# Create a workflow secret

`POST /workflows/{workflowId}/secrets`

## Request

- Base URL: `https://workflow.loopfour.ai/api/v1`
- URL: `https://workflow.loopfour.ai/api/v1/workflows/{workflowId}/secrets`
- Auth: API key in header `x-api-key`

Stores a new secret for a workflow. Values are encrypted at rest.

## Path parameters

- `workflowId` string, required

## Request body

- object
  - `key` string, required: Upper snake case, starts with a letter, max 64 characters.
  - `value` string, required: Secret value, 1-8192 characters.

## Response `200`

Secret created

- object
  - `success` unknown
  - `data` Secret
    - `id` string
    - `workflowId` string
    - `key` string
    - `maskedValue` string, nullable
    - `lastUsedAt` string, date-time, nullable
    - `createdAt` string, date-time
    - `updatedAt` string, date-time

## Other responses

- `400`: Bad request — invalid parameters or request body.
- `401`: Missing or invalid API key.
- `403`: Forbidden — insufficient permissions for this resource.
- `404`: Resource not found.
- `409`: Conflict — resource already exists or state mismatch.

---

[API](https://skmtc.dev/loopfour/apis/loopfour-workflows-api.md) - [All operations](https://skmtc.dev/loopfour/apis/loopfour-workflows-api/llms.txt) - [OpenAPI document](https://skmtc.dev/loopfour/apis/loopfour-workflows-api/revisions/872822a3af00?raw)
