Documentation Index
Fetch the complete documentation index at: https://terminal49-docs-api-documentation-improvements.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Webhooks in Terminal49
Webhooks provide real-time notifications about changes to your shipments and containers, letting you build responsive applications that update as soon as new information becomes available.How Webhooks Work

- You register a webhook with a URL endpoint that can receive POST requests
- An event occurs on Terminal49 (e.g., a vessel arrives or customs status changes)
- Terminal49 sends a notification to your registered URL with details about the event
- Your application processes the notification and takes appropriate action
Setting Up Webhooks
Step 1: Create a Webhook Endpoint
First, you need to create an endpoint on your server that can receive POST requests. Here’s an example using Node.js with Express:Webhook Endpoint
Step 2: Register Your Webhook with Terminal49
Once your endpoint is ready, register it with Terminal49’s API:Register Webhook
cURL Example
Step 3: Verify and Test Your Webhook
After registering, you can test your webhook using Terminal49’s test tracking numbers:Test Webhook
Managing Webhooks
Listing Your Webhooks
You can retrieve a list of all registered webhooks:List Webhooks
Updating a Webhook
To update an existing webhook (e.g., to change the URL or event types):Update Webhook
Deleting a Webhook
If you no longer need a webhook, you can delete it:Delete Webhook
Webhook Payload Structure
When an event occurs, Terminal49 sends a webhook notification with a JSON:API structured payload:Example Payload
Webhook Event Types
Terminal49 supports multiple event types that you can subscribe to:Container Events
Container Events
container.created: A new container is tracked in the systemcontainer.estimated_arrival_changed: The estimated arrival date has changedcontainer.transport.vessel_arrived: The vessel carrying the container has arrived at portcontainer.transport.vessel_discharged: The container has been unloaded from vesselcontainer.available_for_pickup: The container is available for pickup from terminalcontainer.pickup_lfd.changed: Last Free Day for pickup has changedcontainer.holds.changed: Customs or terminal holds have changedcontainer.picked_up: The container has been picked up from terminalcontainer.empty_returned: The empty container has been returned to terminal
Tracking Request Events
Tracking Request Events
tracking_request.succeeded: A tracking request was successfultracking_request.failed: A tracking request failed to find container information
Shipment Events
Shipment Events
shipment.created: A new shipment is created in the systemshipment.updated: A shipment’s details have been updated
Best Practices
1. Respond Quickly
1. Respond Quickly
Your webhook endpoint should acknowledge receipt of a webhook by returning a 2xx HTTP status code (200, 201, 202, or 204) as quickly as possible. Process the webhook data asynchronously after acknowledging receipt.
2. Implement Idempotency
2. Implement Idempotency
Design your webhook handler to be idempotent, meaning it handles duplicate webhook deliveries gracefully. Terminal49 may retry webhook delivery if your server doesn’t respond with a success code.
3. Secure Your Endpoint
3. Secure Your Endpoint
- Use HTTPS for your webhook endpoint
- Consider implementing webhook signature validation if available
- Only accept webhooks from Terminal49’s IP ranges if possible
4. Implement Error Handling
4. Implement Error Handling
Handle errors gracefully and set up monitoring for your webhook endpoint. If webhooks aren’t being received as expected, check your server logs and Terminal49 dashboard.
5. Add Fallback Mechanisms
5. Add Fallback Mechanisms
Implement a polling fallback that periodically checks the API directly in case webhooks are missed or delayed. This ensures your data stays up-to-date even if webhook delivery fails.
Troubleshooting
Missing Webhook Notifications
Missing Webhook Notifications
- Check if your webhook URL is accessible from the internet
- Verify your server is returning 2xx status codes
- Check if the webhook is registered correctly
- Look for any firewalls or security measures blocking incoming requests
Duplicate Notifications
Duplicate Notifications
Terminal49 may retry webhook delivery if your server doesn’t respond or returns an error. Implement idempotency in your handler to prevent processing the same event multiple times.
Webhook Testing
Webhook Testing
Use Terminal49’s test tracking numbers to simulate events and test your webhook handling without waiting for real events to occur.
Next Steps
Polling vs. Webhooks
Compare different approaches for receiving updates from Terminal49.
API Reference
View the complete webhook API reference.
Testing in Production
Learn about test tracking numbers to simulate events.
See the Data Model
Understand how webhooks relate to Terminal49’s data model.