MobyformMobyform Docs
MobyformMobyform Docs
Homepage

Getting Started

Getting StartedCreate a FormForm Editor

Form Configuration

Field TypesConditional LogicForm SettingsTheme Customization

Publishing & Data

Publishing & SharingData Management

Features

Exams & AssessmentsTemplatesTeam CollaborationOrder FormsIntegrations

Advanced

Advanced

Guides

Guides

FAQ

FAQ

API

Use the developer API and Webhooks for custom integrations.

API

Mobyform provides a RESTful API for developers to programmatically manage forms, read data, and build custom integrations.

Requires Pro plan or above

Authentication

API Keys

  1. Go to "Settings" → "Developer"
  2. Click "Generate API Key"
  3. Copy and securely store the key

Usage

Include the API key in request headers:

Authorization: Bearer YOUR_API_KEY

Key Management

  • Create multiple API keys
  • Set permission scopes per key
  • Revoke keys at any time
  • View key usage

Main APIs

Form Management

EndpointMethodDescription
/api/formsGETList forms
/api/forms/:keyGETGet form details
/api/formsPOSTCreate a form
/api/forms/:keyPUTUpdate a form
/api/forms/:keyDELETEDelete a form

Form Data

EndpointMethodDescription
/api/forms/:key/dataGETList submission data
/api/forms/:key/data/:idGETGet single submission
/api/forms/:key/dataPOSTAdd submission data
/api/forms/:key/data/:idPUTUpdate submission data
/api/forms/:key/data/:idDELETEDelete submission data

Query Parameters

ParameterTypeDescription
pagenumberPage number
sizenumberItems per page
sortstringSort field
orderstringSort direction (asc/desc)
filterobjectFilter conditions

Webhooks

Configure Webhooks

Set up webhooks via API or the management panel:

{
  "url": "https://your-server.com/webhook",
  "events": ["form_data_add", "form_data_update", "form_data_delete"],
  "headers": {
    "X-Custom-Header": "value"
  }
}

Webhook Events

EventTrigger
form_data_addNew data submitted
form_data_updateData modified
form_data_deleteData deleted

Webhook Payload

{
  "event": "form_data_add",
  "formKey": "abc123",
  "data": {
    "id": "data_001",
    "fields": {
      "name": "John Doe",
      "email": "john@example.com"
    },
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Verifying Webhooks

Verify webhook request authenticity to ensure it comes from Mobyform:

  • Check the request source IP
  • Validate signature headers (if configured)

Rate Limits

API requests are protected by rate limits:

PlanLimit
Pro1,000 requests/month
Business10,000 requests/month
EnterpriseCustom

Exceeding the limit returns 429 Too Many Requests.

Error Handling

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad request parameters
401Unauthorized (invalid API key)
403Forbidden (insufficient permissions)
404Resource not found
429Too many requests
500Internal server error

Error Response Format

{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Description of the error"
  }
}

Code Examples

cURL — List Forms

# List all forms with pagination
curl -X GET "https://api.mobyform.com/api/forms?page=1&size=10" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

JavaScript/Node.js — Get Form Data

// Fetch submission data for a specific form
const response = await fetch(
  'https://api.mobyform.com/api/forms/abc123/data?page=1&size=20',
  {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
  }
);

const result = await response.json();
console.log(`Total submissions: ${result.total}`);
console.log('Data:', result.data);

Python — Create a Form Submission

import requests

# Submit data to a form
url = "https://api.mobyform.com/api/forms/abc123/data"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
}
payload = {
    "fields": {
        "name": "Jane Smith",
        "email": "jane@example.com",
        "feedback": "Great product!"
    }
}

response = requests.post(url, json=payload, headers=headers)
print(f"Status: {response.status_code}")
print(f"Created: {response.json()}")

Pagination

All list endpoints support pagination through page and size query parameters.

  • page — The page number to retrieve (starts from 1)
  • size — Number of items per page (default: 20, max: 100)

Example Request:

GET /api/forms?page=2&size=10

Example Response:

{
  "data": [...],
  "total": 56,
  "page": 2,
  "size": 10,
  "totalPages": 6
}

If no pagination parameters are provided, the API defaults to page=1 and size=20.

Error Codes

The API uses structured error codes in the response body to help you handle errors programmatically:

CodeNameDescription
INVALID_REQUESTInvalid RequestThe request body or parameters are malformed
AUTHENTICATION_FAILEDAuthentication FailedThe API key is missing, invalid, or expired
PERMISSION_DENIEDPermission DeniedThe API key does not have the required scope
RESOURCE_NOT_FOUNDResource Not FoundThe requested form, submission, or resource does not exist
RATE_LIMITEDRate LimitedYou have exceeded the allowed number of requests
VALIDATION_ERRORValidation ErrorThe submitted data failed field validation rules
INTERNAL_ERRORInternal ErrorAn unexpected server error occurred; try again later

Webhook Signature Verification

When you configure a webhook secret, Mobyform signs every webhook payload using HMAC-SHA256. The signature is sent in the X-Webhook-Signature header. You should verify this signature to confirm the request is authentic.

Node.js Verification

const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload, 'utf8')
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expectedSignature)
  );
}

// Usage in an Express handler
app.post('/webhook', (req, res) => {
  const signature = req.headers['x-webhook-signature'];
  const rawBody = JSON.stringify(req.body);

  if (!verifyWebhookSignature(rawBody, signature, 'YOUR_WEBHOOK_SECRET')) {
    return res.status(401).send('Invalid signature');
  }

  // Process the webhook event
  console.log('Verified event:', req.body.event);
  res.status(200).send('OK');
});

Python Verification

import hmac
import hashlib

def verify_webhook_signature(payload: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(
        secret.encode('utf-8'),
        payload,
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(expected, signature)

# Usage in a Flask handler
@app.route('/webhook', methods=['POST'])
def handle_webhook():
    signature = request.headers.get('X-Webhook-Signature', '')
    if not verify_webhook_signature(request.data, signature, 'YOUR_WEBHOOK_SECRET'):
        return 'Invalid signature', 401

    event = request.json
    print(f"Verified event: {event['event']}")
    return 'OK', 200

Best Practices

  • Secure your keys — Never expose API keys in frontend code
  • Handle errors — Implement proper error handling and retry logic
  • Respect rate limits — Control request frequency appropriately
  • Use Webhooks — Prefer webhooks for real-time notifications over polling

Next Steps

  • Custom Domain — Configure your own domain
  • Integrations — Use built-in integrations without coding

Table of Contents

API
Authentication
API Keys
Usage
Key Management
Main APIs
Form Management
Form Data
Query Parameters
Webhooks
Configure Webhooks
Webhook Events
Webhook Payload
Verifying Webhooks
Rate Limits
Error Handling
HTTP Status Codes
Error Response Format
Code Examples
cURL — List Forms
JavaScript/Node.js — Get Form Data
Python — Create a Form Submission
Pagination
Error Codes
Webhook Signature Verification
Node.js Verification
Python Verification
Best Practices
Next Steps