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

# Publish prompt draft version

> Publish one reviewed prompt draft version.

Publishes one exact prompt draft version and makes its three prompt arrays the
agent's active configuration.

Before calling this route, fetch the version with
[Get prompt draft version](/en/api-reference/get-prompt-draft-version), compare
it with [Get prompts](/en/api-reference/get-prompts), and obtain explicit
confirmation for that agent and version.

<Warning>
  Publishing changes live agent behavior. A draft becomes stale when the
  published prompt changes after the draft was created. Fini rejects stale
  drafts instead of overwriting the newer configuration.
</Warning>

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer token containing your Fini workspace API key. Format: `Bearer fini_...`
  The key needs `write` scope.
</ParamField>

## Path parameters

<ParamField path="id" type="string" required>
  Agent ID that owns the draft.
</ParamField>

<ParamField path="versionId" type="string" required>
  Exact reviewed draft version ID to publish.
</ParamField>

## Response

Returns the published lifecycle version.

<ResponseField name="id" type="string">
  Published lifecycle version ID. This matches `versionId`.
</ResponseField>

<ResponseField name="promptId" type="string">
  New active prompt record ID created from the draft.
</ResponseField>

<ResponseField name="botId" type="string">
  Agent ID that now uses the published prompt.
</ResponseField>

<ResponseField name="versionNumber" type="number">
  Published lifecycle version number.
</ResponseField>

<ResponseField name="status" type="string">
  Returns `PUBLISHED`.
</ResponseField>

<ResponseField name="publishedAt" type="datetime">
  Publication timestamp.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api-prod.usefini.com/v2/bots/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/hc-prompt/versions/9c59b2df-5d5f-4c9e-a070-9ac3c2b1b24e/publish/public' \
    --header 'Authorization: Bearer fini_your_api_key'
  ```
</RequestExample>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The draft is stale because a different prompt version became published
    after this draft was created.
  </Accordion>

  <Accordion title="401 Unauthorized" icon="lock">
    The API key is missing, malformed, revoked, or invalid.
  </Accordion>

  <Accordion title="403 Forbidden" icon="shield-halved">
    The API key does not include `write` scope.
  </Accordion>

  <Accordion title="404 Not Found" icon="ghost">
    The version does not exist for this agent or is not a draft.
  </Accordion>

  <Accordion title="406 Not Acceptable" icon="circle-question">
    The agent belongs to a different workspace.
  </Accordion>
</AccordionGroup>
