Using the API
Webhooks
Instead of polling, register an HTTPS endpoint and receive a signed request when something finishes.
Events
generation.completed,generation.failed,generation.cancelledworkflow.run.completed,workflow.run.failedbalance.low
Payload
{
"id": "evt_...",
"type": "generation.completed",
"created": 1796379306,
"data": { "id": "0b7c...", "object": "generation", "status": "succeeded", "outputs": [] }
}Verifying the signature
Each request carries X-Openbase-Signature: t=<unix seconds>,v1=<hex>. The signature is an HMAC SHA-256 of t + "." + rawBody using your endpoint secret. Reject anything older than five minutes.
import crypto from 'node:crypto';
export function verify(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > toleranceSeconds) return false;
const expected = crypto.createHmac('sha256', secret).update(parts.t + '.' + rawBody).digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1 ?? '');
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Use the raw body
Verify against the exact bytes you received, before any JSON parsing or re-serialising.
Retries
Any non-2xx response, or a timeout, is retried after 30 seconds, 2 minutes, 10 minutes, 1 hour and 6 hours. Deliveries and replays are visible in Studio under Webhooks. Make your handler idempotent: the same event can arrive more than once.