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

# Refine rule draft

> Regenerate a draft rule using refinement instructions.

Refines one existing draft [`Rule`](/en/api-reference/rules#rule-object) using natural-language refinement instructions.

## 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>
  Draft rule ID to refine.
</ParamField>

## Body parameters

<ParamField body="refinementInstructions" type="string" required>
  Natural-language instructions describing how the draft should change.
</ParamField>

## Response

Returns the refined draft [`Rule`](/en/api-reference/rules#rule-object).

<Note>
  Draft responses return `isDraft: true` and `botIds: []`.
</Note>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The body is malformed, or the draft can no longer be refined because its original source instructions are unavailable.
  </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="404 Not Found" icon="ghost">
    The draft rule ID does not exist in your workspace, or it is no longer a draft.
  </Accordion>

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini failed while generating or storing the refined draft.
  </Accordion>
</AccordionGroup>
