Esc
ZeroIndex
GuidesAPI referenceSDKsChangelogOverviewBuy ZeroIndex

Create an index

View as MarkdownThe page as plain text

Create an empty index and choose its primary key before any documents arrive.

POST/v1/indexes

You only need this endpoint to set the primary key up front. Adding documents to an index that does not exist creates it for you. Requires an admin key.

Body

uidstringrequired

The name of the index. Lowercase letters, numbers, hyphens and underscores, up to 64 characters.

primaryKeystringdefault id

The field that uniquely identifies each document. It cannot be changed once the index has documents.

Errors

index_already_exists409

An index with this uid already exists.

invalid_request400

The uid has characters that are not allowed.

Request

curl https://api.zeroindex.test/v1/indexes \
  -H "Authorization: Bearer $ZEROINDEX_KEY" \
  -d '{ "uid": "products", "primaryKey": "id" }'
const task = await client.createIndex("products", { primaryKey: "id" });
task = client.create_index("products", primary_key="id")

Response

202
{
  "taskUid": 8790,
  "indexUid": "products",
  "status": "enqueued",
  "type": "indexCreation",
  "enqueuedAt": "2026-10-12T08:01:12Z"
}