Vector API reference

Detailed documentation on the vector API

Dapr provides an API to manage collections and to upsert, retrieve, delete, and run similarity queries over dense vectors in vector databases. For an overview of concepts and features, see the vector API overview.

All HTTP request and response bodies use the JSON mapping of the vector protobuf definitions:

  • Field names are in lowerCamelCase.
  • bytes fields, such as record payload, are base64-encoded strings.
  • Enum values are sent and returned as their names, for example DISTANCE_METRIC_COSINE.
  • 64-bit integers, such as recordCount, are returned as strings.
  • Durations, such as waitTimeout, are strings with an s suffix, for example "10s".
  • Responses include fields that hold their default value, for example "recordCount": "0", "score": 0, or an empty values array. Fields declared optional, such as record payload and metadata, are omitted when unset.
  • Unknown request fields are ignored.

Routes without a request body (get collection, list collections, and delete collection) take component-specific metadata as metadata.<key>=<value> query parameters.

Create collection

Creates a collection in the vector store.

POST http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component. See a list of all available vector components.
collectionThe name of the collection to create

Request body

FieldDescription
dimensionsThe length of every vector stored in the collection. Must be greater than 0. Required
metricThe distance metric for the collection. When omitted or DISTANCE_METRIC_UNSPECIFIED, the component’s default metric is used. A metric the component can’t provide returns INVALID_ARGUMENT. Optional
metadataComponent-specific collection settings, such as index parameters. Optional

Distance metrics

ValueDescription
DISTANCE_METRIC_UNSPECIFIEDOn create, the component’s default metric. On query, the metric configured for the collection
DISTANCE_METRIC_COSINECosine similarity. Higher scores indicate closer matches
DISTANCE_METRIC_DOT_PRODUCTDot-product similarity. Higher scores indicate closer matches
DISTANCE_METRIC_EUCLIDEANEuclidean distance. Lower scores indicate closer matches

HTTP response codes

CodeDescription
200Collection created
400Malformed request, missing dimensions, or unsupported metric
404Vector store not found
409Collection already exists
500Vector store not configured or request failed

Example

curl -X POST http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars \
  -H "Content-Type: application/json" \
  -d '{
        "dimensions": 4,
        "metric": "DISTANCE_METRIC_COSINE"
      }'

Get collection

Gets information about a collection.

GET http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection

Query parameters

ParameterDescription
metadata.<key>Component-specific request metadata. Optional

Response content

FieldDescription
collectionThe name of the collection
recordCountApproximate number of records. Vector stores that can’t supply this value efficiently return 0
dimensionsThe dimensions of the collection
metricThe effective distance metric. Always a concrete value
propertiesComponent-specific collection properties

HTTP response codes

CodeDescription
200Collection information returned
404Vector store or collection not found
500Vector store not configured or request failed

Example

curl http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars
{
  "collection": "cars",
  "recordCount": "3",
  "properties": {
    "filterableAttributes": "daprMetadata",
    "primaryKey": "id"
  },
  "dimensions": 4,
  "metric": "DISTANCE_METRIC_COSINE"
}

List collections

Lists the collections in the vector store.

GET http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component

Query parameters

ParameterDescription
metadata.<key>Component-specific request metadata. Optional

Response content

FieldDescription
collectionsThe names of the collections in the vector store

HTTP response codes

CodeDescription
200Collections returned
404Vector store not found
500Vector store not configured or request failed

Example

curl http://localhost:3500/v1.0-alpha1/vector/myvectors/collections
{
  "collections": ["cars", "products"]
}

Delete collection

Deletes a collection and all the records in it.

DELETE http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection to delete

Query parameters

ParameterDescription
metadata.<key>Component-specific request metadata. Optional

HTTP response codes

CodeDescription
200Collection deleted
404Vector store or collection not found
500Vector store not configured or request failed

When a resiliency retry policy retries the delete and a later attempt finds that the collection no longer exists, the delete succeeds, because an earlier attempt most likely deleted it. A NOT_FOUND on the first attempt is returned as is.

Example

curl -X DELETE http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars

Upsert vectors

Writes records with a keyed upsert. A record with an ID that already exists in the collection is replaced.

POST http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>/vectors

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection

Request body

FieldDescription
recordsThe records to upsert. Every record must have a non-empty id that is unique within the request. Required
optionsIndexing options that control when the request returns. Optional
metadataComponent-specific request metadata. Optional

Record

