# Generate items from a prompt

> POST /boards/{boardId}/ai/generate

Source: https://mockflow.com/developers/reference/ai/ai-generate

**POST** `https://api.mockflow.com/v1/boards/{boardId}/ai/generate`  
Scopes: `ai:generate`, `boards:write`

**curl**

```bash
curl https://api.mockflow.com/v1/boards/brd_3f9e2a/ai/generate \
  -X POST \
  -H "Authorization: Bearer $MOCKFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "Plan the launch of our mobile app. Timeline, kanban and a risk mind map.",
  "outputTypes": [
    "timeline",
    "kanban",
    "mindmap"
  ]
}'
```

**JavaScript**

```javascript
const response = await fetch("https://api.mockflow.com/v1/boards/brd_3f9e2a/ai/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOCKFLOW_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "prompt": "Plan the launch of our mobile app. Timeline, kanban and a risk mind map.",
  "outputTypes": [
    "timeline",
    "kanban",
    "mindmap"
  ]
})
});

const data = await response.json();
```

**Python**

```python
import os, requests

response = requests.post(
    "https://api.mockflow.com/v1/boards/brd_3f9e2a/ai/generate",
    headers={"Authorization": f"Bearer {os.environ['MOCKFLOW_API_KEY']}"},
    json={
  "prompt": "Plan the launch of our mobile app. Timeline, kanban and a risk mind map.",
  "outputTypes": [
    "timeline",
    "kanban",
    "mindmap"
  ]
},
)

response.raise_for_status()
data = response.json()
```

**200**

```json
{
  "dryRun": false,
  "estimate": {
    "items": 0,
    "credits": 0,
    "note": "string"
  },
  "credits": {
    "remaining": 0,
    "total": 0
  },
  "plan": "string",
  "canGenerate": false
}
```

**202**

```json
{
  "id": "job_7hd2",
  "kind": "item.create",
  "status": "queued",
  "progress": 0,
  "message": "Interview 5 users",
  "result": {
    "itemIds": [
      "string"
    ],
    "updated": [
      "string"
    ],
    "deleted": [
      "string"
    ],
    "creditsUsed": 0,
    "boardTitle": "Q4 Launch Planning",
    "skill": "string"
  }
}
```

**402**

```json
{
  "error": {
    "code": "plan_limit",
    "message": "AI credits exhausted. 0 of 2000 remaining this month.",
    "upgradeUrl": "https://mockflow.com/pricing"
  },
  "requestId": "req_01ja"
}
```

**429**

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests.",
    "docsUrl": "https://mockflow.com/developers/concepts/errors#rate_limited"
  },
  "requestId": "req_45d49816999bac40"
}
```

Mida turns a prompt into one or more items on the board. With one `outputTypes` entry the matching generator runs directly; with none, Mida's planner decides what to build, as it does in the editor. `skill` applies a saved skill's instructions and output type. `withImages` lets Mida generate pictures inside the result. Plus and Max only; charged in AI credits. `dryRun` returns an estimate without spending anything.

### Authorization

- `Authorization` (string, required): `Bearer <key>`. The key needs `ai:generate` and `boards:write` scopes. Create and manage keys in the [developer console](/developers/console/); what each scope unlocks is on the [scopes page](/developers/concepts/scopes).

### Path parameters

- `boardId` (string, required)

### Headers

- `Idempotency-Key` (string): A unique key per logical request. Replays within 24 hours return the original response.

### Body

- `prompt` (string, required)
- `outputTypes` (enum<string>[])
- `skill` (string): A skill id or slug from GET /skills.
- `withImages` (boolean)
- `model` (string): A text model id from the editor's model picker. Omit for Mida's default.
- `dryRun` (boolean): Defaults to `false`.

### Response

- `dryRun` (boolean)
- `estimate` (object): - `items` (integer)
  - `credits` (integer)
  - `note` (string)
- `credits` (object): - `remaining` (integer)
  - `total` (integer)
- `plan` (string)
- `canGenerate` (boolean)

### Errors

- 402 `plan_limit`: The workspace plan does not allow this, or AI credits are exhausted.
- 429 `rate_limited`: Too many requests.
