Lenklyst Documentation
API Specification

Headless Forms Guide

Build completely custom forms on your own websites and applications. Submit data securely without exposing API keys by utilizing strict Domain Verification (CORS).


1. Domain Verification Security

Instead of exposing private API keys in your client-side code, our Headless Forms use HTTP Origin headers to verify submissions. In your Headless Forms Dashboard, simply add the domains (e.g. https://mywebsite.com) that are permitted to submit data to the endpoint. Submissions from any other domain will be rejected with a 401 Unauthorized response.


2. Submit via HTML Form

POST/api/forms/[endpoint_id]/submit

You can use a standard HTML <form> tag to submit data. This requires absolutely zero Javascript. By including the _redirect hidden field, the server will automatically issue a 302 Redirect to send the user back to your site after a successful submission.

<form action="https://lenklyst.io/api/forms/YOUR_ENDPOINT_ID/submit" method="POST">
  <!-- Optional: Redirect users to a thank you page -->
  <input type="hidden" name="_redirect" value="https://yourwebsite.com/thanks" />

  <input type="email" name="email" placeholder="Enter your email" required />
  <input type="text" name="name" placeholder="Full Name" />
  
  <button type="submit">Submit</button>
</form>

3. Submit via AJAX / Fetch

POST/api/forms/[endpoint_id]/submit

If you are building a Single Page Application (SPA) using React, Vue, or Angular, you can submit the data asynchronously. Pass your submission fields inside a data object.

// You can submit JSON directly via Fetch or Axios
const submitForm = async (formData) => {
  const response = await fetch("https://lenklyst.io/api/forms/YOUR_ENDPOINT_ID/submit", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      data: {
        email: formData.email,
        name: formData.name
      }
    })
  });

  const result = await response.json();
  console.log('Submission successful:', result.success);
};

All submissions are automatically passed through our spam filter and rate limiter. You can view the raw JSON payloads inside your Headless Forms Dashboard Inbox.