Forms API

Manage your forms programmatically using the REST API.

Base URL: https://fastsubmit.hostspica.com/api/v1

List All Forms

GET/forms

Returns a list of all forms belonging to the authenticated user.

Example Request

curl -X GET \
  https://fastsubmit.hostspica.com/api/v1/forms \
  -H "x-api-key: YOUR_API_KEY"

Response

{
  "success": true,
  "count": 2,
  "forms": [
    {
      "id": "abc123",
      "name": "Contact Form",
      "fieldsCount": 3,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    }
  ]
}

Get Form Details

GET/forms/:formId

Returns detailed information about a specific form including all field configurations.

Path Parameters

formId(string)

The unique form identifier

Response

{
  "success": true,
  "form": {
    "id": "abc123",
    "name": "Contact Form",
    "fields": [
      {
        "id": "name",
        "label": "Name",
        "type": "text",
        "required": true
      }
    ],
    "endpoint": "https://fastsubmit.hostspica.com/api/submit/abc123"
  }
}

Create Form

POST/forms

Creates a new form with the specified fields.

Field Object

{
  "id": "email",
  "label": "Email",
  "type": "email",
  "required": true,
  "placeholder": "..."
}

Example Request

curl -X POST \
  https://fastsubmit.hostspica.com/api/v1/forms \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Contact Form",
    "fields": [
      {"id": "name", "label": "Name", "type": "text", "required": true},
      {"id": "email", "label": "Email", "type": "email", "required": true}
    ]
  }'

Update Form

PUT/forms/:formId

Updates an existing form. You can update the name, fields, or both.

Example Request

curl -X PUT \
  https://fastsubmit.hostspica.com/api/v1/forms/abc123 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Updated Form Name"}'

Delete Form

DELETE/forms/:formId

Permanently deletes a form and all its submissions.

Warning: This action cannot be undone. All submissions will be permanently deleted.

Example Request

curl -X DELETE \
  https://fastsubmit.hostspica.com/api/v1/forms/abc123 \
  -H "x-api-key: YOUR_API_KEY"