Skip to content
FiraForm.
Browse docs

Docs

API Reference

Authentication, conventions, roles, rate limits, and the public form submission endpoint for the FiraForm API.

FiraForm has two APIs:

  1. Dashboard API — authenticated JSON endpoints for forms, submissions, teams, sites, integrations, and usage.
  2. Public form endpoint — the unauthenticated endpoint your HTML forms and JavaScript post to.

This page covers authentication, shared conventions, and the public form endpoint. The endpoint groups live on their own pages.

Base URLs

APIBase URL
Dashboard APIhttps://a.firaform.com/api
Public form endpointhttps://a.firaform.com/api/f/{form_id}
  • There is no /v1 prefix.
  • Send Accept: application/json on every request.
  • Send Content-Type: application/json on writes (except file uploads, which use multipart/form-data).
  • Form identifiers are 21-character Nanoids, not UUIDs.

The machine-readable OpenAPI 3.1 spec is available at https://firaform.com/openapi.json. Use it to generate clients for your own code. AI agents should use the MCP server, which does not expose submission contents.

Authentication

The dashboard API uses Sanctum bearer tokens:

Authorization: Bearer 1|your-plaintext-token

Quick start

# 1. Log in and get a token
curl -X POST https://a.firaform.com/api/login \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"your-password","device_name":"my-script"}'

# 2. Use the token
curl https://a.firaform.com/api/forms \
  -H "Accept: application/json" \
  -H "Authorization: Bearer 1|your-plaintext-token"

Logging in returns the token once:

{
  "token": "1|abcdef...",
  "user": { "id": 12, "name": "Alex", "email": "[email protected]" }
}

You can also create tokens in the dashboard under Profile → API Tokens.

Tokens

  • Tokens use * abilities. There are no token scopes; access is controlled by your role in the resource’s team.
  • New tokens default to a 1-year expiry when expires_at is omitted.
  • You may choose any future date for expires_at.
  • A user can have at most 5 tokens. Additional login attempts return 429; additional token creation returns 422.
  • Tokens are shown only once, at creation. List and revoke endpoints never return the secret.
  • REST API tokens do not work with the MCP server. AI agents connect with OAuth or an MCP token from Profile → AI Agents (MCP).
  • A REST API token has full access to submission data in every team you belong to. Keep it in your own scripts and servers, and do not paste it into an AI agent.

Email verification

  • Unverified users can log in and use read endpoints.
  • Every write endpoint requires a verified email. Without it you get 403 (JSON when Accept: application/json is sent).
  • Exceptions: login, logout, and token create/revoke do not require verification.

Roles and permissions

Permissions are evaluated for the authenticated user in the team that owns the resource. current_team_id is only UI context; it never grants or blocks API access.

CapabilityOwnerAdminManagerMember
View team, forms, submissions, exports, files, stats, usageYesYesYesYes
Create formsYesYesYesNo
Edit form settings, fields, auto-replyYesYesYesNo
Manage form integrations and payment integrationsYesYesNoNo
Mark submissions not spamYesYesYesNo
Delete submissionsYesYesNoNo
Delete formsYesYesNoNo
Update team settingsYesYesNoNo
Manage members and invitationsYesYesNoNo
Grant/change/remove the admin roleYesNoNoNo
Transfer ownership or delete the teamYesNoNoNo
Manage team payment credentialsYesYesNoNo
Manage whitelist domainsYesYesYesNo

Anyone whose email matches an invitation can accept or reject it.

Pagination

List endpoints accept:

  • page (default 1)
  • per_page (default 15, capped at 100)

Paginated responses use:

{
  "data": [],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 15,
    "total": 0
  }
}

Errors

Errors use Laravel’s standard JSON shape. Send Accept: application/json.

{ "message": "This action is unauthorized." }
{
  "message": "The given data was invalid.",
  "errors": { "name": ["A form name is required."] }
}
StatusMeaning
401Missing or invalid token
403Not allowed for your role / unverified email / plan restriction
404Resource not found, or child does not belong to the route parent
422Validation error or plan/member limit hit
429Rate limit exceeded or token limit reached

Response conventions

  • A single resource is wrapped in data: {"data": {...}}.
  • Lists return data plus meta.
  • Deletes and actions return {"message": "..."}.
  • Creates return 201 with the created resource.
  • Submissions are special: a submission object already contains a data key (the submitted field values), so submission responses are not wrapped again. A single submission has top-level id, data, spam_status, etc.; lists still use {"data": [submission, ...], "meta": {...}}.

Rate limits

Dashboard API

  • /api routes: 60 requests per minute per authenticated user, or per IP for guests.
  • Login: 5 failed attempts per email + IP.
  • Exceeding a limit returns 429.

Public form endpoint

  • 30 submissions per IP, per form, per 5 minutes.
  • After that threshold, FiraForm scores the request for legitimacy (honeypot, data uniqueness, timing). Legitimate requests can continue; low-scoring requests are rejected for a few minutes.
  • A rejected request returns success: false with an errors.rate_limit message.

