DokuBrain
SDKs & Integrations

Webhooks

Receive real-time event notifications from DokuBrain.

Webhooks

Webhooks notify your application in real-time when events occur in DokuBrain. Configure a URL, choose which events to subscribe to, and DokuBrain will send HTTP POST requests with event data.

Setting up webhooks

Create a webhook
curl -X POST https://api.dokubrain.com/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/dokubrain",
    "events": ["document.processed", "workflow.completed"],
    "secret": "whsec_your_signing_secret"
  }'

Event types

EventTrigger
document.uploadedDocument upload completed
document.processedDocument parsing and embedding finished
document.classifiedDocument type classified
document.extractedField extraction completed
document.deletedDocument was deleted
workflow.startedWorkflow run began
workflow.step_completedIndividual workflow step finished
workflow.completedFull workflow run succeeded
workflow.failedWorkflow run failed
report.completedReport execution finished

Payload format

Webhook payload
{
  "id": "evt_abc123",
  "type": "document.processed",
  "createdAt": "2026-03-15T10:30:15Z",
  "data": {
    "documentId": "doc_abc123",
    "filename": "invoice.pdf",
    "status": "completed",
    "classification": {
      "type": "invoice",
      "confidence": 0.97
    }
  }
}

Signature verification

Verify that webhook requests actually come from DokuBrain using the X-DokuBrain-Signature header:

Node.js verification
const crypto = require('crypto');
 
function verifyWebhookSignature(rawBody, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(rawBody)
    .digest('hex');
 
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(`sha256=${expected}`)
  );
}
 
// In your Express/Fastify handler:
app.post('/webhooks/dokubrain', (req, res) => {
  const signature = req.headers['x-dokubrain-signature'];
  if (!verifyWebhookSignature(req.rawBody, signature, WEBHOOK_SECRET)) {
    return res.status(401).send('Invalid signature');
  }
  // Process the event
  const event = req.body;
  console.log(`Received ${event.type}:`, event.data);
  res.status(200).send('OK');
});

Retry policy

If your endpoint returns a non-2xx status code, DokuBrain retries with exponential backoff:

AttemptDelay
1st retry1 minute
2nd retry5 minutes
3rd retry30 minutes
4th retry2 hours
5th retry12 hours

After 5 failed attempts, the webhook is marked as failing. Fix the issue and re-enable it from the dashboard.

On this page