---
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
  - `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
  - `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

---

[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/eb39c8083035/schema)
