Headers
-
Content-Type string Required
Payload content-type
Value is
application/json
.
Body Required
-
uid string Required
-
primaryKey string
POST /indexes
curl \
-X POST https://example.meilisearch.com:7700/indexes \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"uid":"movies","primaryKey":"movie_id"}'
Request example
# Headers
Content-Type: application/json
# Payload
{
"uid": "movies",
"primaryKey": "movie_id"
}
Response examples (202)
{
"taskUid": 0,
"indexUid": "movies",
"status": "enqueued",
"type": "indexCreation",
"enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (400)
Index already exists
{
"message": "Index `:indexUid` already exists.",
"code": "index_already_exists",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_already_exists"
}
{
"message": "`:indexUid` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_).",
"code": "invalid_index_uid",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_index_uid"
}
Response examples (401)
{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}