FieldDescription
idCaller-supplied record identifier, unique within the collection. Required
valuesThe dense vector, as an array of floats. Its length must equal the collection’s dimensions. Required
metadataStructured JSON object attributes that queries can filter on using the filter language. Optional
payloadBase64-encoded opaque bytes stored with the record and returned unchanged. Not filterable. Optional

Response content

FieldDescription
ackThe acknowledgement boundary the write reached. Always set on success. One of:
  • INDEX_ACK_QUEUED: the vector store accepted the write for asynchronous processing. This does not indicate that any record has been written. Also returned when the vector store reports an acknowledgement that Dapr doesn’t recognize.
  • INDEX_ACK_COMPLETED: the vector store completed the write, and failedItems contains every item-specific failure.
failedItemsItem-specific failures known when the request returns. Each item has the record id and an error with a canonical gRPC status code (code), a message, and details

An upsert with no records returns INDEX_ACK_COMPLETED without calling the vector store.

HTTP response codes

CodeDescription
200Request accepted. Check ack and failedItems for the outcome of each record
400Malformed request, empty or duplicate record ID, or invalid indexing options
404Vector store or collection not found
500Vector store not configured or request failed
504waitTimeout expired with INDEXING_WAIT_TIMEOUT_ACTION_FAIL_REQUEST

Example

curl -X POST http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars/vectors \
  -H "Content-Type: application/json" \
  -d '{
        "records": [
          {
            "id": "car-1",
            "values": [1, 0, 0, 0],
            "metadata": { "make": "tesla", "year": 2023, "dealer": { "city": "Seattle" } },
            "payload": "eyJuYW1lIjoiTW9kZWwgMyJ9"
          }
        ],
        "options": {
          "mode": "INDEXING_MODE_WAIT_FOR_COMPLETION",
          "waitTimeout": "10s",
          "onWaitTimeout": "INDEXING_WAIT_TIMEOUT_ACTION_FAIL_REQUEST"
        }
      }'
{
  "failedItems": [],
  "ack": "INDEX_ACK_COMPLETED"
}

Get vectors

Gets records by ID.

POST http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>/vectors/get

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection

Request body

FieldDescription
idsThe IDs of the records to get. Required
includeValuesWhether to return the vector values of each record. Defaults to false. Optional
metadataComponent-specific request metadata. Optional

Response content

FieldDescription
recordsThe found records, in request order. IDs that don’t exist are omitted. When includeValues isn’t true, values is an empty array

HTTP response codes

CodeDescription
200Records returned
400Malformed request
404Vector store or collection not found
500Vector store not configured or request failed

Example

curl -X POST http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars/vectors/get \
  -H "Content-Type: application/json" \
  -d '{
        "ids": ["car-1", "car-42"],
        "includeValues": true
      }'
{
  "records": [
    {
      "id": "car-1",
      "values": [1, 0, 0, 0],
      "payload": "eyJuYW1lIjoiTW9kZWwgMyJ9",
      "metadata": { "dealer": { "city": "Seattle" }, "make": "tesla", "year": 2023 }
    }
  ]
}

Delete vectors

Deletes records by ID. Deleting is a write and shares the acknowledgement model of upsert vectors. IDs that don’t exist are not an error.

POST http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>/vectors/delete

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection

Request body

FieldDescription
idsThe IDs of the records to delete. Required
optionsIndexing options that control when the request returns. Optional
metadataComponent-specific request metadata. Optional

Response content

FieldDescription
ackINDEX_ACK_QUEUED or INDEX_ACK_COMPLETED, with the same meaning as for upsert vectors. Always set on success

HTTP response codes

CodeDescription
200Deletion accepted or completed
400Malformed request or invalid indexing options
404Vector store or collection not found
500Vector store not configured or request failed
504waitTimeout expired with INDEXING_WAIT_TIMEOUT_ACTION_FAIL_REQUEST

Example

curl -X POST http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars/vectors/delete \
  -H "Content-Type: application/json" \
  -d '{
        "ids": ["car-1", "car-2"]
      }'
{
  "ack": "INDEX_ACK_QUEUED"
}

Query vectors

Finds the records closest to a query vector or to an existing record.

POST http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>/query

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection

Request body

FieldDescription
queryThe vector query. Required
metadataComponent-specific request metadata. Optional

Vector query

