All Products
Search
Document Center

DashVector:Create a collection

Last Updated:Mar 10, 2026

Create a DashVector collection by sending a POST request with the vector dimension, distance metric, and optional predefined fields.

Prerequisites

Before you begin, make sure that you have:

Method and URL

POST https://{Endpoint}/v1/collections

Example

Replace YOUR_API_KEY and YOUR_CLUSTER_ENDPOINT with your actual values before running the request.

# Create a collection named "quickstart" with 4-dimensional vectors,
# the default FLOAT data type, the dotproduct distance metric,
# and three predefined fields: name (STRING), age (INT), weight (FLOAT).

curl -XPOST \
  -H 'dashvector-auth-token: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "quickstart",
    "dimension": 4,
    "metric": "dotproduct",
    "fields_schema": {
      "name": "STRING",
      "age": "INT",
      "weight": "FLOAT",
      "id": 1234567890
    }
  }' https://YOUR_CLUSTER_ENDPOINT/v1/collections

# example output:
# {"request_id":"19215409-ea66-4db9-8764-26ce2eb5bb99","code":0,"message":""}

Request parameters

Parameter

Location

Type

Required

Description

{Endpoint}PathstrYesThe cluster endpoint, available on the cluster details page in the console.
dashvector-auth-tokenHeaderstrYesThe API key.
nameBodystrYesThe collection name.
dimensionBodyintYesThe number of vector dimensions. Valid values: (1, 20000].
dtypeBodystrNoThe vector data type. Valid values: FLOAT (default), INT.
metricBodystrNoThe distance metric. Valid values: euclidean, dotproduct, cosine (default). If set to cosine, dtype must be FLOAT.
fields_schemaBodyobjectNoThe predefined fields and their data types. Supported data types: STRING, INT, FLOAT.
Note

For more information about the advantages of predefining fields during collection creation, see Schema-free.

Response parameters

Parameter

Type

Description

Example

codeintThe status code. 0 indicates success. For more information, see Status codes.0
messagestrThe response message.success
request_idstrThe unique request ID.19215409-ea66-4db9-8764-26ce2eb5bb99