Skip to Content

Errors

The Formtorch API uses standard HTTP status codes and returns a consistent JSON error body.

Error format

{ "error": { "code": "form_not_found", "message": "No form with ID abc123 exists in your account.", "status": 404 } }
FieldTypeDescription
codestringMachine-readable error identifier
messagestringHuman-readable description
statusnumberHTTP status code (same as response status)

HTTP status codes

StatusMeaning
200 OKRequest succeeded
201 CreatedResource was created
204 No ContentRequest succeeded, no body returned
400 Bad RequestInvalid request parameters
401 UnauthorizedMissing or invalid API key
403 ForbiddenValid key but insufficient permissions
404 Not FoundResource does not exist
409 ConflictRequest conflicts with current state
422 Unprocessable EntityValidation failed
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorUnexpected server error

Common error codes

CodeStatusDescription
unauthorized401API key missing or invalid
forbidden403Key does not have access to this resource
form_not_found404Form ID does not exist
submission_not_found404Submission ID does not exist
validation_error422One or more fields failed validation
rate_limit_exceeded429Too many requests. See Rate Limits.
internal_error500Unexpected error on our end

Handling errors

const res = await fetch("https://api.formtorch.com/v1/forms/abc123", { headers: { Authorization: `Bearer ${process.env.FORMTORCH_API_KEY}` }, }); if (!res.ok) { const { error } = await res.json(); console.error(`[${error.code}] ${error.message}`); // handle by code }

Validation errors

For 422 responses, the error body includes a fields array with per-field details:

{ "error": { "code": "validation_error", "message": "Validation failed.", "status": 422, "fields": [ { "field": "name", "message": "Name is required." }, { "field": "email", "message": "Must be a valid email address." } ] } }
Last updated on