# Forms for agents > How an agent fills a Cube form: read it as Markdown or JSON, submit over HTTP or MCP, use it in a browser with WebMCP, or hand a person a prefilled link. A Cube form is one link. Anyone signed in can make one at `/forms/new` with a drag-and-drop builder (21 field types), or have their agent make it: [Make a form](https://ui.usecube.io/new.md) tells an agent how, and an agent signed in over [MCP](#mcp) publishes it and reads the answers, as its person would. A person fills the page. An agent fills the same link for its person without opening a browser, and what it sends counts at once, the same as the person's own. The examples use the early-access form, [https://ui.usecube.io/f/early-access](https://ui.usecube.io/f/early-access). ## Read the form Ask for the form's address without asking for HTML and you get Markdown: what the form is for, each field (name, type, required, description) and exactly how to submit it. ```sh curl https://ui.usecube.io/f/early-access ``` | Address | What you get | | --- | --- | | `/f/early-access` | The page for a browser (an `Accept` that names `text/html`); Markdown for anything else. `Vary: Accept`. | | `/f/early-access.md` | Always the Markdown. | | `/f/early-access.json` | The JSON Schema of the answers. | ## Submit over HTTP POST the answers as JSON to the same address. It counts at once, as if the person had pressed Submit. ```sh curl -X POST https://ui.usecube.io/f/early-access \ -H 'Content-Type: application/json' \ -d '{"answers": {"name": "Jane Doe", "email": "jane@example.com", "use": "Vendor intake forms."}}' ``` A success is `201 Created`: ```json { "id": "s_mgk2x1a4f3c9", "status": "completed", "receipt_url": "https://ui.usecube.io/s/early-access.…" } ``` `status` uses [A2A](https://a2a-protocol.org)'s task states: `completed`, the answer is in and counts. `receipt_url` is your person's own view of what was sent. A mistake is `400 Bad Request` with an `errors` list, each `{ "field", "message" }` written so a model can fix the answer and send again. `429 Too Many Requests` means wait the `Retry-After` seconds (ten submissions a minute from one address). ## Files A form can ask for a file (PDF, Word `.doc` or `.docx`, PNG, JPEG, WebP or GIF). The bytes are checked, not the name or the type you claim. At most 10 MB a file and 50 MB a submission. If the file is on the person's computer: an agent that can run commands POSTs it as multipart, so the file never passes through the agent. An agent that cannot calls `prefill_link` and gives the person the link; the person attaches the file on the page and presses Submit. A file can go in three ways; `resume` stands for the file question's name. 1. **Multipart.** Send `multipart/form-data`: the other answers as JSON in the part `answers`, each file as a part named after its question. ```sh curl -X POST https://ui.usecube.io/f/ -F 'answers={"name": "Jane Doe"}' -F 'resume=@resume.pdf' ``` 2. **Base64 in JSON.** The answer is an object. `name` and `base64` are required; `type` is optional. A `data:` prefix is accepted. Only for a small file the agent already holds (about 1 MB at most); do not read a file into the agent just to send it. ```json { "answers": { "resume": { "name": "resume.pdf", "type": "application/pdf", "base64": "JVBERi0xLjQK..." } } } ``` 3. **A link the server fetches.** The answer is `{"url": "https://..."}` (`name` optional). Only `https`, no user or password in it, and the address must be public: private, loopback, link-local and other special addresses are refused. Redirects are followed only after the same check, at most 3. 10 seconds in all, at most 10 MB read. ```json { "answers": { "resume": { "url": "https://example.com/resume.pdf" } } } ``` A file that fails comes back as a `400` error on that field (too big, not a type the form takes, not base64, the link could not be fetched). Over 50 MB in all is `413`. Files are kept for the owner only; they are never served to the public. ## MCP Two Streamable HTTP MCP servers. `https://ui.usecube.io/mcp` is for any agent, with no sign-in, and has seven tools: | Tool | What it does | | --- | --- | | `find_forms(url)` | The Cube forms on one public webpage (an iframe on `/embed/`, `data-cube-embed`, `data-cube-popup` with Cube's `embed.js`, or a plain Cube form link): `status` (`found`, `none_found`, or `could_not_check` with a `reason`), `page_url`, and up to 20 `forms` with `id`, `title`, `url`, `status` and the `source` marker. The page is fetched once (http or https on the standard ports, public addresses only, at most 3 redirects, 10 seconds, 2 MiB) and its scripts are not run; its text is never returned. | | `read_form(id)` | One form, by its ID or its Cube link: the form (`form`: its fields and the JSON Schema of its answers, as its owner wrote them), `form_revision`, `recipient` (who gets the answers), `chat_submission`, `how_to_submit` and `link_for_a_person`. A file question is answered on the page (`files`). A form that asks for a password, a government ID number, payment card or bank details, or health information comes back `web_only` (its link and why), with no answer schema: its person fills it in on the page. | | `submit_form(id, form_revision, answers, idempotency_key)` | Submits answers the person confirmed; they count at once, as the person's own, and go to the form's owner. Returns `status`, `receipt_url`, `received` and `reused`. The same `idempotency_key` with the same content returns the first result (also after a restart); with other content it is refused. A stale `form_revision` is refused. No files, no `web_only` form, and no answer that holds a card number or a Social Security number. | | `prefill_link(id, answers)` | Sends nothing. Returns `url` (the form with the answers in the link), `filled` and `tell_your_person`; also `left_out`, `needs_fixing` and `still_required` when they apply. A file and a consent box are never in the link: the person attaches and ticks them on the page. For a `web_only` form, the plain link with no answers. | | `draft_form(title, description?, fields)` | Makes a new form for the person, and stores nothing. Returns `url` (the builder with the form in the link, where the person signs in and presses Publish), `published: false`, the checked `spec`, `questions` and `tell_your_person`; also `fixed` and `defaults` when they apply. A question type Cube doesn't have is an error to fix. | | `list_templates(template_id?)` | The templates a new form can start from (`id`, `title`, `about`, how many `questions`), every question type with its settings (`question_types`), the file types and the limits. With `template_id`, that template's editable `spec`. | | `get_receipt(receipt)` | Proof that Cube received a submission, from the `receipt_url` `submit_form` gave: `status` (`completed`), the form and when. Not the answers: the receipt link shows them to the person. The receipt is the key, so no sign-in. | `https://ui.usecube.io/mcp/owner` is the form owner's: it asks for sign-in when the client connects, and has those seven, `list_forms` (the site's own forms) and the rest, which act as the person: whatever they do on their own forms' pages, their agent does here. Each touches only that person's forms: | Tool | What it does | | --- | --- | | `create_form(title, description?, fields \| template)` | Publishes a new form at once, as the person, from its questions or a template's. Returns `id`, `url` (the form's link), `agent_line` (the line to paste to an AI), `answers_url` (where its answers arrive) and `questions`; also `fixed` and `defaults` when they apply. | | `list_my_forms` | The person's forms, newest first: `id`, `title`, `url`, `agent_line` and `answers` (how many it has). | | `list_answers(id, since?, limit?, cursor?)` | One form's answers, newest first, 50 at a time unless `limit` says (up to 200), with `next_cursor` when there are more. Each has its `id`, when it came (`received`) and every question with its answer; a file with its `sha256`. | | `get_answer(id, answer_id)` | One answer in full, as its own page shows it. | | `get_answer_file(id, sha256)` | A file from an answer: its name, type and size, the file itself under 5 MB, and a link that opens it without signing in for 15 minutes. | | `export_answers(id)` | The CSV the Answers page downloads: every answer, when it came and then each question. | | `delete_answer(id, answer_id \| answer_ids)` | Delete answer, as on an answer's page: one or several, with their files, for good. What already went on to the integrations stays there. | | `update_form(id, title, description?, fields?)` | The builder's Save: the whole form again. A question sent with its `name` keeps its key and its answers; one without is new; one left out is gone. `read_form` gives the person's own form as `spec`, ready to change. The title alone renames it. | | `delete_form(id)` | Delete form: the form, its answers, their files and its integrations, for good. Its link stops working. | | `list_integrations(id)` | Where the answers go on to: `email`, `webhook` and `slack`, each `off`, `waiting` (the confirmation email is not confirmed yet), `on` or `failing`, with where it sends and when it last sent. | | `connect_integration(id, kind, address? \| url?)` | Connect, as on the Integrations tab. `email` sends the confirmation email and stays `waiting` until it is confirmed; `webhook` returns its signing `secret`, once; `slack` sends a test first and keeps the hook only if Slack takes it. | | `edit_webhook(id, url)` | A webhook's new address; its signing secret stays. | | `send_integration_test(id, kind)` | Send a test: a sample answer, and whether it went through. | | `disconnect_integration(id, kind)` | Turn off. A webhook's secret stops working. | | `get_me` | Who is signed in: the person's `email`. | | `sign_out` | Ends this connection's sign-in: its tokens stop working (OAuth revocation). | The same token opens the owner's HTTP routes too, with `Authorization: Bearer `: `GET https://ui.usecube.io/forms//answers.csv`, `GET https://ui.usecube.io/forms//files/`, `DELETE https://ui.usecube.io/forms//answer/`, `PUT`, `PATCH` or `DELETE https://ui.usecube.io/forms//form` and `POST https://ui.usecube.io/forms//destinations`. To fill forms, add the public server to Claude Code: ```sh claude mcp add --transport http cube https://ui.usecube.io/mcp ``` To manage your own forms too, add the owner's server instead, then run `/mcp` in Claude Code and choose Authenticate to sign in: ```sh claude mcp add --transport http cube https://ui.usecube.io/mcp/owner ``` Or, in any client that takes a URL: ```json { "mcpServers": { "cube": { "url": "https://ui.usecube.io/mcp" } } } ``` Signing in is OAuth 2.1, as the [MCP Authorization spec](https://modelcontextprotocol.io/specification/latest/basic/authorization) has it. `/mcp/owner` without a token answers `401` with a `WWW-Authenticate` header that names `https://ui.usecube.io/.well-known/oauth-protected-resource/mcp/owner`; that names this site as the authorization server (`https://ui.usecube.io/.well-known/oauth-authorization-server`). The client names itself with a Client ID Metadata Document (its `client_id` is an https URL serving its name and redirect URIs) or registers itself (Dynamic Client Registration), the person signs in on Cube and presses Allow, and the client trades the code, with its PKCE verifier (S256), for an access token (an hour) and a refresh token (replaced each time it is used). The scope is `forms`. ## WebMCP In a browser with [WebMCP](https://webmachinelearning.github.io/webmcp/), the page's form is a tool. It carries the declarative attributes (`toolname`, `tooldescription`, and `toolparamdescription` on each field), so an in-browser agent can fill and submit it, and when the imperative API is there (`document.modelContext`) the page also registers a `submit_form` tool. Where neither exists, nothing changes. ## A prefilled link, for a chatbot A chat assistant that cannot send requests or use MCP can still help: it gives its person a link with the answers in the fragment, each URL-encoded. ```text https://ui.usecube.io/f/early-access#name=...&email=...&use=...&website=... ``` The fragment never reaches the server. The page fills the fields from it, removes it from the address bar so it is not shared by accident, marks each answer the assistant filled (a small mark beside the question; hovering it says who filled it), and says "Filled in by your assistant" above the Submit button. The person checks the answers and presses Submit. It counts at once, like any answer; the marks are for the person checking the draft, and the owner never sees them. ## Whose answers An agent filling a form for its person is the person's hands: what it sends counts at once, exactly as if the person had typed it. The owner's Answers, the CSV, emails, Slack messages, webhooks and MCP show the answers and when they came, never whether a person or an agent typed them. The owner can delete an answer they don't want (spam, a test) from its page or with `delete_answer`. For abuse checks only, Cube keeps how each submission came in, its user agent, a salted hash of the address and any Web Bot Auth headers (`Signature-Agent`, `Signature-Input`); none of it is shown. The owner can send answers on by email, webhook or Slack; see [Receiving answers](/docs/forms/receiving-answers). ## The early-access form | Field | Type | Required | Description | | --- | --- | --- | --- | | `name` | text | yes | The person's full name. | | `email` | email address | yes | The person's email address, where Cube will write to them. | | `use` | long text | yes | What the person would use agent-native forms for, in their own words. | | `website` | web address | no | The person's or their company's website, if they have one. |