> ## 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 fix-review iteration

> Queue an AI-assisted fix analysis for one Fini response.

Starts a fix-review iteration for one Fini response. Fini creates or reuses the response's active review session, queues asynchronous analysis and replay, and immediately returns identifiers you can use to poll the session.

<Info>
  This endpoint needs `write` scope. Creating an iteration generates recommendations and a replay, but does not publish or apply the suggested changes.
</Info>

## 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>
  Send `application/json`.
</ParamField>

## Path parameters

<ParamField path="id" type="string" required>
  Conversation ID containing the response to review.
</ParamField>

<ParamField path="eventId" type="string" required>
  ID of the Fini response to review. The event must belong to the conversation and have a linked user event so Fini can replay it.
</ParamField>

## Body parameters

<ParamField body="feedbackNote" type="string" required>
  Description of what was wrong with the response or how it should improve. Must be non-empty and at most 2,000 characters.
</ParamField>

## Request example

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api-prod.usefini.com/v2/fix-review/interactions/0b8626b0-4cc8-4a3d-8fc2-f18ad1a4a1a8/events/f61a9a11-2c3b-4704-8f57-7078854d87cf/sessions/iterations/public' \
    --header 'Authorization: Bearer fini_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "feedbackNote": "The answer should explain the cancellation deadline before linking to Billing Settings."
    }'
  ```

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

  interaction_id = "0b8626b0-4cc8-4a3d-8fc2-f18ad1a4a1a8"
  event_id = "f61a9a11-2c3b-4704-8f57-7078854d87cf"
  response = requests.post(
      f"https://api-prod.usefini.com/v2/fix-review/interactions/{interaction_id}/events/{event_id}/sessions/iterations/public",
      headers={"Authorization": "Bearer fini_your_api_key"},
      json={
          "feedbackNote": "The answer should explain the cancellation deadline before linking to Billing Settings."
      },
  )
  job = response.json()
  ```

  ```javascript Node.js theme={null}
  const interactionId = "0b8626b0-4cc8-4a3d-8fc2-f18ad1a4a1a8";
  const eventId = "f61a9a11-2c3b-4704-8f57-7078854d87cf";

  const response = await fetch(
    `https://api-prod.usefini.com/v2/fix-review/interactions/${interactionId}/events/${eventId}/sessions/iterations/public`,
    {
      method: "POST",
      headers: {
        Authorization: "Bearer fini_your_api_key",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        feedbackNote:
          "The answer should explain the cancellation deadline before linking to Billing Settings.",
      }),
    }
  );
  const job = await response.json();
  ```
</RequestExample>

## Response

<ResponseField name="sessionId" type="string">
  Active fix-review session ID. A later iteration for the same response can reuse this session while it remains active.
</ResponseField>

<ResponseField name="iterationId" type="string">
  ID of the newly queued iteration.
</ResponseField>

<ResponseField name="backgroundJobId" type="string">
  ID of the background job processing the iteration.
</ResponseField>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "sessionId": "91d2d432-b408-4496-920d-24ad6a1b9e87",
    "iterationId": "55ce8421-3da6-49f7-af02-b0f23458437d",
    "backgroundJobId": "641482a8-a952-42d2-bceb-67ca06b79e92"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "statusCode": 400,
    "message": "A fix iteration is already running for this response",
    "error": "Bad Request"
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "statusCode": 403,
    "message": "API key does not have the required scope for this operation",
    "error": "Forbidden"
  }
  ```
</ResponseExample>

## Polling the result

The response only confirms that processing was queued. Poll [Get fix-review session](/en/api-reference/get-fix-review-session) with the returned `sessionId`, or call [Get active fix-review session](/en/api-reference/get-active-fix-review-session) for the selected response.

An iteration progresses through `queued`, `generating_changes`, and `replaying`. A terminal result is `ready`, `no_change`, or `failed`. Older ready iterations can become `superseded`, and applied iterations use `published`.

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The feedback is empty or longer than 2,000 characters, an iteration is already in progress, the event does not belong to the conversation, the event is not Fini-authored, or it has no linked user event for replay.
  </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 conversation or target event does not exist in the workspace.
  </Accordion>

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini could not create or queue the fix-review iteration.
  </Accordion>
</AccordionGroup>
