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

# Draft and publish

> Changes in the agent editor reach calls only after you click Publish.

## How it works

An agent has two versions:

* the **published** one, which every call uses: inbound calls, campaigns, the
  widget, calls from the API and from forms,
* the **draft**: what you saved in the editor and nobody has published yet.

**Save** in the editor header saves the draft. You can rework the prompt for
an hour and save every few minutes: callers keep talking to the published
version. When the draft is ready, click **Publish**. From then on new calls
use the new version. Calls already in progress finish on the old one.

While there is a draft the header shows a blue **Draft** marker. Hover over it
to see when it was saved.

## Testing the draft

A test call from the editor (**Test** → browser call, phone call or chat) uses
the draft. So you can try a change on yourself before a customer hears it.
Without a draft the test uses the published version.

## Discarding the draft

Click the arrow in the **Draft** marker and confirm **Discard draft**. Changes
nobody has published are lost, and the editor goes back to the published
version.

## What the draft covers

| In the draft (live after **Publish**) | Right away |
| - | - |
| Prompt, first message, conversation flow | The agent's name |
| Settings on the **Settings**, **Integrations**, **Voice** and **Transcriber** tabs | Assigning a phone number |
| **Variables**, **Tools** and **Knowledge**, their own save buttons included | |

Settings that change outside the editor, for example when you connect an
integration, go to the published version straight away. Publishing does not
undo them: it only changes the settings you changed in the draft.

**Publish** checks the draft again, as saving does. If the flow has errors or
a transfer to a person has no number, the panel refuses to publish and says
why.

## API

`PUT /api/v1/agents/{agent_id}` without parameters changes the published
version at once, as before. With `?draft=true` it saves into the draft, as
the editor does. `POST /api/v1/agents/{agent_id}/publish` publishes the draft,
`DELETE /api/v1/agents/{agent_id}/draft` discards it. `GET
/api/v1/agents/{agent_id}` returns `has_draft`, `draft_saved_at` and
`draft_changes`.


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