Event
Webhook Events
are triggered by changes in objects you've created via the API.
Every time an Event
related to one of your objects is created, EasyPost guarantees at least one POST request will be sent to each of the webhook URLs set up for your account.
For this reason, we strongly encourage your webhook handler to be idempotent. See the webhooks guide for more information.
Endpoints
- A "batch.created"
Event
is created when the initial creation of aBatch
object is complete. - A "batch.updated"
Event
is created whenever the status of aBatch
object changes.
- An "insurance.purchased"
Event
is created whenever a standaloneInsurance
completes purchasing and reporting to the insurer. - An "insurance.cancelled"
Event
is created whenever a standaloneInsurance
fails purchasing, is refunded to your account balance, and is not reported to the insurer.
- A "payment.created"
Event
is created whenever a bank account or credit card is successfully charged. For credit card charges, this event indicates that the charge is complete and your account balance has already been updated. For bank account transfers (ACH) this indicates the beginning of the transfer process, which may still later fail. - A "payment.completed"
Event
is created when a bank account transfer is successfully completed and credited to your account balance. This event indicates that the accounting for that transfer is now complete. - A "payment.failed"
Event
is created when a bank account transfer or credit card charge has an issue and cannot be completed. For bank account transfers that fail your account balance may see a failure deduction and an EasyPost could possibly need to get in contact with you about your account status.
- A "refund.successful"
Event
is created whenever a non-instantaneousRefund
request is completed. USPS is the best example of this, as USPS postage takes up to 15 days to be refunded after the initial refund creation.
- A "report.new"
Event
is created when aReport
object is initially created. The report won't be immediately ready for download. - A "report.empty"
Event
is created when aReport
did not generate because there was no data in the specified date range. - A "report.available"
Event
is created when aReport
becomes available to download. - A "report.failed"
Event
is created when aReport
fails to generate.
- A "scan_form.created"
Event
is created when the initial creation of aScanForm
object is complete. - A "scan_form.updated"
Event
is created whenever the status of aScanForm
object changes.
- A "shipment.invoice.created"
Event
is created when aShipmentInvoice
object is initially created. - A "shipment.invoice.updated"
Event
is created if aShipmentInvoice
is adjusted and updated.
- A "tracker.created"
Event
is created when the initial creation of aTracker
object is complete. - A "tracker.updated"
Event
is created whenever aTracker
object gets successfully updated.
object
string
"Event"
id
string
Unique identifier, begins with "evt_"
mode
string
"test" or "production"
description
string
Result type and event name. See Possible Event Types for more information.
previous_attributes
object
Previous values of relevant result attributes
result
object
The object associated with the
Event
. See the object
attribute on the result to determine its specific type. This field will not be returned when retrieving events directly from the API.status
string
The current status of the event. Possible values:
- "completed"
- "failed"
- "in_queue"
- "retrying"
pending_urls
string array
Webhook URLs that have not yet been successfully notified as of the time this webhook event was sent. The URL receiving the
Event
will still be listed in pending_urls
, as will any other URLs that receive the Event
at the same time.completed_urls
string array
Webhook URLs that have already been successfully notified as of the time this webhook was sent
created_at
datetime
When the
Event
was createdupdated_at
datetime
When the
Event
was last updatedEvent Object
{
"mode": "production",
"description": "batch.created",
"previous_attributes": {
"state": "purchasing"
},
"pending_urls": [
"example.com/easypost-webhook"
],
"completed_urls": [],
"created_at": "2015-12-03T19:09:19Z",
"updated_at": "2015-12-03T19:09:19Z",
"result": {
"id": "batch_...",
"object": "Batch",
"mode": "production",
"state": "purchased",
"num_shipments": 1,
"reference": null,
"created_at": "2015-12-03T19:09:19Z",
"updated_at": "2015-12-03T19:09:19Z",
"scan_form": null,
"shipments": [
{
"batch_status": "postage_purchased",
"batch_message": null,
"id": "shp_a5b1348307694736aaqqqq8fqda53f93"
}
],
"status": {
"created": 0,
"queued_for_purchase": 0,
"creation_failed": 0,
"postage_purchased": 1,
"postage_purchase_failed": 0
},
"pickup": null,
"label_url": null
},
"id": "evt_...",
"object": "Event"
}
A list of all Event
objects associated with the given API Key
can also be retrieved.
See the Pagination section of our docs for more details on retrieving all records when multiple pages are available.
Request Parameters
before_id
i.e. evt_...
Optional pagination parameter. Only events created before the given ID will be included. May not be used with
after_id
after_id
i.e. evt_...
Optional pagination parameter. Only events created after the given ID will be included. May not be used with
before_id
start_datetime
i.e. 2016-01-02T00:00:00Z
Only return events created after this timestamp. Defaults to 1 month ago, or 1 month before a passed
end_datetime
end_datetime
i.e. 2016-01-02T00:00:00Z
Only return events created before this timestamp. Defaults to end of the current day, or 1 month after a passed
start_datetime
page_size
i.e. 30
The number of records to return on each page. The maximum value is 100, and default is 20.
GET / events
1curl -X GET "https://api.easypost.com/v2/events?page_size=5" \
2 -u "EASYPOST_API_KEY":
Response
1{
2 "events": [
3 {
4 "description": "tracker.created",
5 "id": "evt_5397c3dcba4c11ee99e74d3b807cff5b",
6 "user_id": "user_060ab38db3c04ffaa60f262e5781a9be",
7 "status": "pending",
8 "created_at": "2024-01-24T00:05:47.779Z",
9 "mode": "test",
10 "object": "Event"
11 }
12 ],
13 "has_more": true
14}
An Event
can be retrieved by its id
.
GET / events/ :id
1curl -X GET https://api.easypost.com/v2/events/evt_... \
2 -u "EASYPOST_API_KEY":
Response
1{
2 "description": "tracker.created",
3 "mode": "test",
4 "previous_attributes": {},
5 "created_at": "2024-01-24T00:05:48.000Z",
6 "pending_urls": [],
7 "completed_urls": [],
8 "updated_at": "2024-01-24T00:05:48.000Z",
9 "id": "evt_5397c3dcba4c11ee99e74d3b807cff5b",
10 "user_id": "user_060ab38db3c04ffaa60f262e5781a9be",
11 "status": "pending",
12 "object": "Event"
13}