Endpoint index

AreaPage
Login, logout, profile, tokensThis page — Identity
Teams, members, invitations, whitelist domains, usageTeams API
Forms, settings, auto-reply, fields, form statsForms & Settings API
Submissions, export, files, payment attemptsSubmissions & Files API
Form Sites, deploys, rollback, custom domainsForm Sites API
Form integrations, payment integrations, team payment settingsIntegrations & Payments API
Public HTML/JSON submission and CAPTCHAThis page — Form submission endpoint

Identity

POST /api/login

Request:

{
  "email": "[email protected]",
  "password": "your-password",
  "device_name": "my-script"
}

device_name is optional and defaults to api. It becomes the token name.

Response 200:

{
  "token": "1|abcdef...",
  "user": { "id": 12, "name": "Alex", "email": "[email protected]" }
}

POST /api/logout

Revokes the token used for the request.

Response 200: {"message": "Logged out successfully."}

GET /api/user

Returns a safe, read-only profile. This response is not wrapped in data.

{
  "id": 12,
  "name": "Alex",
  "email": "[email protected]",
  "email_verified_at": "2026-01-10T09:00:00.000000Z",
  "current_team_id": 3,
  "teams": [
    { "id": 3, "name": "Acme", "role": "owner", "is_owner": true },
    { "id": 7, "name": "Client Team", "role": "manager", "is_owner": false }
  ]
}

password, remember_token, plan, and billing fields are never returned.

GET /api/tokens

{
  "data": [
    {
      "id": 4,
      "name": "my-script",
      "created_at": "2026-02-01T10:00:00.000000Z",
      "expires_at": "2027-02-01T10:00:00.000000Z",
      "last_used_at": null
    }
  ]
}

POST /api/tokens

{ "name": "my-script", "expires_at": "2027-06-01" }

expires_at is optional and must be a future date. Omit it for a 1-year default.

Response 201:

{
  "token": "5|plaintext-token-shown-once",
  "name": "my-script",
  "expires_at": "2027-06-01T23:59:59.000000Z"
}

DELETE /api/tokens/{token}

Revokes a token owned by the caller. Response 200: {"message": "Token revoked successfully."}


Form submission endpoint

POST /api/f/{form_id}

Submits a form. No bearer token is required.

The request must include an Origin header that matches a whitelisted domain for the form’s team, or the team must have a * domain. Browsers send Origin automatically on cross-origin POSTs.

curl -X POST https://a.firaform.com/api/f/V1StGXR8_Z5jdHi6B-myT \
  -H "Origin: https://example.com" \
  -H "Content-Type: application/json" \
  -d '{"name":"Sam","email":"[email protected]"}'

Request methods

HTML form submission

Standard HTML form with automatic redirect:

<form action="https://a.firaform.com/api/f/YOUR_FORM_ID" method="POST">
  <input type="text" name="name" required />
  <input type="email" name="email" required />
  <textarea name="message"></textarea>
  <button type="submit">Submit</button>
</form>

Content-Type: application/x-www-form-urlencoded or multipart/form-data (for files)

Response: Redirects to the success/error URL, or to FiraForm’s default page.

JSON submission

fetch('https://a.firaform.com/api/f/YOUR_FORM_ID', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'John Doe',
    email: '[email protected]',
    message: 'Hello from the API'
  })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Content-Type: application/json Accept: application/json (required for a JSON response)

File upload

const formData = new FormData();
formData.append('name', 'John Doe');
formData.append('email', '[email protected]');
formData.append('resume', fileInput.files[0]);

fetch('https://a.firaform.com/api/f/YOUR_FORM_ID', {
  method: 'POST',
  headers: { 'Accept': 'application/json' },
  body: formData
})
  .then(response => response.json())
  .then(data => console.log(data));

Content-Type: multipart/form-data (set automatically by the browser)

Request headers

HeaderRequiredDescription
OriginYesThe site submitting the form. Must match a whitelisted domain, or the team must allow *.
Content-TypeNoapplication/json, application/x-www-form-urlencoded, or multipart/form-data.
AcceptNoSet to application/json to receive a JSON response instead of a redirect.

Response formats

Success response (JSON)

Status 200:

{
  "success": true,
  "message": "Form submitted successfully"
}

Validation error response (JSON)

Status 422:

{
  "success": false,
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email field is required."],
    "name": ["The name must be at least 2 characters."]
  }
}

Field names in errors are humanized (underscores become spaces).

Domain not allowed

Status 403:

{
  "error": "Unauthorized domain",
  "origin": "example.com",
  "message": "This domain is not whitelisted for this form"
}

A missing Origin header returns 400 with {"error": "Origin header is missing"}.

Inactive form or limit errors

{
  "success": false,
  "message": "This form is currently inactive and not accepting submissions.",
  "errors": []
}

A team that has reached its monthly submission limit returns 429. A storage limit returns 403. Rate-limited submissions return 422 with errors.rate_limit.

Server error

Status 500:

{
  "success": false,
  "message": "An error occurred processing your submission"
}

