> ## 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.

# Create prompt draft version

> Create a draft prompt version for one agent without publishing it.

Creates a draft prompt version for one agent and returns the stored draft version. Unlike [Update prompts](/en/api-reference/update-prompts), this route stores a version with `status: "DRAFT"`.

Use this route when you want to stage prompt changes for review before they become the active prompt.

## Headers

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

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Path parameters

<ParamField path="id" type="string" required>
  Agent ID whose prompt version you want to draft. Use [List agents](/en/api-reference/list-agents) to get the `botId`.
</ParamField>

## Body parameters

<ParamField body="hcPlanningPrompt" type="PromptSection[]" required>
  Full Planning Prompt section array. Send the complete array, not just the section you changed.
</ParamField>

<ParamField body="hcGuidelinePrompt" type="PromptSection[]" required>
  Full Main Guidelines section array.
</ParamField>

<ParamField body="hcChannelPrompt" type="PromptSection[]" required>
  Full Channel Prompt section array.
</ParamField>

<Note>
  The body uses the same section shape as [Update prompts](/en/api-reference/update-prompts). The returned object is a prompt-version row with draft metadata, not the merged template view returned by [Get prompts](/en/api-reference/get-prompts).
</Note>

## Response

Returns the created draft prompt version.

<ResponseField name="id" type="string">
  Draft prompt version ID.
</ResponseField>

<ResponseField name="promptId" type="string">
  Prompt record ID this version belongs to.
</ResponseField>

<ResponseField name="botId" type="string">
  Agent ID the draft version belongs to.
</ResponseField>

<ResponseField name="versionNumber" type="number">
  Version number assigned to the draft.
</ResponseField>

<ResponseField name="status" type="string">
  Version status. This route returns `DRAFT`.
</ResponseField>

<ResponseField name="parentVersionId" type="string | null">
  Parent version used for stale-draft detection.
</ResponseField>

<ResponseField name="publishedAt" type="datetime | null">
  Publication timestamp. Draft versions return `null`.
</ResponseField>

<ResponseField name="hcPlanningPrompt" type="PromptSection[]">
  Planning Prompt sections stored on the draft.
</ResponseField>

<ResponseField name="hcGuidelinePrompt" type="PromptSection[]">
  Main Guidelines sections stored on the draft.
</ResponseField>

<ResponseField name="hcChannelPrompt" type="PromptSection[]">
  Channel Prompt sections stored on the draft.
</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/public' \
    --header 'Authorization: Bearer fini_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
    "hcPlanningPrompt": [
      "Answer only from approved knowledge and escalate if unsure."
    ],
    "hcGuidelinePrompt": [
      "Answer only from approved knowledge and escalate if unsure."
    ],
    "hcChannelPrompt": [
      "Answer only from approved knowledge and escalate if unsure."
    ]
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api-prod.usefini.com/v2/bots/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/hc-prompt/versions/public', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer fini_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    'hcPlanningPrompt': [
      'Answer only from approved knowledge and escalate if unsure.'
    ],
    'hcGuidelinePrompt': [
      'Answer only from approved knowledge and escalate if unsure.'
    ],
    'hcChannelPrompt': [
      'Answer only from approved knowledge and escalate if unsure.'
    ]
  }
    )
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api-prod.usefini.com/v2/bots/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/hc-prompt/versions/public",
      headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
      json={
      "hcPlanningPrompt": [
          "Answer only from approved knowledge and escalate if unsure."
      ],
      "hcGuidelinePrompt": [
          "Answer only from approved knowledge and escalate if unsure."
      ],
      "hcChannelPrompt": [
          "Answer only from approved knowledge and escalate if unsure."
      ]
  },
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "id": "9c59b2df-5d5f-4c9e-a070-9ac3c2b1b24e",
    "botId": "2a1cf0f0-f35d-46ad-8e61-a15c86b2b312",
    "createdAt": "2026-07-28T08:55:32.000Z",
    "createdBy": "api",
    "hcPlanningPrompt": [
      {
        "id": "planning-main",
        "name": "Planning",
        "description": "How the agent plans an answer.",
        "enabled": true,
        "custom": true,
        "subsections": [
          {
            "id": "planning-grounding",
            "name": "Grounding",
            "prompt": "Use approved knowledge before answering.",
            "defaultPrompt": "Use retrieved knowledge before answering.",
            "useDefault": false,
            "enabled": true,
            "custom": true
          }
        ]
      }
    ],
    "hcGuidelinePrompt": [
      {
        "id": "guidelines-main",
        "name": "Main Guidelines",
        "description": "Global answer behavior.",
        "enabled": true,
        "custom": true,
        "subsections": [
          {
            "id": "guidelines-escalation",
            "name": "Escalation",
            "prompt": "Escalate billing disputes when policy is unclear.",
            "defaultPrompt": "Escalate when unsure.",
            "useDefault": false,
            "enabled": true,
            "custom": true
          }
        ]
      }
    ],
    "hcChannelPrompt": [
      {
        "id": "channel-chat",
        "name": "Chat",
        "description": "Chat-specific behavior.",
        "enabled": true,
        "custom": false,
        "subsections": [
          {
            "id": "channel-chat-style",
            "name": "Tone",
            "prompt": "Keep replies concise and grounded in approved knowledge.",
            "defaultPrompt": "Keep replies helpful and concise.",
            "useDefault": false,
            "enabled": true,
            "custom": true
          }
        ]
      }
    ]
  }
  ```
</ResponseExample>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The body is malformed, the agent ID is invalid, or the current prompt is missing the prompt ID needed to create a draft version.
  </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 the `write` scope required for this route.
  </Accordion>

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

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini failed while creating the draft prompt version.
  </Accordion>
</AccordionGroup>
