# Convert an item to another type

> POST /boards/{boardId}/items/{itemId}/convert

Source: https://mockflow.com/developers/reference/items/convert-item

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

**curl**

```bash
curl https://api.mockflow.com/v1/boards/brd_3f9e2a/items/itm_k9/convert \
  -X POST \
  -H "Authorization: Bearer $MOCKFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "kanban",
  "keepSource": false
}'
```

**JavaScript**

```javascript
const response = await fetch("https://api.mockflow.com/v1/boards/brd_3f9e2a/items/itm_k9/convert", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOCKFLOW_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "to": "kanban",
  "keepSource": false
})
});

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

**Python**

```python
import os, requests

response = requests.post(
    "https://api.mockflow.com/v1/boards/brd_3f9e2a/items/itm_k9/convert",
    headers={"Authorization": f"Bearer {os.environ['MOCKFLOW_API_KEY']}"},
    json={
  "to": "kanban",
  "keepSource": False
},
)

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

**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 rebuilds the item's content as the target type and, once the new item has landed, deletes the source unless `keepSource` is true. See `convertibleTo` on GET /item-types/{type} for sensible targets.

### 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/), or use an [OAuth app](/developers/concepts/oauth-apps) to act for other people; what each scope unlocks is on the [scopes page](/developers/concepts/scopes).

### Path parameters

- `boardId` (string, required)
- `itemId` (string, required)

### Body

- `callbackUrl` (string): Optional. When the job this request starts finishes or fails, a short body is POSTed here once: `{ eventId, status, boardId, boardUrl, imageUrl }`, where status is `succeeded` or `failed` and imageUrl is a picture of what the job drew, or null. Signed with the workspace's callback secret (GET /webhooks/callback-secret). https to a public host. The full job is on GET /jobs/{jobId}.
- `to` (enum<string>, required): Item types, generated from the MockFlow component registry. Primitive types are drawn by the editor; frame types are rich components whose `data` schema is the same one the MCP `render_*` tool accepts.
- `keepSource` (boolean): Defaults to `false`.

### Response

- `id` (string)
- `kind` (enum<string>): One of `item.create`, `item.update`, `item.delete`, `item.batch`, `ai.generate`, `ai.modify`, `skill.apply` or `board.export`.
- `status` (enum<string>): One of `queued`, `running`, `succeeded` or `failed`.
- `progress` (integer)
- `message` (string): Human readable progress, for example "Placing kanban".
- `result` (object | null): - `itemIds` (string[])
  - `updated` (string[])
  - `deleted` (string[])
  - `creditsUsed` (integer)
  - `boardTitle` (string | null)
  - `skill` (string | null)
  - `convertedFrom` (string)
  - `sourceDeleted` (boolean)
  - `target` (enum<string>): board.export. What was drawn. One of `board`, `frame` or `item`.
  - `format` (enum<string>): board.export. One of `png`.
  - `scale` (enum<integer>): board.export. One of `1` or `2`.
  - `imageUrl` (string): board.export. The PNG. Anyone with this URL can open it.
  - `width` (integer): board.export. The image's width in pixels.
  - `height` (integer): board.export. The image's height in pixels.
- `error` (error): - `code` (enum<string>, required): One of `unauthorized`, `forbidden`, `not_found`, `validation_failed`, `conflict`, `plan_limit`, `rate_limited` or `internal`.
  - `message` (string, required)
  - `details` (object[])
  - `docsUrl` (string)
  - `upgradeUrl` (string)
- `createdAt` (string)
- `finishedAt` (string | null)
- `callbackUrl` (string | null): Where the job's result is POSTed
- `callback` (object | null): The newest delivery to callbackUrl, once the job has finished. Null until then, and when there is no callbackUrl.
    - `url` (string)
  - `deliveryId` (string)
  - `status` (enum<string>): One of `pending`, `retrying`, `succeeded`, `failed` or `cancelled`.
  - `attempts` (integer)
  - `responseStatus` (integer | null)
  - `error` (string | null)
  - `deliveredAt` (string | null)
  - `nextRetryAt` (string | null)

### Errors

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