FormDee provides a comprehensive REST API for form management, submission handling, AI generation, and third-party integrations. All API endpoints are built with Next.js API routes and follow RESTful conventions.
Development: http://localhost:3000
Production: https://your-domain.com
FormDee uses two authentication methods:
Used for browser-based admin access:
POST /api/auth/login
{
"password": "your-admin-ui-key"
}Used for programmatic access:
Headers: {
"x-admin-key": "your-admin-api-key"
}POST /api/auth/login
Content-Type: application/json
{
"password": "admin-ui-key"
}Response:
{
"success": true,
"message": "Logged in successfully"
}POST /api/auth/logoutGET /api/auth/checkResponse:
{
"authenticated": true,
"user": "admin"
}GET /api/forms
x-admin-key: your-api-keyResponse:
[
{
"id": "uuid",
"refKey": "contact-form",
"title": "Contact Form",
"description": "Get in touch with us",
"fields": [...],
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
]GET /api/forms?refKey=contact-formPOST /api/forms
x-admin-key: your-api-key
Content-Type: application/json
{
"refKey": "contact-form",
"title": "Contact Form",
"description": "Get in touch",
"fields": [
{
"key": "name",
"label": "Full Name",
"type": "text",
"required": true,
"placeholder": "Enter your name"
},
{
"key": "email",
"label": "Email",
"type": "email",
"required": true,
"pattern": "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"
}
],
"slackWebhookUrl": "https://hooks.slack.com/...",
"googleSheetUrl": "https://docs.google.com/spreadsheets/d/..."
}DELETE /api/forms
x-admin-key: your-api-key
Content-Type: application/json
{
"refKey": "contact-form"
}POST /api/ai/generate
x-admin-key: your-api-key
Content-Type: application/json
{
"prompt": "Create a job application form with resume upload"
}Response:
{
"title": "Job Application Form",
"description": "Apply for open positions",
"refKey": "job-application",
"fields": [
{
"key": "full_name",
"label": "Full Name",
"type": "text",
"required": true
},
{
"key": "resume",
"label": "Upload Resume",
"type": "file",
"acceptedTypes": [".pdf", ".doc", ".docx"],
"maxFileSize": 5242880,
"required": true
}
]
}Supported Models:
gpt-4o(Recommended)gpt-4o-minigpt-5-mini(May exhaust reasoning tokens)gpt-5-nano(May exhaust reasoning tokens)
Error Handling: For GPT-5 models, if reasoning tokens are exhausted:
{
"error": "AI model used reasoning tokens but generated no content. Try using GPT-4o instead of GPT-5 models for form generation."
}POST /api/submit
Content-Type: application/json
{
"refKey": "contact-form",
"values": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello world"
}
}POST /api/submit/supabase
Content-Type: application/json
{
"refKey": "contact-form",
"formData": {
"name": "John Doe",
"email": "john@example.com"
},
"files": {
"resume": "https://r2.example.com/file.pdf"
}
}GET /api/responses?refKey=contact-form&limit=10&offset=0
x-admin-key: your-api-keyResponse:
{
"responses": [
{
"id": "uuid",
"refKey": "contact-form",
"formData": {
"name": "John Doe",
"email": "john@example.com"
},
"files": {},
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0...",
"submittedAt": "2024-01-01T00:00:00Z"
}
],
"total": 100,
"limit": 10,
"offset": 0
}POST /api/upload
Content-Type: multipart/form-data
FormData:
- file: (binary)
- formId: "contact-form"Response:
{
"url": "https://r2.example.com/contact-form-1234567890-resume.pdf",
"key": "contact-form-1234567890-resume.pdf",
"size": 102400,
"type": "application/pdf"
}GET /api/settings
x-admin-key: your-api-keyResponse:
{
"model": "gpt-4o",
"hasApiKey": true,
"googleAuthEnabled": true
}POST /api/settings
x-admin-key: your-api-key
Content-Type: application/json
{
"model": "gpt-4o",
"apiKey": "sk-proj-..."
}POST /api/settings/test
x-admin-key: your-api-key
Content-Type: application/json
{
"aiModel": "gpt-4o",
"aiApiKey": "sk-proj-..."
}GET /api/auth/google
x-admin-key: your-api-keyResponse: Redirects to Google OAuth consent screen
GET /api/auth/google/callback?code=auth-code&state=stateGET /api/auth/google/status
x-admin-key: your-api-keyResponse:
{
"authenticated": true,
"email": "user@example.com",
"expiresAt": "2024-01-01T00:00:00Z"
}POST /api/auth/google/logout
x-admin-key: your-api-keyPOST /api/forms/validate-google-sheet
x-admin-key: your-api-key
Content-Type: application/json
{
"sheetUrl": "https://docs.google.com/spreadsheets/d/1234567890/edit"
}Response:
{
"valid": true,
"sheetId": "1234567890",
"sheetName": "Sheet1"
}POST /api/forms/test-google-sheet
x-admin-key: your-api-key
Content-Type: application/json
{
"sheetId": "1234567890",
"sheetName": "Sheet1"
}POST /api/forms/export-responses
x-admin-key: your-api-key
Content-Type: application/json
{
"refKey": "contact-form",
"sheetUrl": "https://docs.google.com/spreadsheets/d/1234567890/edit"
}Response:
{
"success": true,
"exported": 25,
"sheetUrl": "https://docs.google.com/spreadsheets/d/1234567890/edit"
}POST /api/forms/test-slack
x-admin-key: your-api-key
Content-Type: application/json
{
"webhookUrl": "https://hooks.slack.com/services/..."
}Response:
{
"success": true,
"message": "Test message sent successfully"
}GET /api/healthResponse:
{
"status": "healthy",
"timestamp": "2024-01-01T00:00:00Z"
}GET /api/health?detailed=trueResponse:
{
"status": "healthy",
"timestamp": "2024-01-01T00:00:00Z",
"services": {
"database": "connected",
"storage": "connected",
"ai": "configured"
},
"version": "1.3.0",
"environment": "production"
}All endpoints return consistent error responses:
{
"error": "Invalid request data",
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}{
"error": "Unauthorized access"
}{
"error": "Form not found"
}{
"error": "Internal server error",
"message": "Database connection failed"
}- Public endpoints: 100 requests/minute per IP
- Authenticated endpoints: 1000 requests/minute per API key
- File uploads: 10 requests/minute per IP
Supported field types for forms:
text- Single line text inputtextarea- Multi-line text inputemail- Email input with validationnumber- Numeric inputdate- Date pickerselect- Dropdown selectionradio- Radio button groupcheckbox- Multiple checkboxesfile- File upload
{
"required": true, // Field is required
"pattern": "^[A-Za-z]+$", // Regex pattern
"min": 0, // Minimum value (number/date)
"max": 100, // Maximum value (number/date)
"minLength": 3, // Minimum text length
"maxLength": 255, // Maximum text length
"acceptedTypes": [".pdf", ".doc"], // File types (file field)
"maxFileSize": 5242880, // Max file size in bytes
"allowMultiple": false // Allow multiple files
}Real-time updates for form submissions:
ws://localhost:3000/api/ws
// Subscribe to form submissions
{
"type": "subscribe",
"refKey": "contact-form"
}
// Receive submission events
{
"type": "submission",
"refKey": "contact-form",
"data": {...}
}import { FormDeeClient } from '@formdee/client';
const client = new FormDeeClient({
baseUrl: 'https://api.example.com',
apiKey: 'your-api-key'
});
// Create a form
const form = await client.forms.create({
refKey: 'survey-2024',
title: 'Customer Survey',
fields: [...]
});
// Submit to form
const response = await client.forms.submit('survey-2024', {
rating: 5,
feedback: 'Great service!'
});from formdee import FormDeeClient
client = FormDeeClient(
base_url='https://api.example.com',
api_key='your-api-key'
)
# Get form responses
responses = client.responses.list(
ref_key='survey-2024',
limit=100
)
# Export to Google Sheets
result = client.google.export_responses(
ref_key='survey-2024',
sheet_url='https://docs.google.com/...'
)Download our Postman Collection for easy API testing.
For API support, please contact:
- GitHub Issues: github.com/formdee/issues
- Email: api-support@formdee.com
- Documentation: docs.formdee.com
FormDee API v1.3.0 - Last updated: January 2025