AgentForms Documentation

AgentForms is an API-first platform that lets AI agents create web forms, collect structured human input, and receive JSON responses — via REST API, Python SDK, or MCP server.

Quick Start

Get up and running in three steps.

Get your API key

When you first start the AgentForms server, an API key is printed to stdout in the format af_live_<48 hex chars>. Copy it — this is your only chance to see the plaintext key.

Create a form

Use the API or SDK to create a form with one or more fields. You'll get back a URL to share with the person who needs to fill it out.

Receive the response

Poll for responses, use wait_for_response() in the SDK, or set up a webhook to get notified immediately when the form is submitted.

Example: Python SDK

Python
from agentforms import AgentForms
from agentforms import fields

client = AgentForms(api_key="af_live_...")

# Create a form
form = client.create_form(
    title="Contact Info",
    fields=[
        fields.Text(key="name", label="Full Name", required=True),
        fields.Email(key="email", label="Email", required=True),
        fields.Select(key="role", label="Role", options=["Engineer", "Designer", "PM"]),
    ],
    expires_in="24h",
)

print(form.url)  # Share this URL

# Wait for submission (blocks up to 1 hour)
response = client.wait_for_response(form.id)
print(response.data)
# {"name": "Jane Doe", "email": "jane@example.com", "role": "Engineer"}

Example: cURL

bash
# Create a form
curl -X POST https://your-server.com/api/v1/forms \
  -H "Authorization: Bearer af_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Contact Info",
  "fields": [
    {"key": "name", "type": "text", "label": "Full Name", "required": true},
    {"key": "email", "type": "email", "label": "Email", "required": true},
    {"key": "role", "type": "select", "label": "Role",
     "config": {"options": ["Engineer", "Designer", "PM"]}}
  ],
  "expires_in": "24h"
}'

# Response includes form URL and ID
# {"id": "01JN...", "url": "https://your-server.com/f/01JN...", ...}

# Check for responses
curl https://your-server.com/api/v1/forms/FORM_ID/responses \
  -H "Authorization: Bearer af_live_..."

Next Steps