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

# Add Document

> This endpoint generates and stores a Document(embedding) with the inputted data.

### 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">
  Identifier for your embedding. Must be between 3 - 256 chars and consist of
  numbers, letters, or `-`. If not provided, a random ID will be generated.
</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">
  Additional metadata for the document.
</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 be embedded",
      "id": "my-unique-id",
      "metadata": {
        "fieldA": "my custom value",
        "fieldB": "my other custom value"
      }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {

    "data": {
      "id": "my-unique-id",
      "text": "text that will be embedded",
      "createdAt": "2023-03-17T17:21:13.163Z",
      "metadata": {
        "fieldA": "my custom value",
        "fieldB": "my other custom value"

        }
    }

  }
  ```
</ResponseExample>
