Développeur

Webhooks

Enregistrez un endpoint HTTPS pour être notifié à la fin d'un job, au lieu de faire du polling.

MapLeads emits scrape_job.completed and scrape_job.failed. Managing webhooks requires the webhooks scope.

GET/v1/webhooks
POST/v1/webhooks
DELETE/v1/webhooks/:id

Create body

FieldTypeDescription
urlstringHTTPS endpoint that receives deliveries.
eventTypesstring[]scrape_job.completed and/or scrape_job.failed.
cURL — register
curl https://api.mapleads.ai/v1/webhooks \
  -X POST \
  -H "Authorization: Bearer mapleads_xxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/mapleads","eventTypes":["scrape_job.completed"]}'

The signing secret is returned once, in this create response. Each delivery is a JSON POST with these headers:

FieldTypeDescription
x-mapleads-eventstringThe event type.
x-mapleads-deliverystringUnique delivery id (use it to de-duplicate).
x-mapleads-signaturestringsha256=<HMAC-SHA256 of the raw body with your secret>.

Verify the signature before trusting a delivery:

Node.js — verify signature
import { createHmac, timingSafeEqual } from "node:crypto";

function verify(rawBody, header, secret) {
  const expected = "sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(header ?? "");
  return a.length === b.length && timingSafeEqual(a, b);
}

Commencez à extraire des leads dès aujourd'hui

Lancez votre première recherche en moins d'une minute. Exportez les résultats en CSV, Excel ou JSON.