Start

JSON API.

Post JSON from your registered origin and read the response codes.

JSON API

JavaScript clients can post JSON instead of a plain form. The endpoint pins CORS to the exact origin you registered and answers preflight requests itself.

Posting#

js
const response = await fetch("https://forms.shibumistack.dev/f/<public-id>", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email: "[email protected]", topics: ["one", "two"] }),
});
// 202 { "ok": true } on success

Values must be strings or arrays of strings. The same field limits apply as for HTML posts.

Responses#

StatusMeaning
202Stored. Body is { "ok": true }.
400Invalid field name, value, nesting, or too many fields.
403Origin missing or not your registered origin.
404Unknown or disabled endpoint.
413Request body over 64 KiB.
415Unsupported content type.
429Rate limited or the form's inbox is full.

Origin rules#

JSON posts require an Origin header matching your registered page origin exactly. Plain HTML posts work without one because the browser sends the visitor back to your page instead of reading a response.