API Documentation

Integrate your generated sites with external tools and workflows.

Introduction

The Landing Editor API allows you to programmatically interact with your published sites. Currently, we provide endpoints for form submissions and a robust webhook system to notify your external services of events.

Note: The base URL for all API requests is https://your-platform-domain.com/api

Authentication

Public endpoints (like form submissions) do not require authentication headers but are rate-limited. Webhook delivery is secured using HMAC signatures (see Webhooks section).

Form Submissions

You can submit forms to your site programmatically using the generic submit endpoint. This is useful if you are building a custom frontend or mobile app that needs to send data to your Landing Editor site backend.

POST /sites/:siteId/submit

Headers

Content-Type: application/json

Body

{
  "formName": "Contact Us",  // Optional, defaults to "General Contact Form"
  "data": {
    "email": "user@example.com",
    "message": "Hello world",
    "custom_field": "123"
  }
}

Webhooks

Webhooks allow you to receive real-time notifications when events happen on your site. You can configure webhooks in the Site Settings > Integrations tab of the editor.

Security & Signatures

To verify that a webhook request was sent by us, we include a X-Webhook-Signature header in every request. This signature is a HMAC-SHA256 hash of the request body, signed using the secret key you provided when creating the webhook.

Node.js Verification Example

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const hmac = crypto.createHmac('sha256', secret);
  const digest = hmac.update(JSON.stringify(payload)).digest('hex');
  return signature === digest;
}

Event: form_submission

Triggered when a user submits a form on your site.

{
  "event": "form_submission",
  "site_id": "site-12345",
  "form_name": "Contact Us",
  "data": {
    "email": "lead@example.com",
    "name": "John Doe"
  },
  "timestamp": "2024-03-20T10:00:00.000Z"
}

Event: item.created

Triggered when a new item is added to a CMS Collection.

{
  "event": "item.created",
  "site_id": "site-12345",
  "collection_id": "col-abc-123",
  "collection_name": "Blog Posts",
  "item_id": "item-xyz-789",
  "data": {
    "title": "New Post",
    "content": "..."
  },
  "status": "draft",
  "timestamp": "2024-03-20T10:05:00.000Z"
}

Event: item.updated

Triggered when an existing CMS item is modified.

{
  "event": "item.updated",
  "site_id": "site-12345",
  "collection_id": "col-abc-123",
  "item_id": "item-xyz-789",
  "data": { ... },
  "status": "published",
  "timestamp": "2024-03-20T10:10:00.000Z"
}

Event: item.deleted

Triggered when a CMS item is permanently deleted.

{
  "event": "item.deleted",
  "site_id": "site-12345",
  "collection_id": "col-abc-123",
  "item_id": "item-xyz-789",
  "timestamp": "2024-03-20T10:15:00.000Z"
}