Server-side submissions
Use a server key when posting submissions from your own backend, API route, worker, or script instead of directly from a visitor’s browser. Server keys are available on all plans.
If a form uses the Only these origins (list) or Only my verified domains (verified) origin mode, unauthenticated requests without an Origin header (such as curl or backend jobs) are rejected. Server keys are the supported way to submit to SubmitOwl from server-side code.
Form ID vs. server key
Section titled “Form ID vs. server key”FORM_IDis public and safe to include in HTML.- Server keys (
sk_...) are secret credentials. Keep them in server environment variables, never embed them in browser JavaScript, and never commit them to version control.
Creating and rotating keys
Section titled “Creating and rotating keys”Create and manage server keys in your form’s Setup tab in the SubmitOwl dashboard:
- One-time display: the full
sk_...key is shown only once when created. SubmitOwl stores only its SHA-256 hash and displays the first 8 characters (sk_xxxxx) for identification. - Zero-downtime rotation: each form allows at most 2 active keys at a time. To rotate a key, create a second key, update your server environment to use the new key, confirm submissions succeed, and then revoke the old key.
- Revocation: revoking a key propagates through the form cache within about 30 seconds.
Sending a server-side request
Section titled “Sending a server-side request”Send POST https://api.submitowl.com/f/FORM_ID with Authorization: Bearer SUBMITOWL_SERVER_KEY and either application/json or application/x-www-form-urlencoded.
Node.js
Section titled “Node.js”const serverKey = process.env.SUBMITOWL_SERVER_KEY;if (!serverKey) { throw new Error("SUBMITOWL_SERVER_KEY is not set");}
const response = await fetch("https://api.submitowl.com/f/FORM_ID", { method: "POST", headers: { Authorization: `Bearer ${serverKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Ada Lovelace", email: "ada@example.com", message: "Submitted from a server", }),});
const data = await response.json();
if (!response.ok) { if (data.error?.code === "invalid_key") { throw new Error("Server key is invalid or revoked"); } if (data.error?.code === "rate_limited") { const retryAfter = response.headers.get("Retry-After"); throw new Error(`Rate limited; retry after ${retryAfter ?? "a moment"}s`); } throw new Error(data.error?.message ?? `Submission failed (${response.status})`);}
console.log("Submission stored:", data.id);curl -X POST https://api.submitowl.com/f/FORM_ID \ -H "Authorization: Bearer $SUBMITOWL_SERVER_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"Ada Lovelace","email":"ada@example.com","message":"Submitted from a server"}'Backend proxy pattern (illustrative)
Section titled “Backend proxy pattern (illustrative)”If your frontend posts to your own server route before forwarding to SubmitOwl, read the server key from your backend runtime environment. The snippet below illustrates the pattern in an Astro API route and is not a complete runnable file:
// Illustrative Astro API route (e.g., src/pages/api/contact.js)export async function POST({ request }) { const payload = await request.json();
const upstream = await fetch("https://api.submitowl.com/f/FORM_ID", { method: "POST", headers: { Authorization: `Bearer ${import.meta.env.SUBMITOWL_SERVER_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify(payload), });
const data = await upstream.json(); return new Response(JSON.stringify(data), { status: upstream.status, headers: { "Content-Type": "application/json" }, });}Response format and server-mode behavior
Section titled “Response format and server-mode behavior”Authenticated server-mode requests always receive JSON responses, and _redirect (and _next) are ignored.
Success response:
{ "ok": true, "id": "01JD..." }Error response:
{ "ok": false, "error": { "code": "invalid_key", "message": "Invalid server key" }}What server mode skips and enforces
Section titled “What server mode skips and enforces”- Bypassed: origin checks, honeypot checks, and captcha verification.
- Still enforced: payload size and field limits (64 KB, 100 fields, 100-character field names), heuristic spam scoring, daily spam storage limits, monthly quota and Held behavior, and server rate limits.
- Submission metadata: submissions are recorded with
source = server. SubmitOwl does not store the submitting server’s IP hash or country because those belong to your server rather than the visitor. - Autoresponders: autoresponders are not sent for server-mode submissions.
Rate limits and errors
Section titled “Rate limits and errors”Server-key requests have dedicated burst limits:
- 120 requests per 60 seconds per IP before the key is validated.
- 120 requests per 60 seconds per form after a valid key is authenticated.
Authentication and browser-protection errors:
401 invalid_key: the server key is wrong or revoked. Invalid keys never fall back to public browser mode.400 server_key_in_browser: the request sent a server key alongside a browserOriginheader.