> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keywordsai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Update log

You may want to update logs to add more information or correct the existing information. In order to protect the integrity of the logs, you can only update specific fields.

## Updatable fields

The following fields can be updated:

* **`metadata`** - Custom metadata properties
* **`note`** - Log notes
* **`positive_feedback`** - User feedback indicator
* **`custom_identifier`** - Custom identifier

<Note>
  ### Core log data is immutable

  Fields like `input`, `output`, `log_type`, `model`, `usage`, `cost`, `latency`, and other telemetry fields cannot be modified to maintain data integrity.

  For `log_type` specifications, see [log types](/get-started/observability_data_model#log-types).
</Note>

## Body parameters

<ParamField path="unique_id" type="string">
  You can get a log's `unique_id` from the [Logs list endpoint](/api-endpoints/observe/logs/list). Then pass this `unique_id` to update the log.

  ```json theme={"system"}
  {
      "unique_id": "xxxxxx"
  }
  ```
</ParamField>

<ParamField path="metadata" type="dict">
  You can update the log's metadata with this parameter.

  <Accordion title="Example">
    ```json theme={"system"}
    {
      "metadata": {
        "metadata_key": "updated_value"
      }
    }
    ```
  </Accordion>
</ParamField>

<ParamField path="note" type="string">
  You can also update a log's note

  <Accordion title="Example">
    ```json theme={"system"}
    {
        "note": "updated note"
    }
    ```
  </Accordion>
</ParamField>

<ParamField path="positive_feedback" type="boolean">
  Update the log's positive\_feedback field.

  <Accordion title="Example">
    ```json theme={"system"}
    {
        "positive_feedback": true
    }
    ```
  </Accordion>
</ParamField>

<RequestExample>
  ```python Python theme={"system"}
  import requests

  url = "https://api.keywordsai.co/api/request-logs/batch-update/"
  api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
  data = {
      "logs": [
          {   "unique_id": "xxxxxx",
              "metadata": {
                  "metadata_key": "updated_value"
              },
              "note": "updated note"
          }
          # other logs to update
      ]
  }
  headers = {
      "Authorization": f"Bearer {api_key}",
      "Content-Type": "application/json"
  }

  response = requests.patch(url, headers=headers, json=data)
  print(response.json())
  ```

  ```typescript TypeScript theme={"system"}
  // Define the function with TypeScript
  fetch("https://api.keywordsai.co/api/request-logs/batch-update/", {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer Your_Keywords_AI_API_Key '
    },
      body: JSON.stringify({
          logs: [
              {   unique_id: "xxxxxx",
                  metadata: {
                      metadata_key: "updated_value"
                  },
                  note: "updated note"
              }
              // other logs to update
          ]
      })
  })
  .then(response => response.json())
  .then(data => console.log(data));
  ```
</RequestExample>
