---
title: "POST /v1/projects/{projectId}/indexes"
method: POST
path: "/v1/projects/{projectId}/indexes"
tags: ["projects"]
---

# POST /v1/projects/{projectId}/indexes

`POST /v1/projects/{projectId}/indexes`

Creates the specified index. A newly created index's initial state is `CREATING`. On completion of the returned google.longrunning.Operation, the state will be `READY`. If the index already exists, the call will return an `ALREADY_EXISTS` status. During index creation, the process could result in an error, in which case the index will move to the `ERROR` state. The process can be recovered by fixing the data that caused the error, removing the index with delete, then re-creating the index with create. Indexes with a single property cannot be created.

## Path parameters

- `projectId` string, required

## Request body

- GoogleDatastoreAdminV1Index — Datastore composite index definition.
  - `projectId` string — Output only. Project ID.
  - `state` 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'DELETING' | 'ERROR' — Output only. The state of the index.
  - `properties` GoogleDatastoreAdminV1IndexedProperty[] — Required. An ordered sequence of property names and their index attributes. Requires: * A maximum of 100 properties.
    - `name` string — Required. The property name to index.
    - `direction` 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING' — Required. The indexed property's direction. Must not be DIRECTION_UNSPECIFIED.
  - `ancestor` 'ANCESTOR_MODE_UNSPECIFIED' | 'NONE' | 'ALL_ANCESTORS' — Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED.
  - `indexId` string — Output only. The resource ID of the index.
  - `kind` string — Required. The entity kind to which this index applies.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/datastore.md) · [All operations](https://skmtc.dev/google/apis/datastore/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/datastore/revisions/aef4907227b2/schema)
