Skip to main content
Banan0 API Docs

Webhooks

Manage webhook endpoints for async notifications.

Webhooks

Webhooks notify your server when runs complete or fail.

Create Webhook

http
POST /api/v1/webhooks
bash
curl -X POST \
  -H "Authorization: Bearer bnn_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yoursite.com/banan0-webhook",
    "events": ["run.completed", "run.failed"]
  }' \
  "https://banan0.com/api/v1/webhooks"

Response

json
{
  "data": {
    "id": "wh_abc123",
    "url": "https://yoursite.com/banan0-webhook",
    "events": ["run.completed", "run.failed"],
    "signing_secret": "whsec_abc123..."
  },
  "message": "Store the signing_secret securely - it will not be shown again."
}

List Webhooks

bash
curl -H "Authorization: Bearer bnn_live_xxx" \
  "https://banan0.com/api/v1/webhooks"

Delete Webhook

bash
curl -X DELETE \
  -H "Authorization: Bearer bnn_live_xxx" \
  "https://banan0.com/api/v1/webhooks/wh_abc123"

Verifying Webhooks

Verify the X-Banan0-Signature header:

typescript
import crypto from 'crypto';

function verifyWebhook(payload: string, signature: string, secret: string) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

Webhook Payload

json
{
  "event": "run.completed",
  "webhook_id": "wh_abc123",
  "data": {
    "run_id": "run_xyz789",
    "model_id": "fal-ai/flux-pro",
    "result": {
      "images": ["https://..."]
    },
    "tokens_charged": 5,
    "timestamp": "2026-01-13T20:00:00.000Z"
  },
  "created_at": "2026-01-13T20:00:01.000Z"
}

Command Palette

Search for a command to run...