---
title: "Upsert documents"
method: POST
path: "/v1/namespaces/{namespace}/documents"
tags: ["Documents"]
---

# Upsert documents

`POST /v1/namespaces/{namespace}/documents`

Upserts documents to a namespace. Creates the namespace if it doesn't exist. Accepts up to 10,000 documents per request with a 256 MB body limit.

## Request body

- UpsertDocumentsRequest
  - `documents` Document[], required
    - `id` string, required — Document ID. UUID or string up to 64 characters.
  - `schema` NamespaceAttributesSchema — Maps attribute names to their configuration.

## Response `200`

Successful response

- UpsertDocumentsResponse
  - `documents_upserted` integer, required

## Other responses

- `400` — The request was invalid.
- `401` — Missing or invalid API key.

---

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