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

# Approve conversation event

> Set or clear the approval rating on an event and recalculate the conversation's resolution state.

Sets an event's approval value to thumbs up, thumbs down, or unrated. After updating the event, Fini recalculates the conversation's `resolved` value from its negatively rated Fini responses.

## 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 event.
</ParamField>

## Body parameters

<ParamField body="eventId" type="string" required>
  ID of the event to update. The event must belong to the conversation and workspace.
</ParamField>

<ParamField body="approved" type="boolean | null">
  Approval value. Send `true` for thumbs up, `false` for thumbs down, or `null` to clear the rating. Include this field when changing the rating.
</ParamField>

## Request example

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api-prod.usefini.com/v2/hc-interactions/0b8626b0-4cc8-4a3d-8fc2-f18ad1a4a1a8/approve/public' \
    --header 'Authorization: Bearer fini_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "eventId": "f61a9a11-2c3b-4704-8f57-7078854d87cf",
      "approved": false
    }'
  ```

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

  conversation_id = "0b8626b0-4cc8-4a3d-8fc2-f18ad1a4a1a8"
  response = requests.post(
      f"https://api-prod.usefini.com/v2/hc-interactions/{conversation_id}/approve/public",
      headers={"Authorization": "Bearer fini_your_api_key"},
      json={
          "eventId": "f61a9a11-2c3b-4704-8f57-7078854d87cf",
          "approved": False,
      },
  )
  result = response.json()
  ```

  ```javascript Node.js theme={null}
  const conversationId = "0b8626b0-4cc8-4a3d-8fc2-f18ad1a4a1a8";

  const response = await fetch(
    `https://api-prod.usefini.com/v2/hc-interactions/${conversationId}/approve/public`,
    {
      method: "POST",
      headers: {
        Authorization: "Bearer fini_your_api_key",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        eventId: "f61a9a11-2c3b-4704-8f57-7078854d87cf",
        approved: false,
      }),
    }
  );
  const result = await response.json();
  ```
</RequestExample>

## Response

<ResponseField name="success" type="boolean">
  `true` after the event and conversation state have been updated.
</ResponseField>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "success": true
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "statusCode": 400,
    "message": ["approved must be a boolean value"],
    "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>

## Resolution recalculation

After the rating is saved, Fini examines all Fini-authored events with `approved=false`:

* no negatively rated Fini events sets the conversation's `resolved` value to `null`
* all negatively rated Fini events resolved sets it to `true`
* any unresolved negatively rated Fini event sets it to `false`

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The body fails validation. `eventId` must be a non-empty string, and `approved`, when provided, must be `true`, `false`, or `null`.
  </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="ban">
    The conversation or event is inaccessible, the conversation has no events, or the supplied event does not exist in the conversation.
  </Accordion>

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini could not load or update the requested conversation event.
  </Accordion>
</AccordionGroup>
