Using ShipEngine on Behalf of an Account

Once you've created a ShipEngine account, the next step is to make ShipEngine API calls on behalf of that account. You can perform any ShipEngine operation on behalf of your customer, such as:

The On-Behalf-Of Header

All calls to the ShipEngine API will require the following two headers:

Header NameDescription
API-KeyThis is your ShipEngine Partner API key. See the Getting Started page for details.
On-Behalf-OfThis is the API Key of the ShipEngine account that you are operating on behalf of.

Example

POST /v1/labels

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
POST /v1/labels HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
On-Behalf-Of: __CUSTOMER_API_KEY_HERE__
Content-Type: application/json
{
"shipment": {
"service_code": "usps_priority_mail",
"ship_to": {
"name": "Mickey and Minnie Mouse",
"phone": "+1 (714) 781-4565",
"company_name": "The Walt Disney Company",
"address_line1": "500 South Buena Vista Street",
"city_locality": "Burbank",
"state_province": "CA",
"postal_code": "91521",
"country_code": "US",
"address_residential_indicator": "No"
},
"ship_from": {
"name": "Shippy",
"phone": "512-485-4282",
"company_name": "ShipEngine",
"address_line1": "3800 N. Lamar Blvd.",
"address_line2": "Suite 220",
"city_locality": "Austin",
"state_province": "TX",
"postal_code": "78756",
"country_code": "US",
"address_residential_indicator": "No"
},
"packages": [
{
"weight": {
"value": 1.0,
"unit": "ounce"
}
}
]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
"label_id": "se-202887313",
"status": "completed",
"shipment_id": "se-202887313",
"ship_date": "2019-04-01T05:00:00.000Z",
"created_at": "2019-04-01T20:46:31.168Z",
"shipment_cost": {
"currency": "USD",
"amount": 6.86
},
"insurance_cost": {
"currency": "USD",
"amount": 0.0
},
"tracking_number": "9405511899560441854156",
"is_return_label": false,
"is_international": false,
"batch_id": "",
"carrier_id": "se-123890",
"service_code": "usps_priority_mail",
"package_code": "package",
"voided": false,
"label_format": "pdf",
"label_layout": "4x6",
"trackable": false,
"carrier_code": "stamps_com",
"tracking_status": "unknown",
"label_download": {
"href": "https://api.shipengine.com/v1/downloads/aFbxNUVCZ0SDHHp-BmcKjA/testlabel-202887313.pdf"
},
"form_download": null,
"insurance_claim": null,
"packages": [
{
"package_code": "package",
"weight": {
"value": 1.00,
"unit": "ounce"
},
"dimensions": {
"unit": "inch",
"length": 0.0,
"width": 0.0,
"height": 0.0
},
"insured_value": {
"currency": "usd",
"amount": 0.00
},
"tracking_number": null,
"label_messages": {
"reference1": null,
"reference2": null,
"reference3": null
}
}
]
}