> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymorfa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp Flow drafts

> List, read, create, update, and delete project WhatsApp Flow drafts with a project client.

A Flow draft stores a WhatsApp Flow definition in your project. Drafts are not
published to Meta. Use a project client: `platform.project("<project-id>").flows`,
or a client created with a project credential.

| Task | Permission |
| - | - |
| List and read drafts | `sessions:read` |
| Create, update, and delete drafts | `sessions:manage` |

## List and read drafts

```typescript theme={null}
const drafts = await project.flows.list();
for (const draft of drafts.data) console.log(draft.id, draft.name, draft.status);

const draft = await project.flows.retrieve("<flow-id>");
if (draft.data === null) {
  console.log("No draft with that ID");
} else {
  console.log(draft.data.definition);
}
```

Flow methods return the draft itself in `response.data`. `list` returns
`FlowSummary` items. `retrieve` returns a `FlowDraft`, which adds the
`definition`, or `null` when the draft does not exist.

## Create a draft

```typescript theme={null}
const created = await project.flows.create({
  name: "Booking",
  definition: { version: "7.0", screens: [] },
});
console.log(created.data.id, created.data.updatedAt);
```

## Update a draft

Pass the `updatedAt` value you last read. The update fails if someone changed
the draft since then:

```typescript theme={null}
const current = await project.flows.retrieve("<flow-id>");

if (current.data) {
  await project.flows.update("<flow-id>", {
    expectedUpdatedAt: current.data.updatedAt,
    name: "Booking v2",
  });
}
```

## Delete a draft

```typescript theme={null}
await project.flows.delete("<flow-id>");
```

See [Flows](/console/flows) for building Flows in the Console. To send a
published Flow in a message, use `flow` content with
[`messages.send`](/sdks/typescript/messages#other-message-kinds).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.