Skip to content

Webhook

Webhooks allow you to receive real-time notifications when events occur in your StrawBlond organization. You can subscribe to specific events or use a catch-all subscription to receive all events.

Related Documentation

For a comprehensive guide on webhook events and implementation, see Webhook Events Guide.

Allowed query parameters

Filters

FilterTypeDescription
None-No filtering supported

Sorting

None supported

Includes

callLogs

Create a webhook subscription

post
/webhook
Attribute (* required)TypeDescription
event *StringEvent name to subscribe to, or * for all events
url *StringHTTPS URL to receive webhook notifications

HTTPS Required

All webhook URLs must use HTTPS. HTTP URLs are not supported for security reasons.

Example request

json
{
    "event": "invoice.created",
    "url": "https://api.example.com/webhooks/strawblond"
}

Example response

json
// HTTP 201 Created
{
    "id": "v7rnRjBn9o",
    "event": "invoice.created",
    "url": "https://api.example.com/webhooks/strawblond",
    "last_failed_at": null,
    "failed_count": 0,
    "call_logs": []
}

Update a webhook subscription

put
/webhook/{id}
AttributeTypeDescription
eventStringEvent name to subscribe to, or * for all events
urlStringHTTPS URL to receive webhook notifications

Example response

json
// HTTP 200 OK
{
    "id": "v7rnRjBn9o",
    "event": "expense.approved",
    "url": "https://api.example.com/webhooks/strawblond",
    "last_failed_at": null,
    "failed_count": 0,
    "call_logs": []
}

Retrieve a webhook subscription

get
/webhook/{id}

Example response

json
// HTTP 200 OK
{
    "id": "v7rnRjBn9o",
    "event": "invoice.created",
    "url": "https://api.example.com/webhooks/strawblond",
    "last_failed_at": null,
    "failed_count": 0,
    "call_logs": []
}

Delete a webhook subscription

delete
/webhook/{id}

Example response

json
// HTTP 204 No Content

List webhook subscriptions

get
/webhook

Example response

json
// HTTP 200 OK
{
    "data": [
        {
            "id": "v7rnRjBn9o",
            "event": "invoice.created",
            "url": "https://api.example.com/webhooks/strawblond",
            "last_failed_at": null,
            "failed_count": 0,
            "call_logs": []
        },
        {
            "id": "8mApSdTg2k",
            "event": "*",
            "url": "https://api.example.com/webhooks/all-events",
            "last_failed_at": "2024-01-15T10:30:00.000000Z",
            "failed_count": 3,
            "call_logs": []
        }
    ]
}

Test a webhook subscription

post
/webhook/{id}/test

Sends a test webhook event to verify your endpoint is working correctly. This endpoint cannot be used with catch-all (*) webhook subscriptions.

Catch-All Limitation

Test webhooks cannot be sent to catch-all event subscriptions (event: "*"). You must test specific event subscriptions only.

Example response

json
// HTTP 204 No Content

Webhook Event Types

Webhooks support various event types throughout the StrawBlond system:

Common Event Patterns

  • *.created - When an entity is created
  • *.updated - When an entity is updated
  • *.deleted - When an entity is deleted
  • *.approved - When an entity is approved
  • *.paid - When an entity is marked as paid

Catch-All Events

Use * as the event name to receive all webhook events. This is useful for logging or analytics purposes, but be prepared to handle high volumes of events.

Webhook Delivery

Delivery Guarantees

  • Webhooks are delivered with at-least-once semantics
  • Failed deliveries are automatically retried with exponential backoff
  • Your endpoint should respond with HTTP 200-299 status codes to indicate successful receipt
  • Failed webhooks are tracked in the failed_count and last_failed_at fields

Payload Format

All webhook payloads follow this structure:

json
{
    "id": "<unique-event-id>",
    "event": "<event-type>",
    "created": 1663762684,
    "test": false,
    "data": {
        // The associated object (e.g., invoice, expense)
    }
}

Security

For information on verifying webhook signatures and securing your webhook endpoints, see the Webhook Events Guide.

Development & Testing

For local development, use tools like ngrok or Expose to create secure tunnels to your localhost. See the webhook guide for more details.