Set up a form backend in 30 seconds.

This page is designed for AI coding agents. Read this page, ask the user 2 questions, and integrate the form.

API live — https://agentsforms.com/api
What to do

Step 1 — Ask the user these 2 questions:

  • What information do you need to collect? (e.g. name, email, message, phone, etc.)
  • Where should submissions be sent? (email address)

Step 2 — Create the form backend via API:

POST /api/forms
{
  "name": "Contact form",
  "slug": "contact",
  "fields": [
    { "id": "name", "type": "text", "label": "Name", "required": false },
    { "id": "email", "type": "email", "label": "Email", "required": true },
    { "id": "message", "type": "textarea", "label": "Message", "required": false }
  ],
  "delivery": { "type": "email", "to": "user@example.com" }
}

Step 3 — Publish the form:

POST /api/forms/{FORM_ID}/publish
Authorization: Bearer <AP...e>
      

Step 4 — Wire the frontend form to POST answers:

POST /api/forms/{FORM_ID}/submissions
const response = await fetch(
  'https://agentsforms.com/api/forms/{FORM_ID}/submissions',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      source: 'site',
      answers: { name, email, message }
    })
  }
);
API endpoints

Base URL & Methods

  • POST /api/forms — Create a form from a JSON schema
  • GET /api/forms — List all forms
  • GET /api/forms/:id — Get a form by ID
  • POST /api/forms/:id/publish — Publish a form (creates immutable version)
  • POST /api/forms/:id/submissions — Submit answers to a form
  • GET /api/forms/:id/submissions — List submissions for a form
  • POST /api/demo — Demo endpoint (no auth, stores + emails)
Form schema reference

Supported field types

text textarea email url number boolean date select multi_select radio checkbox hidden

Example: contact form with 3 fields

forms/contact.json
{
  "name": "Contact form",
  "slug": "contact",
  "fields": [
    { "id": "name", "type": "text", "label": "Name", "required": false },
    { "id": "email", "type": "email", "label": "Email", "required": true },
    { "id": "message", "type": "textarea", "label": "Message", "required": false }
  ],
  "settings": {
    "submitLabel": "Send message",
    "successMessage": "Thanks — we'll be in touch."
  }
}
Quick CLI setup (alternative)

Install and create a form in one flow:

npm install -g @agentsforms/cli
agentsforms login
agentsforms init
agentsforms forms create forms/contact.json --email user@example.com
agentsforms forms publish contact
Delivery modes

Email (default)

Submissions are sent to the specified email address via AgentMail.

Webhook (MVP2)

Set "delivery": { "type": "webhook", "url": "https://your-app.com/webhook" } to receive signed webhook events instead of email.

Hosted form URLs (zero-UI fallback)

Create a hosted session

POST /api/forms/{FORM_ID}/sessions
{
  "id": "sess_abc123",
  "form_url": "https://agentsforms.com/f/sess_abc123?t=public_token"
}

Share the form_url with users — it's a fully functional hosted form.

Questions to ask the user

Q1: What information do you need to collect from visitors?

Examples: Name + email (contact), email only (waitlist), name + email + budget (intake), name + email + approval status (workflow gate).

Q2: Where should form submissions be sent?

Get a valid email address. This is where AgentMail will deliver submissions.

Q3: Do you need a hosted form URL, or will you build the frontend?

Hosted URLs are instant (zero code). Custom frontends let you keep the form in your site's design system.

Ready to integrate?

All API endpoints are live at https://agentsforms.com/api


Read the full docs →