---
title: "Index a document"
method: POST
path: "/collections/{collectionName}/documents"
tags: ["documents"]
---

# Index a document

`POST /collections/{collectionName}/documents`

A document to be indexed in a given collection must conform to the schema of the collection.

## Path parameters

- `collectionName` string, required

## Query parameters

- `action` 'create' | 'update' | 'upsert' | 'emplace'
- `dirty_values` 'coerce_or_reject' | 'coerce_or_drop' | 'drop' | 'reject'

## Request body

- object — Can be any key-value pair

## Response `201`

Document successfully created/indexed

- object — Can be any key-value pair

## Other responses

- `404` — Collection not found

## Changes

- **2025-10-14** `3bc6fc9b6132` — 4 info
  - added the new optional `query` request parameter `dirty_values`
  - added the new enum value `create` to the `query` request parameter `action`
  - added the new enum value `emplace` to the `query` request parameter `action`
  - added the new enum value `update` to the `query` request parameter `action`
- **2022-08-04** `6c2fe01b69bc` — 3 breaking, 1 warning
  - removed the enum value `create` from the `query` request parameter `action`
  - removed the enum value `emplace` from the `query` request parameter `action`
  - removed the enum value `update` from the `query` request parameter `action`
  - deleted the `query` request parameter `dirty_values`

[Change history](https://skmtc.dev/typesense/apis/typesense-api/changes/collections/:collectionName/documents/post.md)

---

[API](https://skmtc.dev/typesense/apis/typesense-api.md) · [All operations](https://skmtc.dev/typesense/apis/typesense-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/typesense/typesense-api/revisions/1d9b3b61638e/schema)
