Skip to main content

Forms

Build embeddable forms — contact, newsletter, surveys — get ready-to-paste HTML or React snippets, and paginate over incoming submissions with spam filtering. All endpoints require X-API-Key.

Each form exposes a unique submission URL of the form https://www.flexweg.com/f/<uuid> that you drop into any site to collect submissions.

Form lifecycle

  1. Create the form with its fields.
  2. Fetch an embed snippet (HTML or React) and paste it into your site.
  3. Read submissions over the API, filtered and paginated.
  4. Toggle to disable the form, or delete it permanently.

CRUD

POST /api/v1/forms

Create a new form with its initial fields.

cURL
curl -X POST https://www.flexweg.com/api/v1/forms \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Contact Form",
"description": "Main contact form for homepage",
"fields": [
{ "name": "full_name", "label": "Full Name", "type": "text", "required": true },
{ "name": "email", "label": "Email Address", "type": "email", "required": true },
{ "name": "message", "label": "Your Message", "type": "textarea", "required": true }
],
"success_message": "Thank you! We will contact you soon.",
"redirect_url": "https://example.com/thank-you"
}'
200 OK
{
"success": true,
"form": {
"id": 1,
"uuid": "abc123def456",
"name": "Contact Form",
"slug": "contact-form",
"description": "Main contact form for homepage",
"is_active": true,
"submission_count": 0,
"fields": [ /* ... */ ],
"submission_url": "https://www.flexweg.com/f/abc123def456",
"created_at": "2026-04-06T10:30:00+00:00"
}
}

GET /api/v1/forms

List all forms on your account.

cURL
curl -X GET https://www.flexweg.com/api/v1/forms \
-H "X-API-Key: YOUR_API_KEY"
200 OK
{
"success": true,
"forms": [
{
"id": 1,
"uuid": "abc123def456",
"name": "Contact Form",
"slug": "contact-form",
"is_active": true,
"submission_count": 42,
"created_at": "2026-04-06T10:30:00+00:00"
}
],
"total": 1
}

GET /api/v1/forms/{id}

Retrieve the full details of a single form, including every field.

cURL
curl -X GET https://www.flexweg.com/api/v1/forms/1 \
-H "X-API-Key: YOUR_API_KEY"

PUT /api/v1/forms/{id}

Update a form's metadata or replace its fields completely. To edit fields individually, use the field-level endpoints below.

cURL
curl -X PUT https://www.flexweg.com/api/v1/forms/1 \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Contact Form",
"success_message": "Thank you for reaching out!",
"fields": [
{ "name": "name", "label": "Your Name", "type": "text", "required": true },
{ "name": "email", "label": "Email", "type": "email", "required": true }
]
}'

POST /api/v1/forms/{id}/toggle

Flip the is_active flag on a form. A disabled form stops accepting new submissions but keeps its existing ones.

cURL
curl -X POST https://www.flexweg.com/api/v1/forms/1/toggle \
-H "X-API-Key: YOUR_API_KEY"
200 OK
{
"success": true,
"is_active": false,
"message": "Form disabled"
}

DELETE /api/v1/forms/{id}

Permanently delete a form and all of its submissions.

cURL
curl -X DELETE https://www.flexweg.com/api/v1/forms/1 \
-H "X-API-Key: YOUR_API_KEY"
Irreversible

Every submission ever received by this form is wiped along with the form itself.

Field management

Finer-grained control: add, update, delete or reorder a single field without replacing the whole form.

POST /api/v1/forms/{id}/fields

Add a field at a specific position.

cURL
curl -X POST https://www.flexweg.com/api/v1/forms/1/fields \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "phone",
"label": "Phone Number",
"type": "tel",
"required": false,
"position": 2
}'

Field types: text, email, tel, number, url, textarea, select.

PUT /api/v1/forms/{id}/fields/{fieldId}

Update a field's properties (label, required, placeholder, options).

cURL
curl -X PUT https://www.flexweg.com/api/v1/forms/1/fields/field_123 \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "Phone Number (Optional)",
"required": false,
"placeholder": "+1 (555) 000-0000"
}'

DELETE /api/v1/forms/{id}/fields/{fieldId}

Remove a field from a form.

