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

# Update Document History

> Updates metadata or AI-extracted results for a specific document in the history.

### Request Format

**JSON Body**

```http
PUT /api/document_history/{documentId}
Content-Type: application/json
X-API-Key: <api_key>

{
  "gpt_result": {
    "sync": false,
    "company_id": "72",
    "MasterID": "72_07AAAFC4619B2ZO_CC/06733/25-26_26-06-2025",
    ...
  }
}
```

### Path Parameters

| Parameter  | Type   | Required | Description                         |
| ---------- | ------ | -------- | ----------------------------------- |
| documentId | Number | Yes      | Unique ID of the document to update |

### Body Parameters

| Parameter   | Type   | Required | Description                                      |
| ----------- | ------ | -------- | ------------------------------------------------ |
| gpt\_result | Object | Yes      | Object containing updated AI results or metadata |

<RequestExample>
  ```bash cURL
  curl -X PUT "https://api.clevrscan.com/api/document_history/92343" \
    -H "X-API-Key: <api_key>" \
    -H "Content-Type: application/json" \
    -d '{
      "gpt_result": {
        "sync": false,
        "company_id": "72",
        "MasterID": "72_07AAAFC4619B2ZO_CC/06733/25-26_26-06-2025",
        "Action": "Create",
        "VoucherNumber": "CC / 06733 / 25-26",
        "VoucherDate": "20250626",
        "Reference": "CC / 06733 / 25-26",
        "ReferenceDate": "20250626",
        "PartyName": "E Chand Company",
        "VoucherType": "Purchase",
        "Voucher_Total": 20640,
        "DispatchThrough": "BY HAND",
        "MotorVehicleNo": "7703958865",
        "BuyerName": "E Chand Company",
        "BuyerGSTIN": "07AAAFC4619B2ZO",
        "BuyerState": "Delhi",
        "BuyerCountryName": "India",
        "BuyerGSTRegistrationType": "Regular",
        "BuyerEmail": "info@chandcompany.com",
        "BuyerMobile": "23213236, 23218581, 23216796, 23213420",
        "BuyerTallyGroup": "$$GroupSundryCreditors",
        "ConsigneeGSTIN": "07AAFCG3149J1ZI",
        "ConsigneeTallyGroup": "$$GroupSundryCreditors",
        "ConsigneeState": "Delhi",
        "ConsigneeCountryName": "India",
        "ConsigneeGSTRegistrationType": "Regular",
        "PlaceOfSupply": "Delhi",
        "IsInvoice": "Yes",
        "IsDeleted": "No",
        "InventoryEntries": [
          {
            "StockItemName": "CLAMP 6298-1 INSIZE",
            "HSNCode": "90319000",
            "Unit": "PCS.",
            "IGSTRate": 18,
            "Rate": 219.18,
            "Amount": 219.18
          },
          {
            "StockItemName": "DIGITAL INSIDE MICROMETER 3520-30 INSIZE",
            "HSNCode": "90173010",
            "Unit": "PCS.",
            "IGSTRate": 18,
            "Rate": 10542.48,
            "Amount": 10542.48
          }
        ],
        "EInvoiceDetails": [
          {
            "AckNo": "172517776958296",
            "AckDate": "20250626",
            "IRN": "3438651bb8093f564d21839cee6ac04ed3cc8d987aa50f3f347fdcff88a083fb"
          }
        ]
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Sample Response
  {
    "document_id": 92343,
    "message": "Document updated successfully",
    "updated_at": "2025-09-09T00:28:13.311518+05:30"
  }
  ```
</ResponseExample>
