---
title: "Create a new document in a table"
method: POST
path: "/insert"
tags: ["Index"]
---

# Create a new document in a table

`POST /insert`

Insert a document. 
Expects an object like:
 
  ```
  {
    'table':'movies',
    'id':701,
    'doc':
    {
      'title':'This is an old movie',
      'plot':'A secret team goes to North Pole',
      'year':1950,
      'rating':9.5,
      'lat':60.4,
      'lon':51.99,
      'advise':'PG-13',
      'meta':'{"keywords":{"travel","ice"},"genre":{"adventure"}}',
      'language':[2,3]
    }
  }
  ```
 
The document id can also be missing, in which case an autogenerated one will be used:
         
  ```
  {
    'table':'movies',
    'doc':
    {
      'title':'This is a new movie',
      'plot':'A secret team goes to North Pole',
      'year':2020,
      'rating':9.5,
      'lat':60.4,
      'lon':51.99,
      'advise':'PG-13',
      'meta':'{"keywords":{"travel","ice"},"genre":{"adventure"}}',
      'language':[2,3]
    }
  }
  ```
 
It responds with an object in format:
  
  ```
  {'table':'products','id':701,'created':true,'result':'created','status':201}
  ```

## Request body

- InsertDocumentRequest — Object containing data for inserting a new document into the table
  - `table` string, required — Name of the table to insert the document into
  - `cluster` string — Name of the cluster to insert the document into
  - `id` integer — Document ID. If not provided, an ID will be auto-generated
  - `doc` object, required — Object containing document data

## Response `200`

OK

- SuccessResponse — Response object indicating the success of an operation, such as inserting or updating a document
  - `table` string — Name of the document table
  - `id` integer — ID of the document affected by the request operation
  - `created` boolean — Indicates whether the document was created as a result of the operation
  - `result` string — Result of the operation, typically 'created', 'updated', or 'deleted'
  - `found` boolean — Indicates whether the document was found in the table
  - `status` integer — HTTP status code representing the result of the operation

## Other responses

- `default` — error

## Changes

- **2025-04-01** `0e6cccea382d` — 1 warning, 1 info
  - removed the optional property `_id` from the response with the `200` status
  - added the optional property `id` to the response with the `200` status
- **2025-02-13** `8f90aac993c7` — 1 breaking, 3 warning, 1 info
  - added the new required request property `table`
  - removed the request property `index`
  - removed the optional property `_index` from the response with the `200` status
  - removed the optional property `error/oneOf[#/components/schemas/responseErrorDetails]/index` from the response with the `default` status
  - …1 more
- **2024-11-14** `88a0ac494d8e` — 2 breaking, 3 warning, 3 info
  - added the new required request property `index`
  - the `id` request property format changed from `uint64` to `int64`
  - removed the request property `table`
  - removed the optional property `error/oneOf[#/components/schemas/responseErrorDetails]/table` from the response with the `default` status
  - …4 more

[Change history](https://skmtc.dev/manticoresoftware/apis/manticore-search-client/changes/insert/post.md)

---

[API](https://skmtc.dev/manticoresoftware/apis/manticore-search-client.md) · [All operations](https://skmtc.dev/manticoresoftware/apis/manticore-search-client/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/manticoresoftware/manticore-search-client/revisions/0e6cccea382d/schema)
