Forms API

Forms API Documentation

Complete guide to integrating with Forms API

Get API Key

Start with 100 free submissions

Quick Start

Forms API lets you collect form submissions without building backend infrastructure. Create forms, get an endpoint, and start collecting data in minutes.

1

Sign Up & Get API Key

Create your account and get your unique API key from the dashboard.

2

Create a Form

Design your form in the dashboard or use one of our templates.

3

Submit Data

Use our API to submit form data and view submissions in your dashboard.

Submit Form API

Use this endpoint to submit data to your forms. Requires a valid API key and an active subscription.

POSThttps://apiforms.com/api/forms/submit

Authentication

Include your API key in the request body. You can find your API key in your dashboard after signing up.

Headers

Content-Type: application/json

Request Body

JSON Payload

{
  "apikey": "YOUR_API_KEY",
  "formId": "YOUR_FORM_ID",
  "formData": {
    "name": "John Doe",
    "email": "john@example.com",
    "message": "Hello from Forms API!"
  }
}

Note: Replace YOUR_API_KEY and YOUR_FORM_ID with your actual values from the dashboard.

Response (Success)

200 OK

{
  "success": true,
  "remaining": 19
}

The remaining field shows how many submissions you have left in your current billing period.

Error Handling

Error Response Format

Error Examples

{
  "error": "Missing fields"
}

{
  "error": "Invalid API key"
}

{
  "error": "Active subscription required. Please upgrade your plan.",
  "code": "SUBSCRIPTION_REQUIRED"
}

{
  "error": "Monthly submission limit exceeded (20).",
  "code": "SUBSCRIPTION_LIMIT_EXCEEDED"
}

{
  "error": ["Name is required", "Email must be one of a@b.com, c@d.com"]
}

HTTP Status Codes

CodeDescription
200Success - Form submitted successfully
400Bad Request - Missing fields or validation failed
403Forbidden - Invalid API key, no access, or subscription inactive
404Not Found - Form not found
410Gone - Form is archived
429Too Many Requests - Rate limit or submission limit exceeded
500Internal Server Error - Server error

Implementation Examples

cURL

Basic cURL Request

curl -X POST https://apiforms.com/api/forms/submit \
  -H "Content-Type: application/json" \
  -d '{
    "apikey": "YOUR_API_KEY",
    "formId": "YOUR_FORM_ID",
    "formData": {
      "name": "John Doe",
      "email": "john@example.com",
      "message": "Hello from Forms API!"
    }
  }'

JavaScript (Node.js/Browser)

Using fetch()

const response = await fetch("https://apiforms.com/api/forms/submit", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    apikey: "YOUR_API_KEY",
    formId: "YOUR_FORM_ID",
    formData: {
      name: "John Doe",
      email: "john@example.com",
      message: "Hello from Forms API!"
    }
  })
});

const result = await response.json();
console.log(result);

Python

Using requests library

import requests

response = requests.post("https://apiforms.com/api/forms/submit", json={
    "apikey": "YOUR_API_KEY",
    "formId": "YOUR_FORM_ID",
    "formData": {
        "name": "John Doe",
        "email": "john@example.com",
        "message": "Hello from Forms API!"
    }
})

result = response.json()
print(result)

PHP

Using cURL in PHP

<?php
$url = 'https://apiforms.com/api/forms/submit';
$data = [
    'apikey' => 'YOUR_API_KEY',
    'formId' => 'YOUR_FORM_ID',
    'formData' => [
        'name' => 'John Doe',
        'email' => 'john@example.com',
        'message' => 'Hello from Forms API!'
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$result = json_decode($response, true);

echo json_encode($result, JSON_PRETTY_PRINT);
curl_close($ch);
?>

Need Help?

Our documentation covers the basics, but if you need help implementing Forms API or have questions about advanced features, we're here to help.