HTML form redirects

When submitting without Accept: application/json, responses are HTTP redirects.

Success: redirects to your configured Success Redirect URL, or FiraForm’s default success page.

Validation error: redirects to your configured Error Redirect URL, or FiraForm’s default error page.

The redirect includes query parameters:

ParameterMeaning
statussuccess or error
messageHuman-readable message
errorsJSON-encoded validation errors (errors only)
submission_idSubmission ID (success only)
redirect_backThe referring page (default pages only)

Example error redirect:

https://yoursite.com/error?status=error&message=The+given+data+was+invalid.&errors=%7B%22email%22%3A%5B%22The+email+field+is+required.%22%5D%7D

Parse errors as JSON to display validation messages.

CAPTCHA verification

FiraForm’s built-in CAPTCHA is a slider challenge. When CAPTCHA is enabled, the widget adds two hidden fields to the form:

  • _firaform_captcha_token
  • _firaform_captcha_completion_time

Adding CAPTCHA to HTML forms

<form action="https://a.firaform.com/api/f/YOUR_FORM_ID" method="POST">
  <input type="text" name="name" required />
  <input type="email" name="email" required />

  <!-- CAPTCHA widget: injects the token fields automatically -->
  <script src="https://a.firaform.com/captcha/YOUR_FORM_ID"></script>

  <button type="submit">Submit</button>
</form>

CAPTCHA with JavaScript

For Ajax submissions, read the token fields the widget created:

const captchaToken = document.querySelector('[name="_firaform_captcha_token"]').value;
const completionTime = document.querySelector('[name="_firaform_captcha_completion_time"]').value;

fetch('https://a.firaform.com/api/f/YOUR_FORM_ID', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'John Doe',
    email: '[email protected]',
    _firaform_captcha_token: captchaToken,
    _firaform_captcha_completion_time: completionTime
  })
});

If a token is present it must be valid. Submissions without a token are still accepted so no-JS visitors can use the form, but they are logged for monitoring.

CAPTCHA error response

Status 422:

{
  "success": false,
  "message": "CAPTCHA verification failed. Please try again.",
  "errors": {
    "captcha": ["Invalid or expired CAPTCHA token."]
  }
}

CAPTCHA endpoints

These support the widget and do not require authentication:

POST /api/captcha/generate
POST /api/captcha/record-completion
POST /api/captcha/validate

You normally do not call these directly — the CAPTCHA script does.

CORS support

CORS is enabled for /api/*. The browser preflight succeeds for any origin, but the public form endpoint still enforces the team’s domain whitelist through the Origin header.

Allowed methods: all Allowed headers: all Credentials: not supported

Examples

Complete contact form

<!DOCTYPE html>
<html>
<head>
  <title>Contact Us</title>
</head>
<body>
  <h1>Contact Us</h1>
  <form action="https://a.firaform.com/api/f/YOUR_FORM_ID" method="POST">
    <label for="name">Name *</label>
    <input type="text" id="name" name="name" required>

    <label for="email">Email *</label>
    <input type="email" id="email" name="email" required>

    <label for="phone">Phone</label>
    <input type="tel" id="phone" name="phone">

    <label for="message">Message *</label>
    <textarea id="message" name="message" required></textarea>

    <!-- Honeypot for spam protection -->
    <input type="text" name="website" style="display:none" tabindex="-1">

    <!-- CAPTCHA (only if enabled for this form) -->
    <script src="https://a.firaform.com/captcha/YOUR_FORM_ID"></script>

    <button type="submit">Send Message</button>
  </form>
</body>
</html>

Ajax form with error handling

document.getElementById('contact-form').addEventListener('submit', async (e) => {
  e.preventDefault();

  const formData = new FormData(e.target);
  const data = Object.fromEntries(formData);

  try {
    const response = await fetch('https://a.firaform.com/api/f/YOUR_FORM_ID', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(data)
    });

    const result = await response.json();

    if (result.success) {
      alert('Thank you! Your message has been sent.');
      e.target.reset();
    } else {
      const errorMessages = Object.values(result.errors || {}).flat();
      alert('Please fix the following errors:\n' + errorMessages.join('\n'));
    }
  } catch (error) {
    alert('An error occurred. Please try again later.');
    console.error(error);
  }
});

curl example

curl -X POST "https://a.firaform.com/api/f/YOUR_FORM_ID" \
  -H "Origin: https://yoursite.com" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "[email protected]",
    "message": "Test submission from curl"
  }'

Best practices

  1. Always validate client-side — don’t rely solely on server validation.
  2. Use HTTPS — FiraForm only accepts HTTPS submissions in production.
  3. Configure the domain whitelist — don’t use * in production.
  4. Enable CAPTCHA — protect against spam when needed.
  5. Handle errors gracefully — display user-friendly messages.
  6. Use honeypots — add invisible fields to catch bots.
  7. Test webhooks — verify your endpoint receives data correctly. See Integrations.
  8. Monitor submissions — check the dashboard regularly for spam.