Docs
AI Forms Overview
Official API reference maintained directly inside the SmartForm app.
SmartForm AI Forms is a programmable hosted form layer designed for AI agents. Instead of building custom UIs for every data collection flow, AI agents define forms declaratively using the A2UI protocol (Agent-to-User Interface, v0.9.1), embed them in any website, and receive structured responses via webhook or polling.
How It Works
- An AI agent (or developer) creates a form by sending A2UI JSON to the API
- SmartForm validates the definition and returns hosted/embed URLs
- The embedded form collects structured data from end users
- SmartForm delivers the response via webhook (HMAC-signed) or polling
AI agents use the MCP server (Model Context Protocol) to create and manage forms — no REST coding needed.
Who It's For
- AI agents that need to collect structured input from humans (name, email, preferences, multi-select, ratings)
- Developers building AI-powered applications that require human-in-the-loop data collection
- Platform teams creating embeddable data collection surfaces for LLM-driven workflows
Key Features
- A2UI Protocol — Declarative JSON form definitions that LLMs generate natively. Supports text fields, selects, multi-select, sliders, date pickers, and more.
- MCP Server — AI agents interact with SmartForm via
create_form,get_form,get_submissions,deactivate_formtools. - REST API v2 — Programmatic form CRUD with API key authentication.
- Embed Everywhere — Embed forms via JavaScript snippet (WordPress-friendly), iframe, or hosted page.
- Webhooks — Receive submissions via HMAC-SHA256 signed callbacks with automatic retry.
- Post-Submit Actions — Redirect to a URL or show a custom message after form completion.
Use Cases
- Customer intake — AI agent determines what info is needed, generates a form, collects responses
- Approval workflows — AI drafts a request, human reviews/approves via embedded form
- Data enrichment — AI identifies missing fields, creates a form to collect them from the user
- Onboarding flows — AI generates multi-step forms for user registration or profile completion
- Research/surveys — AI designs and deploys structured surveys with conditional logic
Quick Start
curl -X POST https://smartform.dev/api/v2/forms \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"a2uiJson": {
"version": "0.9.1",
"surfaces": [{
"surfaceId": "main",
"components": [
{ "type": "text-field", "id": "name", "label": "Your Name", "required": true },
{ "type": "select", "id": "preference", "label": "Preference", "options": ["Option A", "Option B"], "required": true },
{ "type": "slider", "id": "rating", "label": "Rating", "validation": { "min": 1, "max": 10 } }
]
}]
},
"postSubmitType": "redirect",
"postSubmitValue": "https://example.com/thanks"
}'
Returns:
{
"form_id": "uuid-here",
"hosted_url": "https://smartform.dev/f/uuid-here",
"embed_code": "<script src=\"https://smartform.dev/embed.js\" data-form-id=\"uuid-here\"></script>",
"post_submit_type": "redirect",
"post_submit_value": "https://example.com/thanks"
}
Paste the embed code into any HTML page, or use the hosted URL directly.
Next Steps
- AI Forms API Reference — Full REST API v2 documentation
- AI Forms Embed Guide — JavaScript snippet, iframe, customization
- AI Forms MCP Server — Using SmartForm from AI agents via MCP