FieldDescription
vectorThe query vector, as an object with values. Only values is read and it must not be empty; other record fields are ignored. Exactly one of vector or byId is required
byIdThe ID of a stored record whose vector is used as the query. Exactly one of vector or byId is required
topKThe maximum number of matches to return. When 0 or omitted, the component default is used. Optional
filterA filter over record metadata written in the portable filter language. Optional
includeValuesWhether to return the vector values of each match. Defaults to false. Optional
includePayloadWhether to return the payload of each match. Defaults to false. Optional
metricThe distance metric used to interpret score and scoreThreshold. When omitted, the collection’s metric is used. A metric the component can’t evaluate for the collection returns INVALID_ARGUMENT. Optional
scoreThresholdInclusive score cutoff on the metric’s own, unnormalised scale. Matches with a score greater than or equal to this value are kept for cosine and dot product, and matches with a score less than or equal to it are kept for Euclidean. Optional

All query fields go inside query; because unknown fields are ignored, a field such as vector placed at the top level of the request body has no effect and the request is rejected for a missing query.

Filter language

Filters are JSON objects that vector components translate into their native query language. Field paths address keys of the record metadata and use dotted notation for nested keys, for example dealer.city. A field set directly to a value is an equality match, and multiple conditions in the same object are combined with a logical AND.

TypeOperators
Comparison$eq, $ne, $gt, $gte, $lt, $lte
Set$in, $nin
Existence$exists (boolean)
Logical$and, $or, $not
{
  "$or": [
    { "make": "tesla", "year": { "$gte": 2024 } },
    { "dealer.city": { "$in": ["Seattle", "Portland"] } }
  ]
}

Response content

FieldDescription
matchesThe closest records, ordered from closest to furthest. Each match has a record and a score
matches[].recordThe matching record. id is always returned and metadata is returned when the record has it. values is an empty array unless includeValues is true, and payload is returned only when includePayload is true
matches[].scoreThe unnormalised value of the effective metric
metricThe effective metric used for scores. Always a concrete value, even when the request doesn’t set metric

HTTP response codes

CodeDescription
200Query results returned
400Malformed request, missing query, neither or both of vector and byId set, empty query vector, invalid filter, or unsupported metric
404Vector store or collection not found
500Vector store not configured or request failed

Example

curl -X POST http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars/query \
  -H "Content-Type: application/json" \
  -d '{
        "query": {
          "vector": { "values": [1, 0, 0, 0] },
          "topK": 2,
          "filter": { "make": "tesla" },
          "includePayload": true,
          "scoreThreshold": 0.5
        }
      }'
{
  "matches": [
    {
      "record": {
        "id": "car-1",
        "values": [],
        "payload": "eyJuYW1lIjoiTW9kZWwgMyJ9",
        "metadata": { "dealer": { "city": "Seattle" }, "make": "tesla", "year": 2023 }
      },
      "score": 1
    }
  ],
  "metric": "DISTANCE_METRIC_COSINE"
}

Batch query vectors

Runs multiple queries against the same collection. Each query is evaluated independently and succeeds or fails on its own.

POST http://localhost:<daprPort>/v1.0-alpha1/vector/<storeName>/collections/<collection>/batch-query

URL parameters

ParameterDescription
daprPortThe Dapr port
storeNameThe name of the vector component
collectionThe name of the collection

Request body

FieldDescription
queriesThe vector queries to run, each with the same fields as the query object of a query vectors request. Every query runs against the store and collection in the URL. Required
metadataComponent-specific request metadata. Applies to every query. Optional

Response content

FieldDescription
resultsOne result per query, in request order. Each result has either a response with the same shape as the query vectors response, or an error with a canonical gRPC status code (code), a message, and details

A query that fails validation, for example one that sets neither vector nor byId or has an empty query vector, isn’t sent to the vector store. Its slot holds an INVALID_ARGUMENT error with the DAPR_VECTOR_INVALID_REQUEST reason and a google.rpc.BadRequest field violation that names the query by its position, for example queries[1] or queries[1].vector.values. The other queries still run.

Only request-wide failures, such as a missing vector store or collection, invalid credentials, or a transport error, fail the whole request.

HTTP response codes

CodeDescription
200Results returned. Check each result for a response or an error
400Malformed request
404Vector store or collection not found
500Vector store not configured or request failed

Example

curl -X POST http://localhost:3500/v1.0-alpha1/vector/myvectors/collections/cars/batch-query \
  -H "Content-Type: application/json" \
  -d '{
        "queries": [
          { "vector": { "values": [1, 0, 0, 0] }, "topK": 1 },
          { "topK": 1 },
          { "byId": "car-1", "topK": 1, "metric": "DISTANCE_METRIC_EUCLIDEAN" }
        ]
      }'

