Skip to content
Lazyform
Docs menu

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

  1. Create an endpoint on your server that accepts POST requests with a JSON body (examples below).
  2. In the dashboard, open your form, then Integrations, then Webhook.
  3. Enter your URL. Leave the signing secret empty to have one generated, or enter your own.
  4. 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 (or test for 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:
json
{
  "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:

text
X-Lazyform-Signature: t=1764843300,v1=5f2b…
  • t is when we sent the request, in Unix seconds.
  • v1 is 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:

  1. Split the header into t and v1.
  2. Compute the HMAC-SHA256 of t + "." + body over the exact bytes you received, and compare it with v1 using 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.
  3. Refuse requests whose t is more than 5 minutes away from your clock. This stops someone who captured an old request from sending it again.
js
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)

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 5xx status
  • your server answers 408, 425 or 429 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 run express.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 www versus no www, and trailing slashes).
  • Some submissions are missing. Spam isn't sent. Check the spam folder and the delivery log in the dashboard.