For AI agents: the complete documentation index is available at /docs/llms.txt, the full documentation bundle is available at /docs/llms-full.txt, and this page is available as Markdown at /docs/recipes/server.md.

Submit from a server

Create a key in the project's API keys for the target environment. Copy the secret when it is shown. Keep it in your server's secret store. Keys only write submissions; they do not authorize management API calls.

Set these variables in your server environment. All values below are placeholders.

export FORMROOST_URL='https://forms.example.com/s/v1/production/sub_REPLACE_ME'
export FORMROOST_API_KEY='fr_production_key_REPLACE_ME.REPLACE_ME'

Omit Origin. Production requires Authorization: Bearer ... without it. The key must belong to the form's project and environment, and must not be expired or revoked. An invalid production key returns 401.

For sandbox, change the URL to /s/v1/sandbox/sub_REPLACE_ME and use a sandbox key (fr_sandbox_key_REPLACE_ME.REPLACE_ME). Sandbox permits development requests without a key. A syntactically valid sandbox key is checked when supplied.

curl

curl --fail-with-body --silent --show-error \
  --write-out '\nHTTP %{http_code}\n' \
  "$FORMROOST_URL" \
  -H "Authorization: Bearer $FORMROOST_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"email":"[email protected]","message":"Hello"}'

Node

Save as submit.mjs. Run with node submit.mjs. This uses built-in fetch.

const response = await fetch(process.env.FORMROOST_URL, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.FORMROOST_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ email: '[email protected]', message: 'Hello' }),
  signal: AbortSignal.timeout(10000),
});
if (response.status !== 201) throw new Error(`Submission failed: ${response.status}`);
console.log(response.status, (await response.json()).receiptId);

Python

Save as submit.py. Run with python3 submit.py. Only the standard library is needed.

import json
import os
import urllib.request

request = urllib.request.Request(
    os.environ['FORMROOST_URL'],
    data=json.dumps({'email': '[email protected]', 'message': 'Hello'}).encode(),
    headers={
        'Authorization': 'Bearer ' + os.environ['FORMROOST_API_KEY'],
        'Content-Type': 'application/json',
    },
    method='POST',
)
with urllib.request.urlopen(request, timeout=10) as response:
    assert response.status == 201
    print(response.status, json.load(response)['receiptId'])

Success returns 201. Production needs a published, enabled form. Match its schema and spam controls. For safe retries after a timeout, add an Idempotency-Key of 8–200 characters and reuse it with the same payload. Records last 24 hours; changed content under the same key returns 409. See errors and key rotation.