Skip to content

Vector Operations API

Note: To add vectors to the database, use the Transactions API. The endpoints below are for querying and retrieving vectors only.

Query Vectors by DocumentId

Retrieves all vectors associated with a specific document ID in a collection.

Endpoint: GET /vectordb/collections/{collection_id}/vectors?document_id={document_id}

URL Parameters:

ParameterTypeRequiredDescription
collection_idstringYesID of the collection containing the vectors.

Query Parameters:

ParameterTypeRequiredDescription
document_idstringYesDocument ID to query vectors for.

Response:

[
{
"id": "vector_id_1",
"document_id": "doc123",
"dense_values": [0.1, 0.2, 0.3, ...],
"sparse_values": null,
"text": "Optional text content"
},
{
"id": "vector_id_2",
"document_id": "doc123",
"dense_values": [0.4, 0.5, 0.6, ...],
"sparse_values": null,
"text": "Optional text content"
}
]

Status Codes:

CodeDescription
200Success. Returns the vectors associated with the document ID.
400Bad Request. Collection not found or other validation error.
500Server Error. Internal database or server error.

Get Vector by ID

Retrieves a specific vector by its ID.

Endpoint: GET /vectordb/collections/{collection_id}/vectors/{vector_id}

URL Parameters:

ParameterTypeRequiredDescription
collection_idstringYesID of the collection containing the vector.
vector_idstringYesID of the vector to retrieve.

Response:

{
"id": "vector_id_1",
"document_id": "doc123",
"dense_values": [0.1, 0.2, 0.3, ...],
"sparse_values": null,
"text": "Optional text content"
}

Status Codes:

CodeDescription
200Success. Returns the requested vector.
400Bad Request. Collection not found or other validation error.
404Not Found. Vector with the specified ID not found.
500Server Error. Internal database or server error.

Check Vector Existence

Checks if a vector exists in a collection without retrieving its data.

Endpoint: HEAD /vectordb/collections/{collection_id}/vectors/{vector_id}

URL Parameters:

ParameterTypeRequiredDescription
collection_idstringYesID of the collection to check.
vector_idstringYesID of the vector to check.

Response:

No response body is returned for HEAD requests.

Status Codes:

CodeDescription
200Success. The vector exists.
404Not Found. The vector does not exist.
500Server Error. Internal database or server error.