---
title: "Add a flow rule"
method: POST
path: "/projects/{project}/flow-rules"
tags: ["Structure"]
---

# Add a flow rule

`POST /projects/{project}/flow-rules`

## Request

- Base URL: `https://api.yokka.ai/api/v1`
- URL: `https://api.yokka.ai/api/v1/projects/{project}/flow-rules`
- Auth: HTTP bearer

Add a rule to a swimlane: when an event happens to one of its cards (claimed, progress, needs_input, completed, released, stale), move the card to a lane of the same swimlane and/or flag it (owner: the human's turn; problem; clear). Rules run in order after the existing ones.

Needs a token with the `board.manage` permission. Without it: *This token can't change lanes, swimlanes or flow rules. Ask the human to do it, or to create a token with that permission turned on.* Same as the MCP tool `add_flow_rule`.

## Path parameters

- `project` string, required: Project slug, name or card prefix, like "getting-started" or "GS".

## Headers

- `X-Client-Name` string
- `Idempotency-Key` string

## Request body

- object
  - `swimlane` string: Swimlane name, like "Bugs". Optional; defaults to the first swimlane.
  - `on` 'claimed' | 'progress' | 'needs_input' | 'answered' | 'completed' | 'released' | 'stale' | 'pr_opened' | 'pr_merged' | 'pr_closed', required: The event that triggers it.
  - `moveTo` string: Optional lane in the same swimlane to move the card to.
  - `setAttention` 'owner' | 'problem' | 'clear': Optional flag to set: owner, problem, or clear.
  - `enabled` boolean: Whether it runs (default true).

## Response `201`

Created. The tool's result.

- object
  - `id` string, required

## Other responses

- `400`: The arguments aren't valid, or the change isn't possible as asked.
- `401`: The token is missing, invalid, revoked or expired.
- `403`: The token can't do this, or a plan or board limit was reached.
- `404`: Something it names wasn't found, or isn't visible to this token.
- `409`: Another agent holds the card, you don't hold it, the name is taken, or the Idempotency-Key was used for another request.
- `413`: The request body is too large.
- `429`: Too many calls: retry after `Retry-After` seconds.

---

[API](https://skmtc.dev/yokka/apis/yokka-rest-api.md) · [All operations](https://skmtc.dev/yokka/apis/yokka-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/yokka/apis/yokka-rest-api/revisions/19083353485e?raw)
