Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/scooller/Leben-site/llms.txt

Use this file to discover all available pages before exploring further.

The /api/v1/contact-submissions endpoint accepts contact form submissions from any authorized frontend, persists the data locally, and immediately dispatches a CreateSalesforceCaseJob to create the corresponding Lead or Case record in Salesforce with full UTM tracking. Submissions are validated against a dynamic field schema that is configurable per contact channel in SiteSettings. If Cloudflare Turnstile is enabled for the installation, a valid turnstile_token must be included and is verified server-side before the submission is accepted.

Endpoint

POST /api/v1/contact-submissions

Authentication

This endpoint is public — no user session is required. Rate limiting applies to prevent abuse.
ConstraintValue
Rate limit10 requests per minute per IP
Auth requiredNone

Channel resolution

The contact channel is resolved from one of two sources, checked in this order:
  1. channel field in the JSON request body
  2. X-Contact-Channel HTTP header
If neither source resolves to a valid, active channel, the request is rejected with a 422 validation error — there is no silent fallback to a default channel.

Request body

channel
string
Slug of the contact channel (e.g. "sale", "arriendo"). Can also be supplied via the X-Contact-Channel request header instead of the body. The channel determines which fields are required or optional within fields. Must match an active channel configured in SiteSettings.
fields
object
required
Dynamic form fields. The exact set of accepted and required fields depends on the active channel configuration in SiteSettings. The fields listed below are the standard recommended set.
turnstile_token
string
Cloudflare Turnstile challenge response token. Required when Turnstile is enabled in the installation (configured via the CLOUDFLARE_TURNSTILE_SECRET_KEY environment variable). The token is validated server-side — client-side validation alone is not sufficient.

Example request

The following is the minimum recommended body as documented in the iLeben API guide:
{
  "channel": "sale",
  "fields": {
    "name": "Juan Perez",
    "email": "juan@example.com",
    "message": "Quiero mas informacion",
    "phone": "+56911111111",
    "proyecto": "torre-central",
    "comuna": "Santiago",
    "utm_source": "google",
    "utm_medium": "cpc",
    "utm_campaign": "invierno"
  },
  "turnstile_token": "token-si-esta-configurado"
}
curl -X POST "https://tu-dominio.com/api/v1/contact-submissions" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "sale",
    "fields": {
      "name": "Juan Perez",
      "email": "juan@example.com",
      "message": "Quiero mas informacion",
      "phone": "+56911111111",
      "proyecto": "torre-central",
      "comuna": "Santiago",
      "utm_source": "google",
      "utm_medium": "cpc",
      "utm_campaign": "invierno"
    },
    "turnstile_token": "token-si-esta-configurado"
  }'

UTM enrichment

The backend automatically sets fields.utm_site on every submission when the field is not already present in fields. The value is resolved from the first non-empty candidate in this header priority order:
  1. Origin header
  2. Referer header
  3. X-Source-Site custom header
The resolved value is normalized to its hostname component. This allows multi-site iLeben deployments to identify the originating frontend without requiring the client to pass the value manually.

Response

201 Created

message
string
Human-readable confirmation that the submission was received (e.g. "Tu mensaje fue enviado correctamente.").
id
integer
Database ID of the newly created contact submission record.
{
  "message": "Tu mensaje fue enviado correctamente.",
  "id": 123
}

Error codes

StatusCause
422 Unprocessable EntityValidation failed — required fields missing, malformed, or no valid active channel could be resolved
429 Too Many RequestsRate limit exceeded (10 requests/minute per IP)
403 ForbiddenCloudflare Turnstile validation failed — the provided turnstile_token was rejected by the Cloudflare API
Cloudflare Turnstile validation is performed entirely server-side using the CLOUDFLARE_TURNSTILE_SECRET_KEY environment variable. When this key is configured, every request must include a valid turnstile_token or the submission will be rejected with a 422 response. Set CLOUDFLARE_TURNSTILE_SECRET_KEY in your .env to enable or disable this protection.

Downstream processing

After a submission is persisted, iLeben dispatches a CreateSalesforceCaseJob synchronously (via dispatchSync) when Salesforce Lead sync is enabled (SALESFORCE_LEAD_ENABLED=true). This job:
  • Maps the submission fields to the correct Salesforce Lead or Case object based on the channel
  • Includes full UTM field mapping aligned with Salesforce custom fields (Proyect_ID__c, etc.)
  • Automatically enriches proyecto_salesforce_id by looking up the project record when a project name or slug is provided in fields
  • Is monitored via the Filament admin panel under Contacto → Submissions, which shows sync status and allows manual re-synchronization

Build docs developers (and LLMs) love