GPS Tracking API
We currently do not support this API. If you are interested in this API, please request for an integration .
GPS Last Checkpoint API
We currently do not support this API. If you are interested in this API, please request for an integration .
GPS Estimated delivery date API
We currently do not support this API. If you are interested in this API, please request for an integration .
GPS Rate API
Get a rate
Get rate
Parameters
idstring required
Rate id
Returns
metaMetacodeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataRateRecord
RateRecord object: the description of rates informationcreated_atstring
the timestamp of created_at, example: 2022-05-18T09:17:38+00:00idstring
rate idupdated_atstring
the timestamp of updated_at, example: 2022-05-18T09:17:38+00:00statusstring
Allowed values:calculatingcalculatedfailedratesarray[Rate]
rates array
curl --request GET \
--url https://api.aftership.com/postmen/v3/rates/id \
--header 'Content-Type: application/json'const url = 'https://api.aftership.com/postmen/v3/rates/id';
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: undefined
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/rates/id"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/rates/id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.get('https://api.aftership.com/postmen/v3/rates/id', headers=headers){
"meta": {
"code": 200,
"type": "OK",
"message": "Everything worked as expected."
},
"data": {
"id": "ad1f9340-608d-4a30-be0e-b0a62e07e4cc",
"rates": [
{
"charge_weight": {
"value": 1.5,
"unit": "kg"
},
"total_charge": {
"amount": 429.57,
"currency": "HKD"
},
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"description": "GPS Sandbox"
},
"service_type": "{service_type}",
"service_name": "{service_name}",
"pickup_deadline": "2015-09-01T18:00:00+00:00",
"booking_cut_off": "2015-09-01T17:00:00+00:00",
"delivery_date": "2015-09-01T23:00:00+00:00",
"transit_time": 1,
"detailed_charges": [
{
"type": "base",
"charge": {
"amount": 387,
"currency": "HKD"
}
},
{
"type": "fuel_surcharge",
"charge": {
"amount": 42.57,
"currency": "HKD"
}
}
],
"error_message": null,
"info_message": null
},
{
"charge_weight": {
"value": 1.5,
"unit": "kg"
},
"total_charge": {
"amount": 528,
"currency": "HKD"
},
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"description": "GPS Sandbox"
},
"service_type": "{service_type}",
"service_name": "{service_name}",
"pickup_deadline": "2015-09-01T18:00:00+00:00",
"booking_cut_off": "2015-09-01T17:00:00+00:00",
"delivery_date": "2015-09-01T23:00:00+00:00",
"transit_time": 1,
"detailed_charges": [
{
"type": "base",
"charge": {
"amount": 528,
"currency": "HKD"
}
}
],
"error_message": null,
"info_message": null
}
],
"status": "calculated",
"created_at": "2015-09-09T07:49:54.060Z",
"updated_at": "2015-09-09T07:49:57.360Z"
}
}Calculate rates
Calculate rates
Parameters
asyncboolean
enable async mode or not (set to false if not provided)is_documentboolean
If the shipment is document type. (set to false if not provided)ship_datestring
Ship Date in YYYY-MM-DD, if not provided, will be today of the shipper account timezoneshipper_accountsarray[object]- id string
shipmentShipment
Shipment object: the description of shipment informationship_fromAddress required
Address object: the description of address informationship_toAddress required
Address object: the description of address informationparcelsarray[Parcel] required
required
Parcels of shipmentreturn_toAddress
Address object: the description of address informationdelivery_instructionsstring
Instructions to aid in prompt delivery of the shipment.
Returns
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataRateRecord
RateRecord object: the description of rates informationcreated_atstring
the timestamp of created_at, example: 2022-05-18T09:17:38+00:00idstring
rate idupdated_atstring
the timestamp of updated_at, example: 2022-05-18T09:17:38+00:00statusstring
Allowed values:calculatingcalculatedfailedratesarray[Rate]
rates array
curl --request POST \
--url https://api.aftership.com/postmen/v3/rates \
--header 'Content-Type: application/json'\
--data '{"shipment":{"ship_to":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"parcels":[{"box_type":"custom","dimension":{"width":10,"height":10,"depth":10,"unit":"cm"},"items":[{"description":"Food Bar","quantity":1,"price":{"currency":"USD","amount":100},"item_id":"1234567","origin_country":"CHN","weight":{"unit":"kg","value":10},"sku":"imac2014","hs_code":"1006.30"}],"description":"Food XS","weight":{"unit":"kg","value":10}}],"ship_from":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"return_to":{"city":"New York","type":"residential","state":"New York","phone":"1-123-456-5496","email":"[email protected]","street1":"This is the first streeet","street2":"This is the second streeet","country":"USA","postal_code":"10001","contact_name":"AfterShip Shipping"},"delivery_instructions":"handle with care"},"shipper_accounts":[{"id":"3ba41ff5-59a7-4ff0-8333-64a4375c7f21"}]}'const url = 'https://api.aftership.com/postmen/v3/rates';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: "{\"shipment\":{\"ship_to\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"parcels\":[{\"box_type\":\"custom\",\"dimension\":{\"width\":10,\"height\":10,\"depth\":10,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"quantity\":1,\"price\":{\"currency\":\"USD\",\"amount\":100},\"item_id\":\"1234567\",\"origin_country\":\"CHN\",\"weight\":{\"unit\":\"kg\",\"value\":10},\"sku\":\"imac2014\",\"hs_code\":\"1006.30\"}],\"description\":\"Food XS\",\"weight\":{\"unit\":\"kg\",\"value\":10}}],\"ship_from\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"return_to\":{\"city\":\"New York\",\"type\":\"residential\",\"state\":\"New York\",\"phone\":\"1-123-456-5496\",\"email\":\"[email protected]\",\"street1\":\"This is the first streeet\",\"street2\":\"This is the second streeet\",\"country\":\"USA\",\"postal_code\":\"10001\",\"contact_name\":\"AfterShip Shipping\"},\"delivery_instructions\":\"handle with care\"},\"shipper_accounts\":[{\"id\":\"3ba41ff5-59a7-4ff0-8333-64a4375c7f21\"}]}"
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/rates"
payload := strings.NewReader("{\"shipment\":{\"ship_to\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"parcels\":[{\"box_type\":\"custom\",\"dimension\":{\"width\":10,\"height\":10,\"depth\":10,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"quantity\":1,\"price\":{\"currency\":\"USD\",\"amount\":100},\"item_id\":\"1234567\",\"origin_country\":\"CHN\",\"weight\":{\"unit\":\"kg\",\"value\":10},\"sku\":\"imac2014\",\"hs_code\":\"1006.30\"}],\"description\":\"Food XS\",\"weight\":{\"unit\":\"kg\",\"value\":10}}],\"ship_from\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"return_to\":{\"city\":\"New York\",\"type\":\"residential\",\"state\":\"New York\",\"phone\":\"1-123-456-5496\",\"email\":\"[email protected]\",\"street1\":\"This is the first streeet\",\"street2\":\"This is the second streeet\",\"country\":\"USA\",\"postal_code\":\"10001\",\"contact_name\":\"AfterShip Shipping\"},\"delivery_instructions\":\"handle with care\"},\"shipper_accounts\":[{\"id\":\"3ba41ff5-59a7-4ff0-8333-64a4375c7f21\"}]}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/rates"))
.method("POST", HttpRequest.BodyPublishers.ofString("{\"shipment\":{\"ship_to\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"parcels\":[{\"box_type\":\"custom\",\"dimension\":{\"width\":10,\"height\":10,\"depth\":10,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"quantity\":1,\"price\":{\"currency\":\"USD\",\"amount\":100},\"item_id\":\"1234567\",\"origin_country\":\"CHN\",\"weight\":{\"unit\":\"kg\",\"value\":10},\"sku\":\"imac2014\",\"hs_code\":\"1006.30\"}],\"description\":\"Food XS\",\"weight\":{\"unit\":\"kg\",\"value\":10}}],\"ship_from\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"return_to\":{\"city\":\"New York\",\"type\":\"residential\",\"state\":\"New York\",\"phone\":\"1-123-456-5496\",\"email\":\"[email protected]\",\"street1\":\"This is the first streeet\",\"street2\":\"This is the second streeet\",\"country\":\"USA\",\"postal_code\":\"10001\",\"contact_name\":\"AfterShip Shipping\"},\"delivery_instructions\":\"handle with care\"},\"shipper_accounts\":[{\"id\":\"3ba41ff5-59a7-4ff0-8333-64a4375c7f21\"}]}"))
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.post('https://api.aftership.com/postmen/v3/rates', headers=headers, json={"shipment":{"ship_to":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"parcels":[{"box_type":"custom","dimension":{"width":10,"height":10,"depth":10,"unit":"cm"},"items":[{"description":"Food Bar","quantity":1,"price":{"currency":"USD","amount":100},"item_id":"1234567","origin_country":"CHN","weight":{"unit":"kg","value":10},"sku":"imac2014","hs_code":"1006.30"}],"description":"Food XS","weight":{"unit":"kg","value":10}}],"ship_from":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"return_to":{"city":"New York","type":"residential","state":"New York","phone":"1-123-456-5496","email":"[email protected]","street1":"This is the first streeet","street2":"This is the second streeet","country":"USA","postal_code":"10001","contact_name":"AfterShip Shipping"},"delivery_instructions":"handle with care"},"shipper_accounts":[{"id":"3ba41ff5-59a7-4ff0-8333-64a4375c7f21"}]}){
"meta": {
"code": 200,
"type": "OK",
"message": "Everything worked as expected."
},
"data": {
"id": "ad1f9340-608d-4a30-be0e-b0a62e07e4cc",
"rates": [
{
"charge_weight": {
"value": 1.5,
"unit": "kg"
},
"total_charge": {
"amount": 429.57,
"currency": "HKD"
},
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"description": "GPS Sandbox"
},
"service_type": "{service_type}",
"service_name": "{service_name}",
"pickup_deadline": "2015-09-01T18:00:00+00:00",
"booking_cut_off": "2015-09-01T17:00:00+00:00",
"delivery_date": "2015-09-01T23:00:00+00:00",
"transit_time": 1,
"detailed_charges": [
{
"type": "base",
"charge": {
"amount": 387,
"currency": "HKD"
}
},
{
"type": "fuel_surcharge",
"charge": {
"amount": 42.57,
"currency": "HKD"
}
}
],
"error_message": null,
"info_message": null
},
{
"charge_weight": {
"value": 1.5,
"unit": "kg"
},
"total_charge": {
"amount": 528,
"currency": "HKD"
},
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"description": "GPS Sandbox"
},
"service_type": "{service_type}",
"service_name": "{service_name}",
"pickup_deadline": "2015-09-01T18:00:00+00:00",
"booking_cut_off": "2015-09-01T17:00:00+00:00",
"delivery_date": "2015-09-01T23:00:00+00:00",
"transit_time": 1,
"detailed_charges": [
{
"type": "base",
"charge": {
"amount": 528,
"currency": "HKD"
}
}
],
"error_message": null,
"info_message": null
}
],
"status": "calculated",
"created_at": "2015-09-09T07:49:54.060Z",
"updated_at": "2015-09-09T07:49:57.360Z"
}
}GPS Label API
Get a label
Get a label.
Parameters
idstring required
label id
Returns
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataLabel
Label object: the description of label objectidstring
Label IDstatusstring
Allowed values:creatingcreatedcancellingcancelledmanifestingmanifestedfailed
curl --request GET \
--url https://api.aftership.com/postmen/v3/labels/id \
--header 'Content-Type: application/json'const url = 'https://api.aftership.com/postmen/v3/labels/id';
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: undefined
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/labels/id"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/labels/id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.get('https://api.aftership.com/postmen/v3/labels/id', headers=headers){
"meta": {
"code": 200,
"type": "OK",
"message": "Everything worked as expected."
},
"data": {
"id": "3318b97b-150f-4205-840d-a6d966b9e0ea",
"rate": {
"total_charge": {
"amount": 0,
"currency": "USD"
},
"service_type": "{service_type}",
"service_name": "{service_name}",
"transit_time": null,
"info_message": null,
"charge_weight": {
"unit": "lb",
"value": 3.307
},
"delivery_date": null,
"error_message": null,
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"description": "GPS Sandbox"
},
"pickup_deadline": null,
"booking_cut_off": null,
"detailed_charges": []
},
"files": {
"label": {
"url": "https://sandbox-download.postmen.com/label/2015-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf",
"paper_size": "4x8"
},
"invoice": null,
"manifest": null,
"customs_declaration": null
},
"status": "created",
"ship_date": "2015-09-09",
"created_at": "2015-09-09T07:54:13.024Z",
"updated_at": "2015-09-09T07:54:24.569Z",
"tracking_numbers": [
"3884930103"
]
}
}Create a label
Create a label.
Parameters
billingBilling
Billing object: the description of billing informationpaid_bystring required
Allowed values:shipperthird_partyrecipientmethodPaymentMethodAccount
PaymentMethodAccount object: the description of account information
customsCustoms
Customs object: the description of customs informationpurposestring required
Allowed values:giftmerchandisepersonalsamplereturnrepairnon-merchandiseterms_of_tradestring
Allowed values:datdduddpdapexwfcafobcipcifcptcfrdpueeione of: AES
AES object: the description of EEI Type - aesbillingBilling
Billing object: the description of billing informationimporter_addressAddress
Address object: the description of address informationpassportobject
Passport Objectadditional_chargesarray[object]
This array contains additional_charges object. Additional charge to be added to the commercial invoice of this shipment. Only applies to FedEx, DHL, UPS currently.
shipmentShipment
Shipment object: the description of shipment informationship_fromAddress required
Address object: the description of address informationship_to Addressrequired
Address object: the description of address informationparcelsarray[Parcel] required
Parcels of shipmentreturn_toAddress
Address object: the description of address informationdelivery_instructionsstring
Instructions to aid in prompt delivery of the shipment.
Return
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataLabel
Label object: the description of label objectidstring
Label IDstatusstring
Allowed values:creatingcreatedcancellingcancelledmanifestingmanifestedfailedship_datestringtracking_numbersarray[string]
curl --request POST \
--url https://api.aftership.com/postmen/v3/labels \
--header 'Content-Type: application/json'\
--data '{"shipment":{"ship_to":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"parcels":[{"box_type":"custom","dimension":{"width":10,"height":10,"depth":10,"unit":"cm"},"items":[{"description":"Food Bar","quantity":1,"price":{"currency":"USD","amount":100},"item_id":"1234567","origin_country":"CHN","weight":{"unit":"kg","value":1},"sku":"imac2014","hs_code":"100630","return_reason":"too big"}],"description":"Food XS","weight":{"unit":"kg","value":1}}],"ship_from":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"}},"paper_size":"4x6","references":["refernce1"],"is_document":false,"service_type":"usps-discounted_express_mail","custom_fields":{"ship_code":"01"},"return_shipment":false,"shipper_account":{"id":"3ba41ff5-59a7-4ff0-8333-64a4375c7f21"}}'const url = 'https://api.aftership.com/postmen/v3/labels';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: "{\"shipment\":{\"ship_to\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"parcels\":[{\"box_type\":\"custom\",\"dimension\":{\"width\":10,\"height\":10,\"depth\":10,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"quantity\":1,\"price\":{\"currency\":\"USD\",\"amount\":100},\"item_id\":\"1234567\",\"origin_country\":\"CHN\",\"weight\":{\"unit\":\"kg\",\"value\":1},\"sku\":\"imac2014\",\"hs_code\":\"100630\",\"return_reason\":\"too big\"}],\"description\":\"Food XS\",\"weight\":{\"unit\":\"kg\",\"value\":1}}],\"ship_from\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"}},\"paper_size\":\"4x6\",\"references\":[\"refernce1\"],\"is_document\":false,\"service_type\":\"usps-discounted_express_mail\",\"custom_fields\":{\"ship_code\":\"01\"},\"return_shipment\":false,\"shipper_account\":{\"id\":\"3ba41ff5-59a7-4ff0-8333-64a4375c7f21\"}}"
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/labels"
payload := strings.NewReader("{\"shipment\":{\"ship_to\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"parcels\":[{\"box_type\":\"custom\",\"dimension\":{\"width\":10,\"height\":10,\"depth\":10,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"quantity\":1,\"price\":{\"currency\":\"USD\",\"amount\":100},\"item_id\":\"1234567\",\"origin_country\":\"CHN\",\"weight\":{\"unit\":\"kg\",\"value\":1},\"sku\":\"imac2014\",\"hs_code\":\"100630\",\"return_reason\":\"too big\"}],\"description\":\"Food XS\",\"weight\":{\"unit\":\"kg\",\"value\":1}}],\"ship_from\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"}},\"paper_size\":\"4x6\",\"references\":[\"refernce1\"],\"is_document\":false,\"service_type\":\"usps-discounted_express_mail\",\"custom_fields\":{\"ship_code\":\"01\"},\"return_shipment\":false,\"shipper_account\":{\"id\":\"3ba41ff5-59a7-4ff0-8333-64a4375c7f21\"}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/labels"))
.method("POST", HttpRequest.BodyPublishers.ofString("{\"shipment\":{\"ship_to\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"parcels\":[{\"box_type\":\"custom\",\"dimension\":{\"width\":10,\"height\":10,\"depth\":10,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"quantity\":1,\"price\":{\"currency\":\"USD\",\"amount\":100},\"item_id\":\"1234567\",\"origin_country\":\"CHN\",\"weight\":{\"unit\":\"kg\",\"value\":1},\"sku\":\"imac2014\",\"hs_code\":\"100630\",\"return_reason\":\"too big\"}],\"description\":\"Food XS\",\"weight\":{\"unit\":\"kg\",\"value\":1}}],\"ship_from\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"}},\"paper_size\":\"4x6\",\"references\":[\"refernce1\"],\"is_document\":false,\"service_type\":\"usps-discounted_express_mail\",\"custom_fields\":{\"ship_code\":\"01\"},\"return_shipment\":false,\"shipper_account\":{\"id\":\"3ba41ff5-59a7-4ff0-8333-64a4375c7f21\"}}"))
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.post('https://api.aftership.com/postmen/v3/labels', headers=headers, json={"shipment":{"ship_to":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"parcels":[{"box_type":"custom","dimension":{"width":10,"height":10,"depth":10,"unit":"cm"},"items":[{"description":"Food Bar","quantity":1,"price":{"currency":"USD","amount":100},"item_id":"1234567","origin_country":"CHN","weight":{"unit":"kg","value":1},"sku":"imac2014","hs_code":"100630","return_reason":"too big"}],"description":"Food XS","weight":{"unit":"kg","value":1}}],"ship_from":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"}},"paper_size":"4x6","references":["refernce1"],"is_document":False,"service_type":"usps-discounted_express_mail","custom_fields":{"ship_code":"01"},"return_shipment":False,"shipper_account":{"id":"3ba41ff5-59a7-4ff0-8333-64a4375c7f21"}}){
"meta": {
"code": 200,
"message": "OK",
"details": []
},
"data": {
"id": "3318b97b-150f-4205-840d-a6d966b9e0ea",
"rate": {
"total_charge": {
"amount": 0,
"currency": "USD"
},
"service_type": "{service_type}",
"service_name": "{service_name}",
"transit_time": null,
"info_message": null,
"charge_weight": {
"unit": "lb",
"value": 3.307
},
"delivery_date": null,
"error_message": null,
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"description": "GPS Sandbox"
},
"pickup_deadline": null,
"booking_cut_off": null,
"detailed_charges": []
},
"files": {
"label": {
"url": "https://sandbox-download.postmen.com/label/2015-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf",
"paper_size": "4x8"
},
"invoice": null,
"manifest": null,
"customs_declaration": null
},
"status": "created",
"ship_date": "2022-09-09",
"created_at": "2022-05-09T07:54:13.024Z",
"updated_at": "2022-09-09T07:54:24.569Z",
"tracking_numbers": [
"3884930103"
]
},
"custom_fields": {
"ship_code": "01"
}
}GPS Manifest API
We currently do not support this API. If you are interested in this API, please request for an integration .
GPS Cancel Label API
Cancel a label
Cancel a label.
Parameters
labelobjectidstring
Returns
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataobjectidstringstatusstring
Allowed values:cancellingcancelledfailedrefund_statusstringlabelobjectcreated_atstringupdated_atstring
curl --request POST \
--url https://api.aftership.com/postmen/v3/cancel-labels \
--header 'Content-Type: application/json'\
--data '{"label":{"id":"00000000-0000-0000-0000-000000000000"}}'const url = 'https://api.aftership.com/postmen/v3/cancel-labels';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: "{\"label\":{\"id\":\"00000000-0000-0000-0000-000000000000\"}}"
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/cancel-labels"
payload := strings.NewReader("{\"label\":{\"id\":\"00000000-0000-0000-0000-000000000000\"}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/cancel-labels"))
.method("POST", HttpRequest.BodyPublishers.ofString("{\"label\":{\"id\":\"00000000-0000-0000-0000-000000000000\"}}"))
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.post('https://api.aftership.com/postmen/v3/cancel-labels', headers=headers, json={"label":{"id":"00000000-0000-0000-0000-000000000000"}}){
"meta": {
"code": 200,
"type": "OK",
"message": "Everything worked as expected."
},
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"label": {
"id": "00000000-0000-0000-0000-000000000000"
},
"status": "cancelled",
"created_at": "2022-02-11T08:10:47+00:00",
"updated_at": "2022-02-11T08:10:47+00:00"
}
}GPS Pickup API
We currently do not support this API. If you are interested in this API, please request for an integration .
GPS Cancel Pickup API
We currently do not support this API. If you are interested in this API, please request for an integration .
GPS Shipper Account API
Create a shipper account
This endpoint allows you to create your shipper account via API. You can integrate our API with your system and manage the shipper account according to your needs.
Please ensure that your account credentials are correct. Different carriers have different requirements for account credentials, you can refer to Shipper account's credetials for more details.
Parameters
slugstringgpsdescriptionstringtimezonestringcredentialsobject
Please refer to Shipper account's credetialsaddressAddress
Address object: the description of address informationstreet1string required
address_line1 of addresscountrystring required
Country in ISO 3166-1 alpha 3 codecontact_namestring required
contact_name of address
Returns
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataShipperAccount
ShipperAccount object: the description of shipper account informationidstring
Shipper Account IDaddressAddress
Address object: the description of address information
curl --request POST \
--url https://api.aftership.com/postmen/v3/shipper-accounts \
--header 'Content-Type: application/json'\
--data '{"slug":"dhl","address":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"timezone":"Asia/Hong_Kong","description":"My Shipper Account","credentials":{"site_id":"******","password":"******","account_number":"******"}}'const url = 'https://api.aftership.com/postmen/v3/shipper-accounts';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: "{\"slug\":\"dhl\",\"address\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"timezone\":\"Asia/Hong_Kong\",\"description\":\"My Shipper Account\",\"credentials\":{\"site_id\":\"******\",\"password\":\"******\",\"account_number\":\"******\"}}"
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/shipper-accounts"
payload := strings.NewReader("{\"slug\":\"dhl\",\"address\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"timezone\":\"Asia/Hong_Kong\",\"description\":\"My Shipper Account\",\"credentials\":{\"site_id\":\"******\",\"password\":\"******\",\"account_number\":\"******\"}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/shipper-accounts"))
.method("POST", HttpRequest.BodyPublishers.ofString("{\"slug\":\"dhl\",\"address\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"},\"timezone\":\"Asia/Hong_Kong\",\"description\":\"My Shipper Account\",\"credentials\":{\"site_id\":\"******\",\"password\":\"******\",\"account_number\":\"******\"}}"))
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.post('https://api.aftership.com/postmen/v3/shipper-accounts', headers=headers, json={"slug":"dhl","address":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"},"timezone":"Asia/Hong_Kong","description":"My Shipper Account","credentials":{"site_id":"******","password":"******","account_number":"******"}}){
"meta": {
"code": 200,
"message": "OK",
"details": []
},
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"type": "default",
"status": "enabled",
"address": {
"fax": "+1 206-654-3100",
"city": "Lai Chi Kok",
"type": "business",
"phone": "11111111",
"email": "[email protected]",
"state": null,
"tax_id": null,
"country": "HKG",
"street1": "Workshop A, 10/F, Wah Shing Industrial Building",
"street2": "18 Cheung Shun Street, Lai Chi Kok",
"street3": null,
"postal_code": null,
"contact_name": "Sir Foo",
"company_name": "Foo Store"
},
"timezone": "Asia/Hong_Kong",
"created_at": "2016-02-12T10:30:50+00:00",
"updated_at": "2016-09-23T04:56:26+00:00",
"description": "My Shipper Account"
}
}Get a shipper account
This endpoint allows you get a specific shipper account details by shipper account id.
Parameters
idstring required
Shipper account id
Returns
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataShipperAccount
ShipperAccount object: the description of shipper account informationidstring
Shipper Account IDaddressAddress
Address object: the description of address information
curl --request GET \
--url https://api.aftership.com/postmen/v3/shipper-accounts/id \
--header 'Content-Type: application/json'const url = 'https://api.aftership.com/postmen/v3/shipper-accounts/id';
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: undefined
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/shipper-accounts/id"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/shipper-accounts/id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.get('https://api.aftership.com/postmen/v3/shipper-accounts/id', headers=headers){
"meta": {
"code": 200,
"type": "OK",
"message": "Everything worked as expected."
},
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "gps",
"type": "default",
"status": "enabled",
"address": {
"fax": "+1 206-654-3100",
"city": "Lai Chi Kok",
"type": "business",
"phone": "11111111",
"email": "[email protected]",
"state": null,
"tax_id": null,
"country": "HKG",
"street1": "Workshop A, 10/F, Wah Shing Industrial Building",
"street2": "18 Cheung Shun Street, Lai Chi Kok",
"street3": null,
"postal_code": null,
"contact_name": "Sir Foo",
"company_name": "Foo Store"
},
"timezone": "Asia/Hong_Kong",
"created_at": "2016-02-12T10:30:50+00:00",
"updated_at": "2016-09-23T04:56:26+00:00",
"description": "My Shipper Account"
}
}GPS Address Validation (Beta) API
Create an address validation
Create an address validation
Parameters
addressAddress
Address object: the description of address informationstreet1string required
address_line1 of addresscountrystring required
Country in ISO 3166-1 alpha 3 codecontact\_namestring required
contact_name of address
Returns
metaMeta
Meta data object.codeinteger required
Code of Metamessagestring required
Message of Metadetailsarray[Error]
Details of Metaretryableboolean
Whether this request will be retryable or not
dataShipperAccount
ShipperAccount object: the description of shipper account informationidstring
Shipper Account IDaddressAddress
Address object: the description of address information
curl --request POST \
--url https://api.aftership.com/postmen/v3/address-validations \
--header 'Content-Type: application/json'\
--data '{"address":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"}}'const url = 'https://api.aftership.com/postmen/v3/address-validations';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: "{\"address\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"}}"
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aftership.com/postmen/v3/address-validations"
payload := strings.NewReader("{\"address\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.aftership.com/postmen/v3/address-validations"))
.method("POST", HttpRequest.BodyPublishers.ofString("{\"address\":{\"city\":\"Salt Lake City\",\"state\":\"UT\",\"phone\":\"123456789\",\"email\":\"[email protected]\",\"street1\":\"230 W 200 S LBBY\",\"country\":\"USA\",\"postal_code\":\"84101\",\"contact_name\":\"AfterShip Shipping\",\"company_name\":\"AfterShip Shipping\"}}"))
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());import requests
headers = {
'Content-Type': 'application/json',
}
response = requests.post('https://api.aftership.com/postmen/v3/address-validations', headers=headers, json={"address":{"city":"Salt Lake City","state":"UT","phone":"123456789","email":"[email protected]","street1":"230 W 200 S LBBY","country":"USA","postal_code":"84101","contact_name":"AfterShip Shipping","company_name":"AfterShip Shipping"}}){
"meta": {
"code": 200,
"type": "OK",
"message": "Everything worked as expected."
},
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"status": "valid",
"address": {
"city": "New York",
"type": "residential",
"state": "New York",
"phone": "1-123-456-5496",
"email": "[email protected]",
"street1": "This is the first streeet",
"street2": "This is the second streeet",
"country": "USA",
"postal_code": "10001",
"contact_name": "AfterShip Shipping"
},
"created_at": "2022-02-11T08:10:47+00:00",
"updated_at": "2022-02-11T08:10:47+00:00",
"recommended_address": {
"city": "New York",
"type": "residential",
"state": "New York",
"phone": "1-123-456-5496",
"email": "[email protected]",
"street1": "This is the first streeet",
"street2": "This is the second streeet",
"country": "USA",
"postal_code": "10001",
"contact_name": "AfterShip Shipping"
}
}
}