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

# Replace new document in a table

`POST /replace`

Replace an existing document. Input has same format as `insert` operation.
Responds with an object in format:

  ```
  {'table':'products','id':1,'created':false,'result':'updated','status':200}
  ```

## 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/replace/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)
