Integrations
Webhooks
Send each submission as signed JSON to your own HTTPS URL, with automatic retries and a delivery log.
A webhook sends each new submission to your own server as a JSON POST request. Use it to save submissions in your database, start a job, or connect any system that can receive HTTP. Every request is signed so you can check it really came from Lazyform, failed deliveries are retried, and each attempt shows up in the delivery log.
Needs the Pro plan.
Don't want to write code? Use Zapier, Make or n8n instead. They receive submissions the same way and connect them to thousands of apps.
What you need
- URL: the address we send submissions to. It must start with
https://. - Signing secret (optional): the secret used to sign each request. Leave it empty and we generate one for you. It's shown once, right after you create the webhook, so copy it then. You can also type your own.
Set it up
- Create an endpoint on your server that accepts
POSTrequests with a JSON body (examples below). - In the dashboard, open your form, then Integrations, then Webhook.
- Enter your URL. Leave the signing secret empty to have one generated, or enter your own.
- Save, and copy the signing secret if it was generated for you. Store it as an environment variable on your server, for example
LAZYFORM_WEBHOOK_SECRET.
When you save, we send a test request to your URL so you can check your endpoint works.
The request
For each submission we send:
- Method:
POST - Header
Content-Type: application/json - Header
X-Lazyform-Event:submission.created(ortestfor the test request sent when you save) - Header
X-Lazyform-Submission: the submission's ID - Header
X-Lazyform-Signature: the signature (see Verify the signature) - Body: JSON in this shape:
{
"event": "submission.created",
"id": "sub_…",
"createdAt": "2026-12-04T10:15:00.000Z",
"form": { "id": "frm_…", "name": "Contact" },
"data": {
"name": "Ada",
"email": "ada@example.com",
"message": "Hi"
},
"files": [
{
"field": "cv",
"name": "cv.pdf",
"size": 120400,
"contentType": "application/pdf",
"url": "https://…"
}
],
"pageUrl": "https://example.com/contact",
"country": "DE",
"dashboardUrl": "https://getlazyform.com/app/…"
}| Key | What it is |
|---|---|
event |
submission.created for a new submission, test for the test request. |
id |
The submission's ID. Use it to skip duplicates if a request is retried. |
createdAt |
When it was received, as an ISO 8601 date in UTC. |
form |
The form's ID and name. |
data |
Every field the visitor sent, by name, in the order sent. Values are strings. Fields sent more than once (like checkboxes) are joined with ", ". Special fields like access_key and botcheck are removed. |
files |
Uploaded files: the field name, file name, size in bytes, type and a download link. Links work for 7 days, so download the file if you need to keep it. Empty when there are no files. |
pageUrl |
The page the form was sent from, or null when we don't know it. |
country |
The visitor's two-letter country code, or null when we don't know it. |
dashboardUrl |
A link to this submission in the dashboard. |
Verify the signature
Every request has an X-Lazyform-Signature header like this:
X-Lazyform-Signature: t=1764843300,v1=5f2b…tis when we sent the request, in Unix seconds.v1is the HMAC-SHA256 of<t>.<raw request body>(the timestamp, a dot, then the body), using your webhook's signing secret as the key, written as lowercase hex.
To check it:
- Split the header into
tandv1. - Compute the HMAC-SHA256 of
t + "." + bodyover the exact bytes you received, and compare it withv1using a constant-time comparison. Do this before you parse the JSON: parsing and re-encoding the body changes it, and the signature won't match. - Refuse requests whose
tis more than 5 minutes away from your clock. This stops someone who captured an old request from sending it again.
import crypto from 'node:crypto'
import express from 'express'
const app = express()
const secret = process.env.LAZYFORM_WEBHOOK_SECRET
function verify(header, body) {
const parts = Object.fromEntries((header || '').split(',').map((p) => p.split('=')))
const t = Number(parts.t)
if (!parts.v1 || !Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false
const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(body).digest('hex')
const a = Buffer.from(parts.v1)
const b = Buffer.from(expected)
return a.length === b.length && crypto.timingSafeEqual(a, b)
}
// express.raw keeps the body as a Buffer, exactly as it was sent
app.post('/webhooks/lazyform', express.raw({ type: 'application/json' }), (req, res) => {
if (!verify(req.get('X-Lazyform-Signature'), req.body)) return res.status(401).send('Invalid signature')
const event = JSON.parse(req.body.toString('utf8'))
console.log('New submission', event.id, event.data)
// Answer fast; do slow work after responding (or in a queue)
res.sendStatus(200)
})
app.listen(3000)// app/api/webhooks/lazyform/route.ts
const secret = process.env.LAZYFORM_WEBHOOK_SECRET!
function hexToBytes(hex: string): Uint8Array | null {
if (!/^[0-9a-f]{64}$/.test(hex)) return null
const bytes = new Uint8Array(32)
for (let i = 0; i < 32; i++) bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16)
return bytes
}
async function verify(header: string | null, body: string): Promise<boolean> {
const parts = Object.fromEntries((header ?? '').split(',').map((p) => p.split('=')))
const t = Number(parts.t)
const signature = hexToBytes(parts.v1 ?? '')
if (!signature || !Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false
const encoder = new TextEncoder()
const key = await crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false, ['verify'])
// crypto.subtle.verify compares in constant time
return crypto.subtle.verify('HMAC', key, signature, encoder.encode(`${t}.${body}`))
}
export async function POST(request: Request) {
const body = await request.text()
if (!(await verify(request.headers.get('x-lazyform-signature'), body))) {
return new Response('Invalid signature', { status: 401 })
}
const event = JSON.parse(body)
console.log('New submission', event.id, event.data)
return new Response(null, { status: 204 })
}import hashlib
import hmac
import os
import time
from flask import Flask, abort, request
app = Flask(__name__)
SECRET = os.environ["LAZYFORM_WEBHOOK_SECRET"].encode()
def verify(header: str, body: bytes) -> bool:
parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
t, v1 = parts.get("t", ""), parts.get("v1", "")
if not t.isdigit() or abs(time.time() - int(t)) > 300:
return False
expected = hmac.new(SECRET, t.encode() + b"." + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, v1)
@app.post("/webhooks/lazyform")
def lazyform_webhook():
body = request.get_data() # raw bytes, exactly as sent
if not verify(request.headers.get("X-Lazyform-Signature", ""), body):
abort(401)
event = request.get_json()
print("New submission", event["id"], event["data"])
return "", 204<?php
$secret = getenv('LAZYFORM_WEBHOOK_SECRET');
$body = file_get_contents('php://input'); // raw body, exactly as sent
parse_str(str_replace(',', '&', $_SERVER['HTTP_X_LAZYFORM_SIGNATURE'] ?? ''), $parts);
$t = $parts['t'] ?? '';
$v1 = $parts['v1'] ?? '';
$expected = hash_hmac('sha256', $t . '.' . $body, $secret);
if (!ctype_digit($t) || abs(time() - (int) $t) > 300 || !hash_equals($expected, $v1)) {
http_response_code(401);
exit('Invalid signature');
}
$event = json_decode($body, true);
error_log('New submission ' . $event['id']);
http_response_code(204);The Web Crypto version in the Next.js tab also works in other runtimes that have crypto.subtle, like Cloudflare Workers, Deno and Bun.
Keep the signing secret on your server. Never put it in front-end code or commit it to your repository. If it leaks, change it in the integration's settings and update your server.
Respond fast with a 2xx
Answer with any 2xx status (200, 201, 204…) as soon as you've checked the signature and stored the data. If you need to do slow work, like sending emails or calling other APIs, do it after responding or in a background job. We wait up to 15 seconds; a slower answer counts as a timeout, which is a failed delivery (and retried).
Retries
When a delivery fails, we try again later, waiting a little longer each time, up to 8 times. We retry when:
- your server can't be reached, or the request times out
- your server answers with a
5xxstatus - your server answers
408,425or429 Too Many Requests
Other answers, like 400 or 401, are treated as a failure your server chose and aren't retried. Fix the problem, then resend the submission from the dashboard.
Because a request can be retried, your endpoint may occasionally get the same submission twice. Use id to ignore ones you've already handled.
Delivery log and resend
Every submission has a delivery log in the dashboard. For the webhook it shows each attempt, its status code and any error. If deliveries failed (for example while your server was down), fix the problem and use resend on the submission to deliver it again.
Troubleshooting
- "HTTPS required" when saving. The URL must start with
https://. To test with a server on your computer, use a tunnel such as ngrok or Cloudflare Tunnel to get an HTTPS URL. - The signature never matches. Make sure you sign the raw body, not parsed and re-encoded JSON. In Express, use
express.raw()on this route and don't runexpress.json()before it. Check there are no extra spaces or line breaks around the secret in your environment variable. - I lost the signing secret. It's only shown once. Set a new one in the integration's settings and update your server.
- The log shows a 3xx status. Your URL redirects somewhere else. Enter the final URL of your endpoint (check
wwwversus nowww, and trailing slashes). - Some submissions are missing. Spam isn't sent. Check the spam folder and the delivery log in the dashboard.