Looking for the old docs? View our old docs site.

Payloads

A Payload represents an attempt by EasyPost to send an Event to a Webhook. An Event can have multiple Payloads. For instance, if there is a failure to deliver a Webhook, an Event would have multiple payloads, one for each attempt to deliver the Event to the Webhook. Payload can be useful for debugging webhook delivery and when initially setting up EasyPost webhooks.


Payload object

object
string
"Payload"
id
string
Unique identifier, begins with "payload_"
mode
string
"test" or "production"
request_url
string
The URL that the request was sent to (the Webhook URL)
request_body
string
The body included in the request to the configured Webhook
request_headers
object
The headers included in the request to the configured Webhook
response_code
int
The status code returned by the webhook server
response_body
string
The body returned by the webhook server
response_headers
object
The headers returned by the webhook server
total_time
int
How long the request to the configured Webhook took to complete
created_at
datetime
When the Payload was created
updated_at
datetime
When the Payload was last updated
Payload Object
{
  "id": "payload_734d47163d0711ecb29421da38a2f124",
  "object": "Payload",
  "created_at": "2021-11-04T00:37:55Z",
  "updated_at": "2021-11-04T01:14:18Z",
  "request_url": "https://api.example.com/webhook",
  "request_headers": {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "User-Agent": "Go-http-client/1.1"
  },
  "request_body": "{\"key\":\"value\"}",
  "response_code": 200,
  "response_headers": {
    "Content-Type": "application/json; charset=utf-8",
    "Date": "Tue, 02 Nov 2021 23:37:55 GMT",
    "Server": "nginx/1.19.6",
    "X-Content-Type-Options": "nosniff",
    "X-Frame-Options": "SAMEORIGIN",
    "X-Request-Id": "a1b2c3d4e5f6g7h8i9j0",
    "X-Runtime": "0.001000",
    "X-Xss-Protection": "1; mode=block"
  },
  "total_time": 34
}

Retrieve all Payloads

Retrieve all Payloads by Event ID.

GET /events/:event_id/payloads
1curl -X GET https://api.easypost.com/v2/events/evt_.../payloads \
2  -u "EASYPOST_API_KEY":
Response
1{
2  "payloads": [
3    {
4      "id": "payload_734d47163d0711ecb29421da38a2f124",
5      "object": "Payload",
6      "created_at": "2021-11-04T00:37:55Z",
7      "updated_at": "2021-11-04T01:14:18Z",
8      "request_url": "https://api.example.com/webhook",
9      "request_headers": {
10        "Accept": "application/json",
11        "Content-Type": "application/json",
12        "User-Agent": "Go-http-client/1.1"
13      },
14      "request_body": "{\"key\":\"value\"}",
15      "response_code": 200,
16      "response_headers": {
17        "Content-Type": "application/json; charset=utf-8",
18        "Date": "Tue, 02 Nov 2021 23:37:55 GMT",
19        "Server": "nginx/1.19.6",
20        "X-Content-Type-Options": "nosniff",
21        "X-Frame-Options": "SAMEORIGIN",
22        "X-Request-Id": "a1b2c3d4e5f6g7h8i9j0",
23        "X-Runtime": "0.001000",
24        "X-Xss-Protection": "1; mode=block"
25      },
26      "total_time": 34
27    },
28    {
29      "id": "payload_734d47163d0711ecb29421da38a2f414",
30      "object": "Payload",
31      "created_at": "2021-11-04T00:37:55Z",
32      "updated_at": "2021-11-04T01:14:18Z",
33      "request_url": "https://api.example.com/webhook",
34      "request_headers": {
35        "Accept": "application/json",
36        "Content-Type": "application/json",
37        "User-Agent": "Go-http-client/1.1"
38      },
39      "request_body": "{\"key\":\"value\"}",
40      "response_code": 404,
41      "response_headers": {
42        "Content-Type": "application/json; charset=utf-8",
43        "Date": "Tue, 02 Nov 2021 23:37:55 GMT",
44        "Server": "nginx/1.19.6",
45        "X-Content-Type-Options": "nosniff",
46        "X-Frame-Options": "SAMEORIGIN",
47        "X-Request-Id": "a1b2c3d4e5f6g7h8i9j0",
48        "X-Runtime": "0.001000",
49        "X-Xss-Protection": "1; mode=block"
50      },
51      "total_time": 122
52    }
53  ]
54}

Retrieve a Payload

A Payload can be retrieved by Event ID and payload ID.

Request Parameters

id of Event
i.e. evt_...
id of Payload
i.e. payload_...
GET /events/:event_id/payloads/:payload_id
1curl -X GET https://api.easypost.com/v2/events/evt_.../payloads/payload_... \
2  -u "EASYPOST_API_KEY":
Response
1{
2  "id": "payload_734d47163d0711ecb29421da38a2f124",
3  "object": "Payload",
4  "created_at": "2021-11-04T00:37:55Z",
5  "updated_at": "2021-11-04T01:14:18Z",
6  "request_url": "https://api.example.com/webhook",
7  "request_headers": {
8    "Accept": "application/json",
9    "Content-Type": "application/json",
10    "User-Agent": "Go-http-client/1.1"
11  },
12  "request_body": "{\"key\":\"value\"}",
13  "response_code": 200,
14  "response_headers": {
15    "Content-Type": "application/json; charset=utf-8",
16    "Date": "Tue, 02 Nov 2021 23:37:55 GMT",
17    "Server": "nginx/1.19.6",
18    "X-Content-Type-Options": "nosniff",
19    "X-Frame-Options": "SAMEORIGIN",
20    "X-Request-Id": "a1b2c3d4e5f6g7h8i9j0",
21    "X-Runtime": "0.001000",
22    "X-Xss-Protection": "1; mode=block"
23  },
24  "total_time": 34
25}