---
title: "Send a form entry (public)"
method: POST
path: "/public/collections/{name}/documents"
tags: ["Data"]
---

# Send a form entry (public)

`POST /public/collections/{name}/documents`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/public/collections/{name}/documents`
- Auth: API key in query parameter `token`

Called from a form on a website by form.js (<script src="https://api.hypamoon.com/form.js" defer></script>); you rarely call it yourself. Needs the project's public token in ?token= (the same token as the chat widget, from POST /chat-tokens), an Origin header in its allowed_origins, a collection with access.public_write, and always a bot token from GET /public/challenge in turnstile_token. Limits: 30 entries per hour per IP address and 500 per day per collection. The response contains the id and created_at, never the data. If the honeypot is filled in, the response is the same but nothing is stored. The collection's triggers fire as they do for the API.

## Path parameters

- `name` string, required

## Request body

- PublicDocumentInput: A document from a form on a website.
  - `data` object, required: The fields of the form as a JSON object, like { "name": "Anna", "email": "anna@example.com", "message": "..." }.
  - `turnstile_token` string: The bot-check token from the challenge frame (GET /public/challenge). Required; form.js does this for you.
  - `honeypot` string: The value of a hidden field that people leave empty. When it is filled in, the answer is 201 but nothing is stored.

## Response `201`

Stored.

- PublicDocumentCreated: A form entry was stored. The data is not sent back.
  - `id` string, uuid, required: The id of the new document.
  - `created_at` string, date-time, required: When it was stored.
  - `test` boolean, required: true when the public token is a test token: stored, but no email is sent.

## Other responses

- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: invalid_chat_token, chat_token_revoked.
- `402`: Payment Required: plan_limit_reached.
- `403`: Forbidden: origin_not_allowed, collection_not_public, turnstile_failed.
- `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: chat_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)
