---
title: "Insert One Document"
method: POST
path: "/action/insertOne"
---

# Insert One Document

`POST /action/insertOne`

Insert a single document into a collection.

## Request body

- InsertOneRequestBody
  - `dataSource` string, required — The name of a linked MongoDB Atlas data source. This is commonly `"mongodb-atlas"` though it may be different in your App if you chose a different name when you created the data source.
  - `database` string, required — The name of a database in the specified data source.
  - `collection` string, required — The name of a collection in the specified database.
  - `document` object, required — A document to insert into the collection.

## Response `200`

Inserted

- object — The result of an insertOne operation.
  - `insertedId` string — The `_id` value of the inserted document.

## Other responses

- `400` — The request was malformed or incomplete.
- `401` — The authenticated user does not have permission to access this endpoint.

---

[API](https://skmtc.net/ferretdb/apis/ferretdb-data-api.md) · [All operations](https://skmtc.net/ferretdb/apis/ferretdb-data-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ferretdb/ferretdb-data-api/versions/6fcb7dd3fcd6/schema)
