Submit Endpoint

The submit endpoint is the public URL where your forms send data. No authentication required.

Public Endpoint: This endpoint does not require authentication and can be called from any website.

Submit Form Data

POSThttps://fastsubmit.hostspica.com/api/submit/:formId

Accepts form submissions and stores them in your FastSubmit dashboard.

Content Types

The endpoint accepts two content types:

  • application/json - For JavaScript/AJAX submissions
  • application/x-www-form-urlencoded - For standard HTML forms

Request Body

Send your form fields as key-value pairs. Field names must match the field IDs configured in your form.

HTML Form Example

<form action="https://fastsubmit.hostspica.com/api/submit/YOUR_FORM_ID" method="POST">
  <label>
    Name
    <input type="text" name="name" required />
  </label>
  
  <label>
    Email
    <input type="email" name="email" required />
  </label>
  
  <label>
    Message
    <textarea name="message"></textarea>
  </label>
  
  <!-- Honeypot field for spam protection -->
  <input type="text" name="_honeypot" style="display:none" tabindex="-1" autocomplete="off" />
  
  <button type="submit">Submit</button>
</form>

JavaScript Example

// Using fetch API
const formData = {
  name: "John Doe",
  email: "john@example.com",
  message: "Hello from JavaScript!"
};

fetch("https://fastsubmit.hostspica.com/api/submit/YOUR_FORM_ID", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify(formData)
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    console.log("Form submitted successfully!");
  } else {
    console.error("Error:", data.error);
  }
})
.catch(error => console.error("Network error:", error));

Response

Success Response (200)

{
  "success": true,
  "message": "Submission received"
}

Validation Error (400)

{
  "error": "Validation failed",
  "errors": [
    "Email is required",
    "Name is required"
  ]
}

Form Not Found (404)

{
  "error": "Form not found"
}

Spam Protection

FastSubmit includes built-in honeypot spam protection. Add a hidden field named _honeypot to your form:

<!-- Add this hidden field to your form -->
<input 
  type="text" 
  name="_honeypot" 
  style="display:none" 
  tabindex="-1" 
  autocomplete="off" 
/>

Bots typically fill in all form fields, including hidden ones. If the _honeypot field contains any value, the submission is silently rejected.

Redirect After Submit

For standard HTML forms, users are automatically redirected back to the referring page after submission. For AJAX submissions, you handle the response in your JavaScript code.

CORS

The submit endpoint has CORS enabled, allowing submissions from any origin. This means you can submit forms from any website without CORS errors.