Webhooks & Callbacks
Asynchronous API Patterns
Webhooks and callbacks describe outbound HTTP calls your API makes. These patterns are essential for event-driven architectures and async workflows.
Key Differences
- • Webhooks - Top-level events, independent of any operation (3.1+)
- • Callbacks - Tied to a specific operation, triggered by that request
Webhooks
OpenAPI 3.1+Define outbound API calls your service makes to external URLs. Webhooks are top-level objects, not tied to any specific endpoint.
Order Created Webhook
Common Webhook Events
- • Order created / updated / cancelled
- • Payment completed / failed
- • User registered / verified
- • Subscription renewed / cancelled
- • Resource created / deleted
Webhook vs Regular Endpoint
- Regular: Client calls your API
- Webhook: Your API calls client's URL
- Direction: Outbound vs inbound
Defining Multiple Webhooks
Each webhook is a named entry with its own operation(s).
Callbacks
OpenAPI 3.0+Callbacks are outbound calls triggered by a specific operation. Unlike webhooks, they're defined inside the operation that initiates them.
Subscription Callback Example
Runtime Expressions
DynamicCallback URLs can include runtime expressions to dynamically construct the URL from request/response data.
| Expression | Source | Example |
|---|---|---|
| $url | Request URL | https://api.example.com/sub |
| $method | HTTP method | POST |
| $request.path.id | Path parameter | 123 |
| $request.query.filter | Query parameter | active |
| $request.header.X-Id | Request header | abc123 |
| $request.body#/url | Request body field | https://client.com/hook |
| $response.body#/id | Response body field | sub-456 |
| $response.header.Location | Response header | /subs/456 |
Expression Examples
Version Compatibility
| Feature | Swagger 2.0 | OpenAPI 3.0 | OpenAPI 3.1 |
|---|---|---|---|
| Callbacks | No | Yes | Yes |
| Webhooks | No | No | Yes |
Conversion Note
When converting from 3.1 to 3.0, webhooks are removed (3.0 doesn't support them). Callbacks are preserved. Consider documenting webhooks separately for 3.0 compatibility.
Tigrister Support
FullTigrister fully supports both webhooks and callbacks with dedicated UI components.
Webhooks Section
- • Add/edit/delete/rename webhooks
- • Method badge display (POST, PUT, etc.)
- • Summary inline display
- • Count badge showing total webhooks
- • Empty state with "Add Webhook" button
- • Schema selection from components
Callbacks Editor
- • Full callback operation editing
- • Request body schema selection
- • Content type configuration
- • Required flag support
- • Response definition with status codes
- • Runtime expression URL display
Preview
- • Webhooks displayed in API documentation
- • Callback documentation per operation
- • Schema visualization with expand/collapse
Best Practices
Include Event Type in Payload
Add a type or event field so receivers can route events.
Document Expected Response
Specify what response you expect (usually 200 OK) and timeout behavior.
Consider Retry Logic
Document your retry policy for failed webhook deliveries in the description.
Use Security Headers
Include signature headers (like X-Signature) so receivers can verify authenticity.