In this example, the second query sets neither vector nor byId, so Dapr rejects it without calling the vector store. The third query asks for a metric that Meilisearch doesn’t support, so the vector store reports an error in its slot. The first query returns matches:

{
  "results": [
    {
      "response": {
        "matches": [
          {
            "record": {
              "id": "car-1",
              "values": [],
              "metadata": { "dealer": { "city": "Seattle" }, "make": "tesla", "year": 2023 }
            },
            "score": 1
          }
        ],
        "metric": "DISTANCE_METRIC_COSINE"
      }
    },
    {
      "error": {
        "code": 3,
        "message": "exactly one of vector or by_id must be set",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.BadRequest",
            "fieldViolations": [
              {
                "field": "queries[1]",
                "description": "exactly one of vector or by_id must be set",
                "reason": "",
                "localizedMessage": null
              }
            ]
          },
          {
            "@type": "type.googleapis.com/google.rpc.ResourceInfo",
            "resourceType": "vector",
            "resourceName": "myvectors",
            "owner": "",
            "description": ""
          },
          {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "DAPR_VECTOR_INVALID_REQUEST",
            "domain": "dapr.io",
            "metadata": {}
          }
        ]
      }
    },
    {
      "error": {
        "code": 3,
        "message": "meilisearch only supports the cosine distance metric for user-provided embeddings",
        "details": []
      }
    }
  ]
}

Errors

Errors the Dapr runtime detects itself, such as a missing vector store or an invalid request, are returned in the standard Dapr error format with the following error codes:

Error codeHTTP statusgRPC codeDescription
ERR_VECTOR_STORE_NOT_FOUND404NOT_FOUNDThe named vector store doesn’t exist
ERR_VECTOR_STORE_NOT_CONFIGURED500FAILED_PRECONDITIONNo vector store is configured
ERR_VECTOR_INVALID_REQUEST400INVALID_ARGUMENTThe request failed validation, for example dimensions set to 0, an empty or duplicate record ID, a missing query, neither or both of vector and byId set, an empty query vector, or invalid indexing options. A google.rpc.BadRequest detail names the offending field, such as dimensions, records.id, query, query.vector.values, options, or options.wait_timeout. In a batch query, the error is returned in the failing query’s slot instead
ERR_MALFORMED_REQUEST400N/AThe HTTP request body is not valid JSON

Errors returned by the vector store, such as a missing collection, are passed through with their canonical gRPC status code and details. Over HTTP, the response body uses the canonical code name as errorCode, carries the status details in details, and the HTTP status is mapped from the code in the same way as for the search API, for example NOT_FOUND to 404, ALREADY_EXISTS to 409, UNAVAILABLE to 503, and DEADLINE_EXCEEDED to 504:

{
  "errorCode": "ALREADY_EXISTS",
  "message": "meilisearch collection \"cars\" already exists"
}

A vector store error that carries no gRPC status is reported as INTERNAL.

A write whose outcome can’t be determined, because the vector store reported a batch-level failure without saying which records were applied, carries a google.rpc.ErrorInfo detail with the INDEXING_OUTCOME_UNKNOWN reason in the dapr.io domain. Retry the request; keyed upserts and deletes are idempotent.

Resiliency

Vector store calls run under the store’s resiliency policy:

  • Retry policies can match the vector store’s canonical gRPC code with matching.gRPCStatusCodes.
  • A policy timeout is returned as DEADLINE_EXCEEDED, a cancelled request as CANCELLED, and an open circuit breaker as UNAVAILABLE.
  • ALREADY_EXISTS on a retried create collection is returned unchanged, because the collection may belong to another caller. NOT_FOUND on a retried delete collection is treated as success.
  • A write whose INDEXING_WAIT_TIMEOUT_ACTION_FAIL_REQUEST wait expired isn’t retried.

gRPC API

The vector API is also available over gRPC through the Dapr service in the Dapr runtime protos:

RPCDescription
CreateCollectionAlpha1Create a collection
GetCollectionAlpha1Get a collection
ListCollectionsAlpha1List collections
DeleteCollectionAlpha1Delete a collection
UpsertVectorsAlpha1Upsert vectors
GetVectorsAlpha1Get vectors
DeleteVectorsAlpha1Delete vectors
QueryVectorsAlpha1Query vectors
BatchQueryVectorsAlpha1Batch query vectors

Over gRPC, storeName and collection are fields of the request message and payload is sent as raw bytes.

Next steps

Last modified October 20, 2026: update docs (b07992cd2)