> ## 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 rule draft

> Generate a draft rule from instructions.

Generates a draft [`Rule`](/en/api-reference/rules#rule-object) from natural-language behavior instructions.

<Note>
  The dashboard-auth draft route accepts multipart uploads, but the workspace-API-key public route is JSON-only. On the public route, `behaviorInstructions` is therefore required in practice.
</Note>

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

## Body parameters

<ParamField body="behaviorInstructions" type="string" required>
  Natural-language instructions describing the workflow you want Fini to turn into a draft rule.
</ParamField>

## Response

Returns the generated 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 `behaviorInstructions` is missing. Current service behavior requires either instructions or a file, and file upload is not exposed on the public route.
  </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="500 Internal Server Error" icon="triangle-exclamation">
    Fini failed while generating or storing the draft rule.
  </Accordion>
</AccordionGroup>
