Skip to main content
POST /{index_id}/text/upsert Converts input text into a vector using a specified embedding model and stores it in the index.

Request Body

FieldTypeRequiredDescription
idstringYesA unique identifier for the vector.
textstringYesThe input text to be converted into a vector.
modelstringYesThe name of the embedding model to use.
metadataobjectNoAdditional key-value metadata.
delete_protectionbooleanNoIf true, prevents the vector from being deleted.

Example Requests

  • cURL
  • Python SDK
  • JavaScript SDK
curl --location 'https://api.gravixlayer.com/v1/vectors/indexes/bf93acdc-dc02-4514-8a6f-292e85fc3450/text/upsert' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --data '{
    "vectors": [
      { "id": "vec_hello_001", "text": "Test1", "model": "baai/bge-large-en-v1.5", "delete_protection": true }
    ]
  }'

Response

A summary of the upsert operation, including token usage.
{
  "upserted_count": 2,
  "failed_count": 0,
  "usage": {
    "prompt_tokens": 4,
    "total_tokens": 4
  }
}
I