# Start a workflow draft

Creates a workflow as a DRAFT. It is deliberately NOT validated and it never runs — nothing executes until `post_workflows_id_publish` freezes it as a version, so saving a half-written rule here is safe and expected. Body: `name`, optional `description`, optional `key` (unique per workspace — a second one is a 409) and `definition` as {trigger, steps}, whose vocabulary comes from `get_workflows_catalog`. To find out whether what you wrote would run, `post_workflows_validate`.

Access class: `workspace:admin`.

## Endpoint

`POST /v1/workflows`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "definition": "string",
    "description": "string",
    "key": "string",
    "name": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "createdAt": "string",
    "createdByUserId": 1,
    "definition": "string",
    "description": "string",
    "id": 1,
    "key": "string",
    "name": "string",
    "publishedAt": "string",
    "runAsAccountId": "",
    "status": "string",
    "updatedAt": "string",
    "version": 1
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
