> ## 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'
~~~
~~~python Python theme={null}
import requests
agent_id = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3"
version_id = "9c59b2df-5d5f-4c9e-a070-9ac3c2b1b24e"
response = requests.post(
f"https://api-prod.usefini.com/v2/bots/{agent_id}/hc-prompt/versions/{version_id}/publish/public",
headers={"Authorization": "Bearer fini_your_api_key"},
)
published_version = response.json()
~~~
~~~javascript Node.js theme={null}
const agentId = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3";
const versionId = "9c59b2df-5d5f-4c9e-a070-9ac3c2b1b24e";
const response = await fetch(
`https://api-prod.usefini.com/v2/bots/${agentId}/hc-prompt/versions/${versionId}/publish/public`,
{
method: "POST",
headers: {
Authorization: "Bearer fini_your_api_key",
},
}
);
const publishedVersion = await response.json();
~~~
</RequestExample>
<ResponseExample>
~~~json 200 OK theme={null}
{
"id": "9c59b2df-5d5f-4c9e-a070-9ac3c2b1b24e",
"promptId": "a6d8c1df-df4c-4307-8c0f-41f7ac0c2ca7",
"botId": "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3",
"versionNumber": 12,
"status": "PUBLISHED",
"publishedAt": "2026-08-01T09:14:00.000Z"
}
~~~
</ResponseExample>
## 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>
## Related topics
- [Overview](/en/api-reference/prompts.md)
- [Delete prompt draft version](/en/api-reference/delete-prompt-draft-version.md)
- [Create prompt draft version](/en/api-reference/create-prompt-draft-version.md)
This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.
Prompts

