Aller au contenu principal

Automation & webhooks

Webhook notifications let you react to Paperoffice events in real time.

Subscribe to events

curl -X POST https://api.paperoffice.ai/v1/webhooks/subscriptions \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"target_url": "https://partner.example.com/paperoffice/webhooks",
"events": ["document.created", "workflow.completed"],
"secret": "<SIGNING_SECRET>"
}'

Validate signatures

  1. Read the HTTP header X-Paperoffice-Signature.
  2. Compute HMAC_SHA256(body, SIGNING_SECRET).
  3. Compare the hex value timestamp.signature with the header.

Trigger workflows

curl -X POST https://api.paperoffice.ai/v1/workflows/start \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"workflow_code": "archiving-standard",
"payload": {
"document_id": "DOC-12345",
"priority": "high"
}
}'

Combine webhooks with the workflow API to automate end-to-end processes.