🧬 Embedding Documents
Add Document
This endpoint generates and stores a Document(embedding) with the inputted data.
POST
/
v1
/
index
Header
Body
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"
}
}'
{
"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"
}
}
}
Auth Headers
x-metal-api-key
string
requiredAn API key for your org.
x-metal-client-id
string
requiredA Client ID for your org.
Body
index
string
requiredIndex ID
id
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.
text
string
Text to be embedded. Must be between 3 - 10,000 chars.
imageUrl
string
Image URL
embedding
number[]
Custom Embeddings
metadata
object
Additional metadata for the document.
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"
}
}'
{
"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"
}
}
}