---
title: "POST /collections/{name}/indexes"
method: POST
path: "/collections/{name}/indexes"
tags: ["index"]
---

# POST /collections/{name}/indexes

`POST /collections/{name}/indexes`

Add a secondary index

## Path parameters

- `name` string, required

## Request body

- IndexAdd
  - `Fields` object[]
    - `Descending` boolean
    - `Name` string
  - `Name` string
  - `Unique` boolean

## Response `200`

Index description

- Index
  - `Fields` object[]
    - `Descending` boolean
    - `Name` string
  - `ID` integer
  - `Name` string
  - `Unique` boolean

## Other responses

- `400` — error
- `default`

## Changes

- **2026-02-24** `598f4d25a175` — 1 info
  - api operation id `index_create` removed and replaced with `index_add`
- **2025-06-02** `60812f5416c5` — 2 info
  - api operation id `new_index` removed and replaced with `index_create`
  - removed the non-success response with the status `409`

[Change history](https://skmtc.dev/sourcenetwork/apis/defradb-api/changes/collections/:name/indexes/post.md)

---

[API](https://skmtc.dev/sourcenetwork/apis/defradb-api.md) · [All operations](https://skmtc.dev/sourcenetwork/apis/defradb-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sourcenetwork/apis/defradb-api/revisions/95eb31ca3da3?raw)
