Skip to main content

Introduction

The FastForms API enables you to programmatically generate forms, manage submissions, and export response data. All endpoints use standard HTTP methods and return JSON responses.

Base URL

https://your-domain.com/api

Authentication

Most endpoints require authentication using Clerk session cookies. Requests must be made from an authenticated browser session or with valid Clerk session tokens. Protected Endpoints:
  • POST /forms/generate - Requires authentication
  • GET /getAllForms - Requires authentication
  • DELETE /forms/[id] - Requires authentication (must own the form)
  • PATCH /forms/[id] - Requires authentication (must own the form)
  • GET /forms/[id]/responses - Requires authentication (must own the form)
  • GET /forms/[id]/export - Requires authentication (must own the form)
Public Endpoints:
  • GET /forms/[id] - No authentication required (can use ID or slug)
  • POST /forms/submit - No authentication required

Available Endpoints

MethodEndpointDescription
POST/forms/generateGenerate a new form using AI
GET/getAllFormsGet all forms for the authenticated user
GET/forms/[id]Get a specific form by ID or slug
DELETE/forms/[id]Delete a form
PATCH/forms/[id]Toggle form publish status
POST/forms/submitSubmit a response to a form
GET/forms/[id]/responsesGet all responses for a form
GET/forms/[id]/exportExport form responses as CSV

Error Response Format

All errors follow a consistent JSON structure:
{
  "error": "Error message describing what went wrong"
}

Common HTTP Status Codes

  • 200 - Success
  • 201 - Created successfully
  • 400 - Bad request (validation error)
  • 401 - Unauthorized (authentication required)
  • 404 - Resource not found
  • 500 - Internal server error

Quick Example

Generate a form using AI:
curl -X POST https://your-domain.com/api/forms/generate \
  -H "Content-Type: application/json" \
  -H "Cookie: __session=your-clerk-session" \
  -d '{
    "prompt": "Create a customer feedback form with name, email, and rating fields"
  }'
Response:
{
  "success": true,
  "formId": "cm123abc456",
  "slug": "customer-feedback-xyz789",
  "title": "Customer Feedback Form",
  "message": "Form generated successfully"
}

Next Steps