SupaKnock
Menu
Browse topics Forms
← Developer reference

Connect your app

Forms

Embed a form, share a public page or submit answers from your backend.

Embed a form with a div and a script, share a hosted form page, or submit from your own backend. Administrators read and review the answers on the web or iPhone. Forms have their own private inbox, separate from feedback boards.

Embed it like chat

In the form editor, enable Accept submissions and Enable website embed. Add your website’s exact origin, such as https://example.com, without a trailing slash or path. Save, then copy Embed on your website from the inbox. It works independently of the public page, without an API token or backend.

<div id="early-access"></div>
<script type="application/json" id="form-appearance">
{
  "submitText": "Count me in",
  "theme": {
    "mode": "auto",
    "radius": 14,
    "light": { "accent": "#147d50", "onAccent": "#ffffff" },
    "dark": { "accent": "#3ecf8e", "onAccent": "#092c1c" }
  }
}
</script>
<script defer src="https://YOUR_SERVER/form-widget.js"
  data-server="https://YOUR_SERVER" data-form="YOUR_FORM_UUID"
  data-target="#early-access" data-config="form-appearance"></script>

Place the div where you want the form. It fills its container and inherits your font; your site’s CSS controls its width. Appearance stays in your site’s code. Use chat’s theme.mode (auto, light, or dark) and light/dark palettes: accent, onAccent, background, surface, text, muted, and border. Colors accept #RGB or #RRGGBB. Choose readable contrast.

Other options: theme.radius (0–32 pixels), density: "compact", showTitle: false, and plain-text submitText, successTitle, or successMessage. Call SupaKnockForms.get('#early-access').setTheme('dark') from your site’s theme toggle; typed answers stay put. For manual mounting, load the script without data attributes and call SupaKnockForms.mount('#early-access', {server: 'https://YOUR_SERVER', form: 'YOUR_FORM_UUID', theme: {mode: 'light'}}). Each container mounts once; use unique IDs for multiple forms. Its controller’s destroy() removes the widget for client-side navigation.

Embeds start disabled. Up to 20 exact HTTPS origins; localhost HTTP works for development. The credential-free embed API uses GET /api/v1/embed/forms/{form_id} and POST /api/v1/embed/forms/{form_id}/submissions. Its signed two-hour ticket is bound to that form, origin and current questions. Changes or revoked access block old work. Retry the same ticket, request ID and answers; public pages and embeds share spam limits. Only admins can read answers.

Allow the installation origin in your site’s script-src, style-src and connect-src CSP directives. The stylesheet is external; no iframe or third-party cookies are used. The widget does not track visitors or store drafts. Your website’s own scripts and replay tools can still access embedded fields: mask or exclude answers from recording. Shadow DOM separates styles, not access to data. Reloading starts a new submission; email addresses are not deduplicated.

Use a public form link

Open Forms → Create form, choose a project and save your questions. Turn on Accept submissions and Enable public form page. Copy the link shown in the inbox and add it to your website. Visitors can submit without an account; answers stay admin-only. Forms are not listed in a public directory.

Public pages are off by default. Closing the form, disabling its public page or archiving the project makes the link unavailable. Only the title, description, project name and questions are public. The hosted page uses a signed two-hour ticket and same-origin submission, validation, a honeypot and rate limits. It has no analytics or session recording.

Public intake uses GET /api/v1/public/forms/{form_id} and POST /api/v1/public/forms/{form_id}/submissions. The POST needs the installation Origin, ticket, client_request_id, answers and an empty website honeypot. It returns only {"ok":true}. Reuse the same ticket, ID and answers on retry; edits invalidate old tickets. Ten new submissions per client IP and 200 per form per UTC hour, alongside general request limits. This collects unverified interest; it does not reserve a place or create an account.

Build your own website form

  1. Open Forms → Create form in your installation. Pick a project, edit the questions, and turn on Accept submissions when ready.
  2. Create a project token with only forms:submit permission in project settings. Store it on your backend.
  3. Copy the form ID from Connect your website. Send the field keys exactly as saved in the form.
POST https://YOUR_SERVER/api/v1/forms/FORM_ID/submissions
Authorization: Bearer YOUR_PROJECT_TOKEN
Content-Type: application/json

{
  "client_request_id": "0cab3813-55c2-4b73-aedc-cb872b2847cf",
  "answers": {
    "email": "person@example.com",
    "name": "Sam",
    "message": "I’d like to try the iPhone app."
  }
}

The response is 201 with a receipt containing id and created_at. Generate one request ID per submission and reuse it with the same answers after a timeout. Identical retries return the original receipt; changed answers with that ID return 409. A different request ID creates a separate submission, even for the same email.

Call this endpoint from your backend, never browser JavaScript. It rejects browser Origin and Fetch Metadata headers. Your backend handles visitor access, spam protection and rate limits. Do not put the token in a website bundle or native app.

Fields support short text (500 characters), long text (4,000), email (254) and a single choice. Up to 20 fields; all answer values are strings. Unknown keys, invalid choices and missing required answers are rejected. A form starts closed. Saving edits replaces its current definition immediately; old answer values remain, without a question history. Email is unverified contact information and does not create or link an account.

Only native administrators can create forms, read answers, set New / Reviewed / Archived, or delete answers. Project tokens only submit. Enable Form submissions separately in the iPhone notification settings; push previews contain no answers. There are no automatic follow-up emails or form webhooks in this release.

These docs describe the current source. Check your server’s /api/v1/openapi.json for the version you run.