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

# Update Document

> This endpoint updates and replaces an existing Document(embedding).

### Auth Headers

<ParamField required header="x-metal-api-key" type="string">
  An API key for your org.
</ParamField>

<ParamField required header="x-metal-client-id" type="string">
  A Client ID for your org.
</ParamField>

### Body

<ParamField body="index" type="string" placeholder="Index ID" required>
  Index ID
</ParamField>

<ParamField body="id" type="string" placeholder="ID to update" required>
  Existing Document ID to update. Must be between 3 - 256 chars and consist of
  numbers, letters, or `-`.
</ParamField>

<ParamField body="text" type="string">
  Text to be embedded. Must be between 3 - 10,000 chars.
</ParamField>

<ParamField body="imageUrl" type="string">
  Image URL
</ParamField>

<ParamField body="embedding" type="number[]">
  Custom Embeddings
</ParamField>

<ParamField body="metadata" type="object">
  Metadata object.
</ParamField>

<RequestExample>
  ```bash Example Request theme={null}
  curl --location --request POST 'https://api.getmetal.io/v1/index' \
  --header 'Content-Type: application/json' \
  --header 'x-metal-api-key: <api-key>' \
  --header 'x-metal-client-id: <client-id>' \
  --data-raw '{
      "index": "index-id",
      "text": "text that will replace the existing document",
      "id": "id-to-update",
      "metadata": {
          "fieldA": "my custom value"
      }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "id-to-update",
    "text": "text that will replace the existing document",
    "createdAt": "2023-03-17T17:21:13.163Z",
    "metadata": {
      "fieldA": "my custom value"
    }

  }
  ```
</ResponseExample>
