---
title: "Replace the whole document of one Hive automation and save it as a DRAFT. Send the revision and draftVersionId you read, so a change somebody else made in Hive is never overwritten. Hive refuses and saves nothing when the new document has anything wrong with it. Going live stays a separate step a person approves."
method: POST
path: "/api/v1/tools/update_flow_document"
---

# Replace the whole document of one Hive automation and save it as a DRAFT. Send the revision and draftVersionId you read, so a change somebody else made in Hive is never overwritten. Hive refuses and saves nothing when the new document has anything wrong with it. Going live stays a separate step a person approves.

`POST /api/v1/tools/update_flow_document`

## Request

- Base URL: `https://hivepublish.com`
- URL: `https://hivepublish.com/api/v1/tools/update_flow_document`
- Auth: HTTP bearer

## Headers

- `Idempotency-Key` string, required

## Request body

- object
  - `flowId` string, required: The Hive automation to change.
  - `document` object, required: The whole new document.
  - `expectedRevision` integer, required: The revision read_flow_document returned.
  - `expectedDraftVersionId` string, required: The draftVersionId read_flow_document returned.

## Response `200`

Tool result

- ToolResult
  - `data` unknown, required
  - `meta` object, required
    - `tool` string
    - `workspaceId` string, uuid

## Other responses

- `400`: Invalid input
- `401`: Missing or invalid credential
- `403`: Missing workspace scope, role permission, or plan entitlement
- `409`: Idempotency conflict, replay, or request still in progress
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/hivepublish/apis/hive-developer-api.md) · [All operations](https://skmtc.dev/hivepublish/apis/hive-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hivepublish/apis/hive-developer-api/revisions/b440c763583e?raw)
