In the API, polls, quizzes and boards are forms with a kind, just as they are in the app. They all live under /forms and appear in GET /forms. Classic pages aren’t in the API.
List and read forms
GET /forms lists the account’s forms, polls, quizzes and boards, newest first, without their content. Filter with kind (form, poll, quiz or board) and status, the state the forms list shows:
Status | Means |
|---|---|
live | Taking responses. |
paused | Not accepting new responses. |
scheduled | Responses open at the time set in settings. |
closed | Closed at its date or response limit. |
unpublishedChanges | Has saved changes people don’t see yet. |
draft | Has no questions yet. |
incomplete | People can’t submit responses right now. |
Archived forms are included, with archived: true. responseCount counts submitted responses.
GET /forms/{id} returns one form with its settings and its document, the form’s content. It returns the saved draft by default, or the version people see with ?version=live. title, kind and document follow the version you ask for, and everything else is the form’s. url is the public link and editUrl opens it in the editor.
Keep the revision it returns. You send it back with any change to the title or content, and with a publish.
The document
The document is the form’s content exactly as whatayarn stores it, checked by the same rules the editor uses. Whatever the editor can save, the API can save: questions and pages, logic and calculated fields, earlier answers inserted into text, design, quiz answers, results pages and thank you pages.
The quickest way to learn the format is to build a form in the editor, then read it with GET /forms/{id}. The OpenAPI document describes every field: FormDocument is the stored document and FormDocumentInput is what a request may send.
IDs belong to the server
Blocks, choice options, rules and calculated fields each have an id, and logic, earlier answers and results refer to them. You never have to make these IDs:
- On create, leave IDs out, or use your own short names so one part of the document can refer to another. The server replaces each one with its own ID and rewrites every reference to match, as using a template does.
- On update, an ID the saved draft already has is kept, so a question stays the same question and keeps its answers. Any other ID is treated as a local name and replaced.
- A reference to an ID the document doesn’t hold is refused with
validation_failedand the path to the reference.
version can be left out too. It defaults to 1.
Images must already be whatayarn uploads. There is no upload endpoint yet.
Create a form
POST /forms creates a form from a title and a document:
As with the first save in the editor, a new form is live straight away: its first version is published as it’s created. The document’s kind sets what it is. Leave it out for a form, or send poll, quiz or board. Any other kind is refused with validation_failed.
Send folderId to file it in one of your folders, or leave it out for the default folder. Send settings to change settings as it’s created. If a setting is refused, nothing is created.
The response is the new form, with its draft and the IDs the server gave it:
Change and publish a form
PATCH /forms/{id} makes every change to a form. Send any of title, document, settings, folderId, pinned, archived and publish.
A change to title or document, or publish: true, must carry the revision you last read. If the form has changed since, in the editor say, the request is refused with conflict before anything changes. Read the form again and retry, so you never overwrite someone’s edits.
Content you send is saved as a private draft. People keep seeing the live version until you publish. Here a new question joins the two from before, which keep their IDs, and the result is published:
publish: true without a document publishes the draft already saved:
A change is all or nothing. The parts apply in this order: content, settings, folder, archive, pin, publish. If any part is refused, like a Creator setting on Free or a publish the form isn’t ready for, nothing changes. The error is that part’s, and the form stays exactly as it was.
The response is the form after the change, with its draft.
Folders, pins and the archive
folderId moves a form into one of your folders. Send null or unfiled for the default folder. pinned pins or unpins it, and archived archives or restores it. An archived form can’t be pinned.
Settings
settings holds what the form’s Settings tab saves. Settings apply straight away, without publishing. A setting sent with the value it already has is left alone, so you can send back a settings object you read. See Manage form settings and Control access to your form for what each one does.
These settings need Creator. On Free, the request is refused with plan_required and the feature in feature:
Setting | Creator feature |
|---|---|
showBranding: false | branding |
collectPartialSubmissions: true | partialSubmissions |
responseRetentionDays | dataRetention |
opensAt, closesAt | closeOnLimit |
responseLimit | closeOnLimit |
oneResponsePerBrowser: true | duplicates |
slug | customLinks |
One response per browser is free on a poll. closed: true closes the form now and closed: false reopens it, on every plan. Send closed or closesAt, not both.
Some Creator behaviour is saved on any plan and applied by plan where it’s used, as in the editor: redirects after submitting, larger uploads and longer recordings. Passwords aren’t covered yet.
Delete a form
DELETE /forms/{id} deletes the form with its versions, responses, files and recordings. Deleting a board deletes its posts, comments, updates and subscribers. It can’t be undone.
List a form’s questions
GET /forms/{id}/questions lists the questions people answer, in form order. It reads the live version by default, or the draft with ?version=draft.
Each question’s id is the key its answer has in a response, and name is the label responses use. Choice and ranking questions list their options, and matrix questions their rows and columns.
How boards differ
A board goes live as it saves. Its document is what visitors see as soon as a PATCH returns, so publish does nothing for a board, and ?version=live returns the same document as the draft. A board’s publishedAt is when it first went live.
A board’s statuses, tags and post fields are in document.board. A board created without them gets the default statuses and fields. A board takes posts rather than responses, so its responseCount is null, it’s never draft, incomplete or unpublishedChanges, and the questions, responses, summary, drop-off, journeys and webhook endpoints answer wrong_kind for it. Its posts, comments, updates and subscribers have their own endpoints.