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

# Save and edit workflows

> Create a graph, save a draft and use version timestamps for later writes.

Build a `Flow` using the [graph structure](https://docs.man0.space/workflows/graph.md). The API workflow `id` is a UUID; node IDs are stable strings within the graph.

## Save a graph

Choose an actual entry returned by the catalog and place it on a step. This example creates a one-step saved draft:

```js theme={null}
const flow = {
  id: crypto.randomUUID(), name: 'Summarize a document',
  nodes: [{ id: 'summary', type: 'step', position: { x: 0, y: 0 },
    data: { label: 'Summarize', kind: 'model', entry: selectedModel,
      note: 'Summarize the supplied document and preserve its source links.' } }],
  edges: [], modified: new Date().toISOString()
};
const saved = await fetch(`${api}/workflows`, {
  method: 'POST', headers: { 'Content-Type': 'application/json',
    Authorization: `Bearer ${man0Token}` }, body: JSON.stringify(flow)
}).then(r => r.json());
```

The response is a `Listing`: the saved Flow plus owner, creator display fields, publication state and nullable terms. Keep its returned `modified` value.

## Update or publish

Send `If-Match: <saved.modified>` on later writes. Saving uses `POST /api/workflows`; publication uses `/api/workflows/{id}/publish`, and deletion uses `DELETE /api/workflows/{id}`.

When a write returns `409`, reload the current record and apply the intended edits to that version. Graph validation also checks unique nodes/routes, valid endpoints, matching resource kinds and acyclic connections.

## Current Canvas versus saved drafts

`GET`, `PUT` and `DELETE /api/draft` manage the current work in progress. `/api/workflows` manages saved drafts and published workflows. To test a supplied unsaved graph, send it as `flow` to `/api/draft/run` with the [run input and payment headers](https://docs.man0.space/developer/streaming.md).

You can also POST `{ prompt, flow, history }` to `/api/vibe` and apply its graph patches before saving. See [Vibe’s agent](https://docs.man0.space/workflows/vibe.md) for the builder’s tools and event order.


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