---
title: "Add a document"
method: POST
path: "/collections/{id}/documents"
tags: ["Data"]
---

# Add a document

`POST /collections/{id}/documents`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/collections/{id}/documents`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `data:write`)

Adds a JSON document of at most 64 kB to the collection; with a schema on the collection, it must match. At most 10000 documents per collection. The collection's triggers fire just as for a form: document.created if webhook_on_insert is on (including in test mode), and an email if email_on_insert is on (not in test mode).

## Path parameters

- `id` string, required

## Request body

- DocumentInput: A new document.
  - `data` object, required: The document: any JSON object, at most 64 kB.

## Response `201`

The new document.

- Document: A document in a collection.
  - `id` string, uuid, required: The id of the document.
  - `collection_id` string, uuid, required: The id of its collection.
  - `data` object, required: The document itself: a JSON object.
  - `source` 'api' | 'public', required: api: added with an API key. public: sent from a form on a website.
  - `created_at` string, date-time, required: When the document was added.
  - `updated_at` string, date-time, required: When the document last changed.
  - `test` boolean, required: true for a document of a test project. No email was sent for it.

## Other responses

- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `402`: Payment Required: plan_limit_reached.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required.
- `404`: Not Found: not_found.
- `409`: Conflict: plan_limit_reached.
- `422`: Unprocessable Content: validation_failed, schema_mismatch, document_too_large, document_limit_reached.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
