Skip to content

REST API Reference

All API requests (except GET /health) require an Authorization header:

Authorization: Bearer <your-api-key>

API keys are created and managed in the dashboard. Each key is scoped to a single project.

All endpoints return errors in a consistent format:

{
"error": {
"code": "validation_failed | not_found | unauthorized | internal_error",
"message": "Human-readable error description",
"details": [
{
"path": "fields.0.id",
"code": "invalid_string",
"message": "Detailed error message"
}
]
}
}

HTTP status codes: 400 (bad request), 401 (unauthorized), 404 (not found), 422 (validation failed), 500 (internal error).


Health check. No authentication required.

Example response (200):

{ "ok": true }

Validate a form definition without creating it.

Request body: a form definition JSON object (see Form Schema Reference).

bash
Terminal window
curl -X POST https://api.agentsforms.com/v1/forms/validate \
-H "Authorization: Bearer $AGENTSFORMS_API_KEY" \
-H "Content-Type: application/json" \
-d @forms/example-form.json

Example response (200):

{
"ok": true,
"form": {
"name": "Support Intake",
"slug": "support-intake",
"fields": [{ "id": "email", "type": "email", "required": true }]
}
}

Example error (422):

{
"error": {
"code": "validation_failed",
"message": "Invalid form definition",
"details": [
{ "path": "fields.0.id", "code": "invalid_string", "message": "Field id must start with a letter" }
]
}
}

Create a new form from a validated schema. The form is created in draft status.

Request body:

FieldTypeDescription
namestringHuman-readable name
slugstringURL-safe slug
descriptionstringOptional description
fieldsField[]Array of field definitions
settingsSettingsOptional form-level settings
bash
Terminal window
curl -X POST https://api.agentsforms.com/v1/forms \
-H "Authorization: Bearer $AGENTSFORMS_API_KEY" \
-H "Content-Type: application/json" \
-d @forms/support-intake.json

Example response (201):

{
"form": {
"id": "form_abc123",
"name": "Support Intake",
"slug": "support-intake",
"status": "draft",
"version": 0,
"created_at": "2026-06-23T10:00:00Z",
"updated_at": "2026-06-23T10:00:00Z"
}
}

List all forms in the project.

Query parameters:

ParameterTypeDescription
statusstringFilter by status: draft, published, archived
limitnumberMax results (default 20, max 100)
offsetnumberPagination offset
bash
Terminal window
curl -X GET "https://api.agentsforms.com/v1/forms?status=published" \
-H "Authorization: Bearer $AGENTSFORMS_API_KEY"

Example response (200):

{
"forms": [
{
"id": "form_abc123",
"name": "Support Intake",
"slug": "support-intake",
"status": "published",
"version": 1,
"submission_count": 42,
"updated_at": "2026-06-23T10:00:00Z"
}
]
}

Get a single form by ID.

Example response (200):

{
"form": {
"id": "form_abc123",
"name": "Support Intake",
"slug": "support-intake",
"status": "published",
"version": 1,
"definition": {
"name": "Support Intake",
"slug": "support-intake",
"fields": [{ "id": "email", "type": "email", "required": true }]
},
"created_at": "2026-06-23T10:00:00Z",
"updated_at": "2026-06-23T10:00:00Z"
}
}

Publish a draft form. Creates a new version if the definition changed; reuses the last version if the checksum matches.

Example response (200):

{
"form": {
"id": "form_abc123",
"slug": "support-intake",
"status": "published",
"version": 1,
"hosted_url": "https://agentsforms.com/f/support-intake"
}
}

Create a new form-filling session.

Request body:

FieldTypeDescription
expires_innumberSession lifetime in seconds (default 3600)
prefillobjectKey-value prefill map by field id
metadataobjectArbitrary key-value metadata attached to the session

Planned response (201):

{
"session": {
"id": "sess_xyz789",
"form_id": "form_abc123",
"status": "open",
"url": "https://agentsforms.com/f/sess_xyz789",
"expires_at": "2026-06-23T11:00:00Z"
}
}

Get a session by ID. Returns the session status and any partial answers if allowPartial is enabled.

Update a session (e.g., extend expiry, add prefill data).

Force-submit a session. Normally the human user submits via the form UI; this endpoint allows an agent to auto-submit on the user’s behalf.


Retrieve submissions for a form. (Exact method TBD — may be GET with filtering.)

List submissions for a form with pagination and filtering.

Get a single submission by ID with full answer data.


Register a webhook endpoint.

Planned request body:

FieldTypeDescription
urlstringHTTPS URL to receive webhook events
eventsstring[]Event types: submission.created, session.expired
secretstringOptional HMAC signing secret

List registered webhooks.

Get a webhook by ID.

Delete a webhook.

List delivery attempts for a webhook, with status and timestamps.

Replay a failed webhook delivery.


Renders the hosted form page for a human user to fill out. This endpoint returns HTML, not JSON.