API Documentation
A centralized backend for all your form submissions. Secure, spam-protected, and ready for production.
1 Authentication
Every request must include your website's unique API Key in the headers. You can find this key in your client portal.
X-API-KEY: your_api_key_here
2 Endpoint
POST
https://api.webdynolabs.com/api/submit
Required Headers
Accept: application/jsonContent-Type: application/json(or multipart/form-data)
3 Request Body & Spam Protection
You can send any form fields you want stored. However, to ensure our spam filters work correctly, we recommend including these hidden fields in your HTML form.
| Parameter | Type | Description |
|---|---|---|
| _form_start_time | Recommended | Unix timestamp when form loaded (for time-based check). |
| website_url | Honeypot | Must be hidden & empty. If filled, submission is flagged as spam. |
| phone_number_confirm | Honeypot | Must be hidden & empty. If filled, submission is flagged as spam. |
| name, email, etc. | Custom | Any fields you want to capture. |
4 Example Integration
<!DOCTYPE html>
<html>
<head>
<style>
/* Hide honeypot fields from humans */
.hp-field {
position: absolute;
left: -9999px;
opacity: 0;
}
</style>
</head>
<body>
<form id="myForm">
<input type="text" name="name" placeholder="Name" required>
<input type="email" name="email" placeholder="Email" required>
<textarea name="message" placeholder="Message"></textarea>
<!-- Honeypot fields (hidden) -->
<input type="text" name="website_url" class="hp-field" tabindex="-1">
<input type="text" name="phone_number_confirm" class="hp-field" tabindex="-1">
<!-- Timestamp for time-based protection -->
<input type="hidden" name="_form_start_time" id="formStartTime">
<button type="submit">Submit</button>
</form>
<script>
// Set form start time
document.getElementById('formStartTime').value = Math.floor(Date.now() / 1000);
document.getElementById('myForm').addEventListener('submit', function(e) {
e.preventDefault();
const formData = new FormData(this);
fetch('https://api.webdynolabs.com/api/submit', {
method: 'POST',
headers: {
'Accept': 'application/json',
'X-API-KEY': 'YOUR_GENERATED_API_KEY'
},
body: formData
})
.then(response => response.json())
.then(data => {
if(data.message === 'Submission successful') {
alert('Thanks for contacting us!');
this.reset();
// Reset timestamp for next submission
document.getElementById('formStartTime').value = Math.floor(Date.now() / 1000);
} else {
alert('Error: ' + data.message);
}
})
.catch(error => console.error('Error:', error));
});
</script>
</body>
</html>