Webhooks

Receive an HTTP event on your own URL instead of polling the API.

Creating a webhook

http
POST /v1/webhooks
json
{
  "url": "https://votre-app.exemple.com/webhooks/emini",
  "events": ["job.completed", "job.failed"]
}
json
{
  "webhook": { "id": "...", "url": "https://votre-app.exemple.com/webhooks/emini", "events": ["job.completed", "job.failed"], "status": "active" },
  "secret": "whsec_..."
}
secret is only returned once, at creation. Save it to verify the signature of deliveries.

Available events

  • job.completed — an asynchronous job (video) completed successfully
  • job.failed — an asynchronous job failed
  • budget.alert — a project budget alert threshold was crossed

Verifying the signature

Each delivery includes an X-Emini-Signature header: an HMAC-SHA256 of the raw request body, computed with your secret.

Node.jstypescript
import crypto from "node:crypto";

function isValid(rawBody: string, signature: string, secret: string): boolean {
  const expected = crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}

Managing webhooks

bash
GET /v1/webhooks                              # lister
DELETE /v1/webhooks/{webhook_id}              # desactiver
GET /v1/webhooks/{webhook_id}/deliveries      # historique des livraisons

Alternative: polling

Webhooks are optional — GET /v1/jobs/{job_id} is always available to actively poll a job's state (see the Video guide).