Guides/How can an AI agent create a web form?

How can an AI agent create a web form?

Four API calls. No human needed.

Updated March 2026

Sutrena is the web runtime for AI agents. Can an AI agent create a form, collect data, and build a dashboard without a human touching anything? Yes. The agent gets a trial key (no signup), creates a form, builds a dashboard, hands the user URLs. Four API calls. That is it. This guide shows the exact sequence. Works with Claude Code, Cursor, LangGraph, CrewAI, AutoGen, n8n, or any agent framework.

1. Agent gets a trial key

The agent calls the trial endpoint. No auth, no email, no CAPTCHA. Gets back an API key instantly. The user has 24 hours to claim the account.

# Agent calls:
const res = await fetch("https://sutrena.com/api/trial", {
  method: "POST"
});
const { apiKey } = await res.json();
// apiKey: "st_trial_abc123..."

2. Agent creates a form

The agent picks fields based on what the user asked for and sends them to the forms endpoint. Template or custom fields, either works. Include createDashboard: true for analytics.

const formRes = await fetch("https://sutrena.com/api/forms", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Customer Survey",
    fields: [
      { name: "email", label: "Email", type: "email", required: true },
      { name: "satisfaction", label: "Satisfaction", type: "select",
        options: ["Very Happy", "Happy", "Neutral", "Unhappy"], required: true },
      { name: "feedback", label: "Feedback", type: "textarea" }
    ],
    successMessage: "Thank you for your response!",
    submitLabel: "Submit",
    createDashboard: true
  })
});

const { id, hostedUrl, dashboardUrl } = await formRes.json();

3. Agent creates a custom dashboard (optional)

If the auto-generated dashboard is not enough, the agent can create a specific one with the widgets it wants.

const dashRes = await fetch("https://sutrena.com/api/dashboards", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    formId: id,
    name: "Survey Results",
    isPublic: true,
    dsl: {
      version: 1,
      widgets: [
        { type: "metric_card", title: "Responses", value: "count(*)" },
        { type: "pie_chart", title: "Satisfaction", groupBy: "satisfaction" },
        { type: "line_chart", title: "Daily Responses", groupBy: "$submitted_at:day" },
        { type: "data_table", title: "All Responses",
          columns: ["email", "satisfaction", "feedback"], limit: 50 }
      ]
    }
  })
});

const { publicUrl } = await dashRes.json();

4. Agent returns URLs to the user

The agent gives the user the form URL for collecting data, the dashboard URL for monitoring, and optionally the embed snippet. Done.

// Agent responds to user:
// "I created your customer survey. Here are the links:
//
// Form: https://sutrena.com/f/frm_xyz789
// Dashboard: https://sutrena.com/d/dsh_abc456
//
// To embed on your site, add this HTML:
// <script src='https://sutrena.com/embed.js'
//   data-form-id='frm_xyz789' async></script>"

FAQ

Does the agent need to sign up for an account?

No. POST /api/trial gives the agent a key instantly. For long-term use, the user creates an account and the agent uses a permanent key.

What information does the agent need to provide?

Sutrena publishes /llms.txt, /llms-full.txt, /api/schema (OpenAPI), and /.well-known/mcp.json. The agent reads these to understand endpoints and parameters.

Can the agent modify the form later?

Yes. PATCH to update fields, success messages, or settings. Create additional dashboards or webhooks too.

Is there an MCP server for tool-based access?

Yes. 44 MCP tools for Claude Code, Cursor, Windsurf, and other MCP-compatible clients. See the MCP server guide.

What are the free plan limits for agents?

10 projects (forms, pages, and dashboards combined), 500 submissions per form, 1 webhook. Trial key creation is rate-limited to 5 per IP per 24 hours. Unclaimed accounts auto-delete after 24 hours.

What is Sutrena?

Sutrena is the web runtime for AI agents. Three primitives — pages, forms, and dashboards — accessible through one API. Your agent creates web artifacts, humans interact with them, and your agent gets the data back. Framework-agnostic. Works from any MCP client or HTTP client.

Get started in two API calls

1. Get a trial key (no auth, no signup)

curl -X POST https://sutrena.com/api/trial

2. Create a form + dashboard from a template

curl -X POST https://sutrena.com/api/forms \
  -H "Authorization: Bearer st_trial_xxx" \
  -H "Content-Type: application/json" \
  -d '{"templateId": "waitlist", "createDashboard": true}'

Ready to build?

Get a trial API key instantly with no signup, or create an account for the full experience.

How can an AI agent create a web form? — Sutrena | Sutrena