cURL
curl -X DELETE https://www.flexweg.com/api/v1/forms/1/fields/field_123 \
-H "X-API-Key: YOUR_API_KEY"

POST /api/v1/forms/{id}/fields/reorder

Reorder every field in one shot — pass the full list of field IDs in the new order.

cURL
curl -X POST https://www.flexweg.com/api/v1/forms/1/fields/reorder \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "field_ids": ["field_3", "field_1", "field_2"] }'

Embed snippets

Three endpoints that hand you ready-to-paste code for the form. Useful to generate a snippet automatically from an admin dashboard.

GET /api/v1/forms/{id}/embed/html

Returns a Bootstrap-styled HTML snippet.

cURL
curl -X GET https://www.flexweg.com/api/v1/forms/1/embed/html \
-H "X-API-Key: YOUR_API_KEY"
200 OK
{
"success": true,
"snippet": "<form action=\"https://www.flexweg.com/f/abc123\" method=\"POST\">..."
}

GET /api/v1/forms/{id}/embed/react

Returns a React component source (uses hooks, ready to drop into a .jsx file).

cURL
curl -X GET https://www.flexweg.com/api/v1/forms/1/embed/react \
-H "X-API-Key: YOUR_API_KEY"

GET /api/v1/forms/{id}/embed/curl

Returns a cURL example demonstrating how to POST a submission — useful for manual testing.

cURL
curl -X GET https://www.flexweg.com/api/v1/forms/1/embed/curl \
-H "X-API-Key: YOUR_API_KEY"

Form submissions

GET /api/v1/forms/{id}/submissions

List submissions with pagination, spam filtering, date range filtering.

Query parameters

FieldTypeDefaultDescription
pageinteger1Page number.
per_pageinteger50Items per page (max 100).
is_spambooleanFilter by spam status.
is_archivedbooleanFilter by archive status.
from_datestring (ISO 8601)Lower bound on submitted_at.
to_datestring (ISO 8601)Upper bound on submitted_at.
cURL
curl -X GET "https://www.flexweg.com/api/v1/forms/1/submissions?page=1&per_page=50&is_spam=false" \
-H "X-API-Key: YOUR_API_KEY"
200 OK
{
"success": true,
"form": {
"id": 1,
"uuid": "abc123def456",
"name": "Contact Form"
},
"submissions": [
{
"id": 42,
"uuid": "sub_xyz789",
"data": {
"full_name": "John Doe",
"email": "[email protected]",
"message": "Hello!"
},
"is_spam": false,
"spam_score": 15,
"is_archived": false,
"is_read": true,
"submitted_at": "2026-04-06T10:30:00+00:00",
"read_at": "2026-04-06T11:00:00+00:00"
}
],
"pagination": {
"current_page": 1,
"per_page": 50,
"total_items": 142,
"total_pages": 3,
"has_more": true
},
"stats": {
"total": 142,
"spam": 8,
"archived": 12,
"unread": 23,
"legitimate": 134
}
}
Combine filters

You can stack multiple filters: is_spam=false&is_archived=false&from_date=2026-04-01T00:00:00Z returns only legitimate, non-archived submissions from April onwards.

GET /api/v1/forms/{id}/submissions/{uuid}

Fetch the full detail of a single submission, including metadata (IP, user agent, referer, origin) and spam reasons.

cURL
curl -X GET https://www.flexweg.com/api/v1/forms/1/submissions/sub_xyz789 \
-H "X-API-Key: YOUR_API_KEY"
200 OK
{
"success": true,
"form": {
"id": 1,
"uuid": "abc123def456",
"name": "Contact Form"
},
"submission": {
"id": 42,
"uuid": "sub_xyz789",
"data": {
"full_name": "John Doe",
"email": "[email protected]",
"message": "Hello!"
},
"is_spam": false,
"spam_score": 15,
"is_archived": false,
"is_read": true,
"submitted_at": "2026-04-06T10:30:00+00:00",
"read_at": "2026-04-06T11:00:00+00:00",
"metadata": {
"ip_address": "192.168.1.1",
"user_agent": "Mozilla/5.0...",
"referer": "https://example.com/contact",
"origin": "https://example.com"
},
"spam_reasons": null
}
}