Create a label
Name | Type | Description |
---|---|---|
service_type * | string | Service Types Accepts: sf-express-isp_america_direct_ship ,sf-express-isp_cloud_warehouse_next_day_delivery ,sf-express-isp_cloud_warehouse_third_day_delivery ,sf-express-isp_ecommerce_economy_express ,sf-express-isp_ecommerce_express ,sf-express-isp_ecommerce_special_delivery ,sf-express-isp_economy_express ,sf-express-isp_international_ecommerce_special_delivery ,sf-express-isp_international_economy_express_document ,sf-express-isp_international_economy_express_merchant_agent ,sf-express-isp_international_economy_express_parcel ,sf-express-isp_international_economy_express_pilot ,sf-express-isp_international_heavy_freight ,sf-express-isp_international_small_parcel ,sf-express-isp_international_standard_express_document ,sf-express-isp_international_standard_express_parcel ,sf-express-isp_next_morning_delivery ,sf-express-isp_register_mail ,sf-express-isp_same_day_delivery ,sf-express-isp_standard_express . |
shipper_account * | reference | Object reference |
shipment * | shipment | An instance of shipping freight or cargo |
async | boolean | enable async mode or not (set to false if not provided) |
return_shipment | boolean | (set to false if not provided) |
paper_size | string | Label Paper Size Accepts: default . (set to "default" if not provided) |
file_type | string | Label file type Accepts: pdf . (set to "pdf" if not provided) |
ship_date | string | Ship Date in YYYY-MM-DD, if not provided, will be today of the shipper account timezone |
service_options | array of service option - insurance or service option - pickup | Service options |
is_document | boolean | If the shipment is document type. (set to false if not provided) |
invoice | invoice | Invoice object, used to describe invoice type. Optional. Commercial invoice will be generated if field is present in the request body, else not. |
references | array of strings | Reference numbers for a label |
billing | billing | Billing Object |
customs | customs | Customs Object |
order_number | string | A user-defined order number used to identify an order. |
order_id | string | Unique identification of the order. |
{
"async": false,
"return_shipment": false,
"paper_size": "default",
"service_type": "sf-express-isp_standard_express",
"is_document": false,
"order_number": "123456789",
"service_options": [
{
"type": "insurance",
"insured_value": {
"amount": 500,
"currency": "USD"
}
},
{
"type": "pickup",
"start_time": "11:12:11",
"end_time": "18:00:23"
}
],
"invoice": {
"date": "2019-10-11"
},
"references": [
"13N11ME-MP"
],
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000"
},
"customs": {
"billing": {
"paid_by": "recipient",
"method": {
"type": "account",
"account_number": "AA00888AAAABBBB"
}
},
"terms_of_trade": "ddu",
"purpose": "merchandise"
},
"billing": {
"paid_by": "shipper"
},
"shipment": {
"ship_from": {
"contact_name": "美瑞克斯旗舰店",
"phone": "400-990-1111",
"company_name": "aftership(深圳)",
"street1": "郑州市经济开发区经北二路第九大街东500",
"city": "郑州市",
"email": "aaa@test.com",
"state": "河南省",
"postal_code": "450000",
"country": "CHN",
"type": "business"
},
"ship_to": {
"contact_name": "Panda",
"company_name": "Panda(TWN.Company)",
"phone": "+886-48331889-1111",
"email": "Panda@test.com",
"state": "广东省",
"street1": "深圳市粤兴三道112号",
"city": "深圳市",
"postal_code": "518000",
"country": "CHN",
"type": "residential"
},
"parcels": [
{
"description": "iMac (Retina 5K, 27-inch, Late 2014)",
"box_type": "custom",
"weight": {
"value": 9.84,
"unit": "kg"
},
"dimension": {
"width": 65,
"height": 52,
"depth": 21,
"unit": "cm"
},
"items": [
{
"description": "iMac (Retina 5K, 27-inch, Late 2017)",
"origin_country": "USA",
"quantity": 1,
"price": {
"amount": 1999,
"currency": "CNY"
},
"weight": {
"value": 9.54,
"unit": "kg"
},
"sku": "imac2014"
},
{
"description": "Google Nexus 10",
"origin_country": "USA",
"quantity": 1,
"sku": "google man",
"price": {
"amount": 550,
"currency": "CNY"
},
"weight": {
"value": 0.3,
"unit": "kg"
}
}
]
},
{
"box_type": "custom",
"weight": {
"unit": "kg",
"value": 1.2
},
"dimension": {
"depth": 15,
"width": 10,
"height": 1,
"unit": "in"
},
"items": [
{
"description": "Samsung Galaxy Tab wifi 3G 64GB black",
"origin_country": "USA",
"quantity": 2,
"price": {
"amount": 50,
"currency": "CNY"
},
"weight": {
"value": 0.6,
"unit": "kg"
},
"sku": "Epic_Food_Bar",
"hs_code": "215155"
}
]
},
{
"box_type": "custom",
"weight": {
"unit": "kg",
"value": 1.6
},
"dimension": {
"depth": 5,
"width": 4,
"height": 3,
"unit": "cm"
},
"items": [
{
"description": "Samsung Galaxy Tab wifi 3G 64GB white",
"origin_country": "HKG",
"quantity": 2,
"price": {
"amount": 40,
"currency": "CNY"
},
"weight": {
"value": 0.4,
"unit": "kg"
},
"hs_code": "23528222"
},
{
"description": "Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver",
"origin_country": "HKG",
"quantity": 2,
"price": {
"amount": 40,
"currency": "CNY"
},
"weight": {
"value": 0.4,
"unit": "kg"
},
"hs_code": "23528222"
}
]
}
]
}
}
curl --request POST \
--url https://sandbox-api.postmen.com/v3/labels \
--header 'content-type: application/json' \
--header 'postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e' \
--data '{"async":false,"return_shipment":false,"paper_size":"default","service_type":"sf-express-isp_standard_express","is_document":false,"order_number":"123456789","service_options":[{"type":"insurance","insured_value":{"amount":500,"currency":"USD"}},{"type":"pickup","start_time":"11:12:11","end_time":"18:00:23"}],"invoice":{"date":"2019-10-11"},"references":["13N11ME-MP"],"shipper_account":{"id":"00000000-0000-0000-0000-000000000000"},"customs":{"billing":{"paid_by":"recipient","method":{"type":"account","account_number":"AA00888AAAABBBB"}},"terms_of_trade":"ddu","purpose":"merchandise"},"billing":{"paid_by":"shipper"},"shipment":{"ship_from":{"contact_name":"美瑞克斯旗舰店","phone":"400-990-1111","company_name":"aftership(深圳)","street1":"郑州市经济开发区经北二路第九大街东500","city":"郑州市","email":"aaa@test.com","state":"河南省","postal_code":"450000","country":"CHN","type":"business"},"ship_to":{"contact_name":"Panda","company_name":"Panda(TWN.Company)","phone":"+886-48331889-1111","email":"Panda@test.com","state":"广东省","street1":"深圳市粤兴三道112号","city":"深圳市","postal_code":"518000","country":"CHN","type":"residential"},"parcels":[{"description":"iMac (Retina 5K, 27-inch, Late 2014)","box_type":"custom","weight":{"value":9.84,"unit":"kg"},"dimension":{"width":65,"height":52,"depth":21,"unit":"cm"},"items":[{"description":"iMac (Retina 5K, 27-inch, Late 2017)","origin_country":"USA","quantity":1,"price":{"amount":1999,"currency":"CNY"},"weight":{"value":9.54,"unit":"kg"},"sku":"imac2014"},{"description":"Google Nexus 10","origin_country":"USA","quantity":1,"sku":"google man","price":{"amount":550,"currency":"CNY"},"weight":{"value":0.3,"unit":"kg"}}]},{"box_type":"custom","weight":{"unit":"kg","value":1.2},"dimension":{"depth":15,"width":10,"height":1,"unit":"in"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB black","origin_country":"USA","quantity":2,"price":{"amount":50,"currency":"CNY"},"weight":{"value":0.6,"unit":"kg"},"sku":"Epic_Food_Bar","hs_code":"215155"}]},{"box_type":"custom","weight":{"unit":"kg","value":1.6},"dimension":{"depth":5,"width":4,"height":3,"unit":"cm"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB white","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"},{"description":"Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"}]}]}}'
using System;
using System.Net;
using System.IO;
class ExamplePostmen
{
static void Main(string[] args)
{
WebRequest httpWebRequest = WebRequest.Create("https://sandbox-api.postmen.com/v3/labels");
string json = "{\"async\":false,\"return_shipment\":false,\"paper_size\":\"default\",\"service_type\":\"sf-express-isp_standard_express\",\"is_document\":false,\"order_number\":\"123456789\",\"service_options\":[{\"type\":\"insurance\",\"insured_value\":{\"amount\":500,\"currency\":\"USD\"}},{\"type\":\"pickup\",\"start_time\":\"11:12:11\",\"end_time\":\"18:00:23\"}],\"invoice\":{\"date\":\"2019-10-11\"},\"references\":[\"13N11ME-MP\"],\"shipper_account\":{\"id\":\"00000000-0000-0000-0000-000000000000\"},\"customs\":{\"billing\":{\"paid_by\":\"recipient\",\"method\":{\"type\":\"account\",\"account_number\":\"AA00888AAAABBBB\"}},\"terms_of_trade\":\"ddu\",\"purpose\":\"merchandise\"},\"billing\":{\"paid_by\":\"shipper\"},\"shipment\":{\"ship_from\":{\"contact_name\":\"美瑞克斯旗舰店\",\"phone\":\"400-990-1111\",\"company_name\":\"aftership(深圳)\",\"street1\":\"郑州市经济开发区经北二路第九大街东500\",\"city\":\"郑州市\",\"email\":\"aaa@test.com\",\"state\":\"河南省\",\"postal_code\":\"450000\",\"country\":\"CHN\",\"type\":\"business\"},\"ship_to\":{\"contact_name\":\"Panda\",\"company_name\":\"Panda(TWN.Company)\",\"phone\":\"+886-48331889-1111\",\"email\":\"Panda@test.com\",\"state\":\"广东省\",\"street1\":\"深圳市粤兴三道112号\",\"city\":\"深圳市\",\"postal_code\":\"518000\",\"country\":\"CHN\",\"type\":\"residential\"},\"parcels\":[{\"description\":\"iMac (Retina 5K, 27-inch, Late 2014)\",\"box_type\":\"custom\",\"weight\":{\"value\":9.84,\"unit\":\"kg\"},\"dimension\":{\"width\":65,\"height\":52,\"depth\":21,\"unit\":\"cm\"},\"items\":[{\"description\":\"iMac (Retina 5K, 27-inch, Late 2017)\",\"origin_country\":\"USA\",\"quantity\":1,\"price\":{\"amount\":1999,\"currency\":\"CNY\"},\"weight\":{\"value\":9.54,\"unit\":\"kg\"},\"sku\":\"imac2014\"},{\"description\":\"Google Nexus 10\",\"origin_country\":\"USA\",\"quantity\":1,\"sku\":\"google man\",\"price\":{\"amount\":550,\"currency\":\"CNY\"},\"weight\":{\"value\":0.3,\"unit\":\"kg\"}}]},{\"box_type\":\"custom\",\"weight\":{\"unit\":\"kg\",\"value\":1.2},\"dimension\":{\"depth\":15,\"width\":10,\"height\":1,\"unit\":\"in\"},\"items\":[{\"description\":\"Samsung Galaxy Tab wifi 3G 64GB black\",\"origin_country\":\"USA\",\"quantity\":2,\"price\":{\"amount\":50,\"currency\":\"CNY\"},\"weight\":{\"value\":0.6,\"unit\":\"kg\"},\"sku\":\"Epic_Food_Bar\",\"hs_code\":\"215155\"}]},{\"box_type\":\"custom\",\"weight\":{\"unit\":\"kg\",\"value\":1.6},\"dimension\":{\"depth\":5,\"width\":4,\"height\":3,\"unit\":\"cm\"},\"items\":[{\"description\":\"Samsung Galaxy Tab wifi 3G 64GB white\",\"origin_country\":\"HKG\",\"quantity\":2,\"price\":{\"amount\":40,\"currency\":\"CNY\"},\"weight\":{\"value\":0.4,\"unit\":\"kg\"},\"hs_code\":\"23528222\"},{\"description\":\"Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver\",\"origin_country\":\"HKG\",\"quantity\":2,\"price\":{\"amount\":40,\"currency\":\"CNY\"},\"weight\":{\"value\":0.4,\"unit\":\"kg\"},\"hs_code\":\"23528222\"}]}]}}";
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
httpWebRequest.Headers["postmen-api-key"] = "8fc7966b-679b-4a57-911d-c5a663229c9e";
using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
import com.squareup.okhttp.*;
public class test {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"async\":false,\"return_shipment\":false,\"paper_size\":\"default\",\"service_type\":\"sf-express-isp_standard_express\",\"is_document\":false,\"order_number\":\"123456789\",\"service_options\":[{\"type\":\"insurance\",\"insured_value\":{\"amount\":500,\"currency\":\"USD\"}},{\"type\":\"pickup\",\"start_time\":\"11:12:11\",\"end_time\":\"18:00:23\"}],\"invoice\":{\"date\":\"2019-10-11\"},\"references\":[\"13N11ME-MP\"],\"shipper_account\":{\"id\":\"00000000-0000-0000-0000-000000000000\"},\"customs\":{\"billing\":{\"paid_by\":\"recipient\",\"method\":{\"type\":\"account\",\"account_number\":\"AA00888AAAABBBB\"}},\"terms_of_trade\":\"ddu\",\"purpose\":\"merchandise\"},\"billing\":{\"paid_by\":\"shipper\"},\"shipment\":{\"ship_from\":{\"contact_name\":\"美瑞克斯旗舰店\",\"phone\":\"400-990-1111\",\"company_name\":\"aftership(深圳)\",\"street1\":\"郑州市经济开发区经北二路第九大街东500\",\"city\":\"郑州市\",\"email\":\"aaa@test.com\",\"state\":\"河南省\",\"postal_code\":\"450000\",\"country\":\"CHN\",\"type\":\"business\"},\"ship_to\":{\"contact_name\":\"Panda\",\"company_name\":\"Panda(TWN.Company)\",\"phone\":\"+886-48331889-1111\",\"email\":\"Panda@test.com\",\"state\":\"广东省\",\"street1\":\"深圳市粤兴三道112号\",\"city\":\"深圳市\",\"postal_code\":\"518000\",\"country\":\"CHN\",\"type\":\"residential\"},\"parcels\":[{\"description\":\"iMac (Retina 5K, 27-inch, Late 2014)\",\"box_type\":\"custom\",\"weight\":{\"value\":9.84,\"unit\":\"kg\"},\"dimension\":{\"width\":65,\"height\":52,\"depth\":21,\"unit\":\"cm\"},\"items\":[{\"description\":\"iMac (Retina 5K, 27-inch, Late 2017)\",\"origin_country\":\"USA\",\"quantity\":1,\"price\":{\"amount\":1999,\"currency\":\"CNY\"},\"weight\":{\"value\":9.54,\"unit\":\"kg\"},\"sku\":\"imac2014\"},{\"description\":\"Google Nexus 10\",\"origin_country\":\"USA\",\"quantity\":1,\"sku\":\"google man\",\"price\":{\"amount\":550,\"currency\":\"CNY\"},\"weight\":{\"value\":0.3,\"unit\":\"kg\"}}]},{\"box_type\":\"custom\",\"weight\":{\"unit\":\"kg\",\"value\":1.2},\"dimension\":{\"depth\":15,\"width\":10,\"height\":1,\"unit\":\"in\"},\"items\":[{\"description\":\"Samsung Galaxy Tab wifi 3G 64GB black\",\"origin_country\":\"USA\",\"quantity\":2,\"price\":{\"amount\":50,\"currency\":\"CNY\"},\"weight\":{\"value\":0.6,\"unit\":\"kg\"},\"sku\":\"Epic_Food_Bar\",\"hs_code\":\"215155\"}]},{\"box_type\":\"custom\",\"weight\":{\"unit\":\"kg\",\"value\":1.6},\"dimension\":{\"depth\":5,\"width\":4,\"height\":3,\"unit\":\"cm\"},\"items\":[{\"description\":\"Samsung Galaxy Tab wifi 3G 64GB white\",\"origin_country\":\"HKG\",\"quantity\":2,\"price\":{\"amount\":40,\"currency\":\"CNY\"},\"weight\":{\"value\":0.4,\"unit\":\"kg\"},\"hs_code\":\"23528222\"},{\"description\":\"Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver\",\"origin_country\":\"HKG\",\"quantity\":2,\"price\":{\"amount\":40,\"currency\":\"CNY\"},\"weight\":{\"value\":0.4,\"unit\":\"kg\"},\"hs_code\":\"23528222\"}]}]}}");
Request request = new Request.Builder()
.url("https://sandbox-api.postmen.com/v3/labels")
.post(body)
.addHeader("postmen-api-key", "8fc7966b-679b-4a57-911d-c5a663229c9e")
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
var request = require("request");
var options = {
method: 'POST',
url: 'https://sandbox-api.postmen.com/v3/labels',
headers: {
'content-type': 'application/json',
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e'
},
body: '{"async":false,"return_shipment":false,"paper_size":"default","service_type":"sf-express-isp_standard_express","is_document":false,"order_number":"123456789","service_options":[{"type":"insurance","insured_value":{"amount":500,"currency":"USD"}},{"type":"pickup","start_time":"11:12:11","end_time":"18:00:23"}],"invoice":{"date":"2019-10-11"},"references":["13N11ME-MP"],"shipper_account":{"id":"00000000-0000-0000-0000-000000000000"},"customs":{"billing":{"paid_by":"recipient","method":{"type":"account","account_number":"AA00888AAAABBBB"}},"terms_of_trade":"ddu","purpose":"merchandise"},"billing":{"paid_by":"shipper"},"shipment":{"ship_from":{"contact_name":"美瑞克斯旗舰店","phone":"400-990-1111","company_name":"aftership(深圳)","street1":"郑州市经济开发区经北二路第九大街东500","city":"郑州市","email":"aaa@test.com","state":"河南省","postal_code":"450000","country":"CHN","type":"business"},"ship_to":{"contact_name":"Panda","company_name":"Panda(TWN.Company)","phone":"+886-48331889-1111","email":"Panda@test.com","state":"广东省","street1":"深圳市粤兴三道112号","city":"深圳市","postal_code":"518000","country":"CHN","type":"residential"},"parcels":[{"description":"iMac (Retina 5K, 27-inch, Late 2014)","box_type":"custom","weight":{"value":9.84,"unit":"kg"},"dimension":{"width":65,"height":52,"depth":21,"unit":"cm"},"items":[{"description":"iMac (Retina 5K, 27-inch, Late 2017)","origin_country":"USA","quantity":1,"price":{"amount":1999,"currency":"CNY"},"weight":{"value":9.54,"unit":"kg"},"sku":"imac2014"},{"description":"Google Nexus 10","origin_country":"USA","quantity":1,"sku":"google man","price":{"amount":550,"currency":"CNY"},"weight":{"value":0.3,"unit":"kg"}}]},{"box_type":"custom","weight":{"unit":"kg","value":1.2},"dimension":{"depth":15,"width":10,"height":1,"unit":"in"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB black","origin_country":"USA","quantity":2,"price":{"amount":50,"currency":"CNY"},"weight":{"value":0.6,"unit":"kg"},"sku":"Epic_Food_Bar","hs_code":"215155"}]},{"box_type":"custom","weight":{"unit":"kg","value":1.6},"dimension":{"depth":5,"width":4,"height":3,"unit":"cm"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB white","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"},{"description":"Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"}]}]}}'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$url = 'https://sandbox-api.postmen.com/v3/labels';
$method = 'POST';
$headers = array(
"content-type: application/json",
"postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e"
);
$body = '{"async":false,"return_shipment":false,"paper_size":"default","service_type":"sf-express-isp_standard_express","is_document":false,"order_number":"123456789","service_options":[{"type":"insurance","insured_value":{"amount":500,"currency":"USD"}},{"type":"pickup","start_time":"11:12:11","end_time":"18:00:23"}],"invoice":{"date":"2019-10-11"},"references":["13N11ME-MP"],"shipper_account":{"id":"00000000-0000-0000-0000-000000000000"},"customs":{"billing":{"paid_by":"recipient","method":{"type":"account","account_number":"AA00888AAAABBBB"}},"terms_of_trade":"ddu","purpose":"merchandise"},"billing":{"paid_by":"shipper"},"shipment":{"ship_from":{"contact_name":"美瑞克斯旗舰店","phone":"400-990-1111","company_name":"aftership(深圳)","street1":"郑州市经济开发区经北二路第九大街东500","city":"郑州市","email":"aaa@test.com","state":"河南省","postal_code":"450000","country":"CHN","type":"business"},"ship_to":{"contact_name":"Panda","company_name":"Panda(TWN.Company)","phone":"+886-48331889-1111","email":"Panda@test.com","state":"广东省","street1":"深圳市粤兴三道112号","city":"深圳市","postal_code":"518000","country":"CHN","type":"residential"},"parcels":[{"description":"iMac (Retina 5K, 27-inch, Late 2014)","box_type":"custom","weight":{"value":9.84,"unit":"kg"},"dimension":{"width":65,"height":52,"depth":21,"unit":"cm"},"items":[{"description":"iMac (Retina 5K, 27-inch, Late 2017)","origin_country":"USA","quantity":1,"price":{"amount":1999,"currency":"CNY"},"weight":{"value":9.54,"unit":"kg"},"sku":"imac2014"},{"description":"Google Nexus 10","origin_country":"USA","quantity":1,"sku":"google man","price":{"amount":550,"currency":"CNY"},"weight":{"value":0.3,"unit":"kg"}}]},{"box_type":"custom","weight":{"unit":"kg","value":1.2},"dimension":{"depth":15,"width":10,"height":1,"unit":"in"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB black","origin_country":"USA","quantity":2,"price":{"amount":50,"currency":"CNY"},"weight":{"value":0.6,"unit":"kg"},"sku":"Epic_Food_Bar","hs_code":"215155"}]},{"box_type":"custom","weight":{"unit":"kg","value":1.6},"dimension":{"depth":5,"width":4,"height":3,"unit":"cm"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB white","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"},{"description":"Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"}]}]}}';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
# Make sure to install requests: pip install requests
import requests
url = 'https://sandbox-api.postmen.com/v3/labels'
payload = '''
{
"async": false,
"return_shipment": false,
"paper_size": "default",
"service_type": "sf-express-isp_standard_express",
"is_document": false,
"order_number": "123456789",
"service_options": [
{
"type": "insurance",
"insured_value": {
"amount": 500,
"currency": "USD"
}
},
{
"type": "pickup",
"start_time": "11:12:11",
"end_time": "18:00:23"
}
],
"invoice": {
"date": "2019-10-11"
},
"references": [
"13N11ME-MP"
],
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000"
},
"customs": {
"billing": {
"paid_by": "recipient",
"method": {
"type": "account",
"account_number": "AA00888AAAABBBB"
}
},
"terms_of_trade": "ddu",
"purpose": "merchandise"
},
"billing": {
"paid_by": "shipper"
},
"shipment": {
"ship_from": {
"contact_name": "美瑞克斯旗舰店",
"phone": "400-990-1111",
"company_name": "aftership(深圳)",
"street1": "郑州市经济开发区经北二路第九大街东500",
"city": "郑州市",
"email": "aaa@test.com",
"state": "河南省",
"postal_code": "450000",
"country": "CHN",
"type": "business"
},
"ship_to": {
"contact_name": "Panda",
"company_name": "Panda(TWN.Company)",
"phone": "+886-48331889-1111",
"email": "Panda@test.com",
"state": "广东省",
"street1": "深圳市粤兴三道112号",
"city": "深圳市",
"postal_code": "518000",
"country": "CHN",
"type": "residential"
},
"parcels": [
{
"description": "iMac (Retina 5K, 27-inch, Late 2014)",
"box_type": "custom",
"weight": {
"value": 9.84,
"unit": "kg"
},
"dimension": {
"width": 65,
"height": 52,
"depth": 21,
"unit": "cm"
},
"items": [
{
"description": "iMac (Retina 5K, 27-inch, Late 2017)",
"origin_country": "USA",
"quantity": 1,
"price": {
"amount": 1999,
"currency": "CNY"
},
"weight": {
"value": 9.54,
"unit": "kg"
},
"sku": "imac2014"
},
{
"description": "Google Nexus 10",
"origin_country": "USA",
"quantity": 1,
"sku": "google man",
"price": {
"amount": 550,
"currency": "CNY"
},
"weight": {
"value": 0.3,
"unit": "kg"
}
}
]
},
{
"box_type": "custom",
"weight": {
"unit": "kg",
"value": 1.2
},
"dimension": {
"depth": 15,
"width": 10,
"height": 1,
"unit": "in"
},
"items": [
{
"description": "Samsung Galaxy Tab wifi 3G 64GB black",
"origin_country": "USA",
"quantity": 2,
"price": {
"amount": 50,
"currency": "CNY"
},
"weight": {
"value": 0.6,
"unit": "kg"
},
"sku": "Epic_Food_Bar",
"hs_code": "215155"
}
]
},
{
"box_type": "custom",
"weight": {
"unit": "kg",
"value": 1.6
},
"dimension": {
"depth": 5,
"width": 4,
"height": 3,
"unit": "cm"
},
"items": [
{
"description": "Samsung Galaxy Tab wifi 3G 64GB white",
"origin_country": "HKG",
"quantity": 2,
"price": {
"amount": 40,
"currency": "CNY"
},
"weight": {
"value": 0.4,
"unit": "kg"
},
"hs_code": "23528222"
},
{
"description": "Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver",
"origin_country": "HKG",
"quantity": 2,
"price": {
"amount": 40,
"currency": "CNY"
},
"weight": {
"value": 0.4,
"unit": "kg"
},
"hs_code": "23528222"
}
]
}
]
}
}
'''
headers = {
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e',
'content-type': 'application/json'
}
response = requests.request('POST', url, data=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI('https://sandbox-api.postmen.com/v3/labels')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['postmen-api-key'] = '8fc7966b-679b-4a57-911d-c5a663229c9e'
request['content-type'] = 'application/json'
request.body = '{"async":false,"return_shipment":false,"paper_size":"default","service_type":"sf-express-isp_standard_express","is_document":false,"order_number":"123456789","service_options":[{"type":"insurance","insured_value":{"amount":500,"currency":"USD"}},{"type":"pickup","start_time":"11:12:11","end_time":"18:00:23"}],"invoice":{"date":"2019-10-11"},"references":["13N11ME-MP"],"shipper_account":{"id":"00000000-0000-0000-0000-000000000000"},"customs":{"billing":{"paid_by":"recipient","method":{"type":"account","account_number":"AA00888AAAABBBB"}},"terms_of_trade":"ddu","purpose":"merchandise"},"billing":{"paid_by":"shipper"},"shipment":{"ship_from":{"contact_name":"美瑞克斯旗舰店","phone":"400-990-1111","company_name":"aftership(深圳)","street1":"郑州市经济开发区经北二路第九大街东500","city":"郑州市","email":"aaa@test.com","state":"河南省","postal_code":"450000","country":"CHN","type":"business"},"ship_to":{"contact_name":"Panda","company_name":"Panda(TWN.Company)","phone":"+886-48331889-1111","email":"Panda@test.com","state":"广东省","street1":"深圳市粤兴三道112号","city":"深圳市","postal_code":"518000","country":"CHN","type":"residential"},"parcels":[{"description":"iMac (Retina 5K, 27-inch, Late 2014)","box_type":"custom","weight":{"value":9.84,"unit":"kg"},"dimension":{"width":65,"height":52,"depth":21,"unit":"cm"},"items":[{"description":"iMac (Retina 5K, 27-inch, Late 2017)","origin_country":"USA","quantity":1,"price":{"amount":1999,"currency":"CNY"},"weight":{"value":9.54,"unit":"kg"},"sku":"imac2014"},{"description":"Google Nexus 10","origin_country":"USA","quantity":1,"sku":"google man","price":{"amount":550,"currency":"CNY"},"weight":{"value":0.3,"unit":"kg"}}]},{"box_type":"custom","weight":{"unit":"kg","value":1.2},"dimension":{"depth":15,"width":10,"height":1,"unit":"in"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB black","origin_country":"USA","quantity":2,"price":{"amount":50,"currency":"CNY"},"weight":{"value":0.6,"unit":"kg"},"sku":"Epic_Food_Bar","hs_code":"215155"}]},{"box_type":"custom","weight":{"unit":"kg","value":1.6},"dimension":{"depth":5,"width":4,"height":3,"unit":"cm"},"items":[{"description":"Samsung Galaxy Tab wifi 3G 64GB white","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"},{"description":"Inches Quad-Core 3G Tablet PC With 1GB RAM, 16GB ROM Silver","origin_country":"HKG","quantity":2,"price":{"amount":40,"currency":"CNY"},"weight":{"value":0.4,"unit":"kg"},"hs_code":"23528222"}]}]}}'
response = http.request(request)
puts response.read_body
Name | Type | Description |
---|---|---|
id | string | Label ID |
status | string | Accepts: creating ,created ,cancelling ,cancelled ,manifesting ,manifested ,failed . |
ship_date | string | Ship Date in YYYY-MM-DD |
tracking_numbers | array of strings | |
files | a files object | A files object |
rate | rate type | The amount of a charge or payment with reference to some basis of calculation. |
created_at | string | A formatted date. |
updated_at | string | A formatted date. |
references | array of strings | Reference numbers for a label |
shipper_account | object | account of shipper |
service_type | string | Service Types Accepts: sf-express-isp_america_direct_ship ,sf-express-isp_cloud_warehouse_next_day_delivery ,sf-express-isp_cloud_warehouse_third_day_delivery ,sf-express-isp_ecommerce_economy_express ,sf-express-isp_ecommerce_express ,sf-express-isp_ecommerce_special_delivery ,sf-express-isp_economy_express ,sf-express-isp_international_ecommerce_special_delivery ,sf-express-isp_international_economy_express_document ,sf-express-isp_international_economy_express_merchant_agent ,sf-express-isp_international_economy_express_parcel ,sf-express-isp_international_economy_express_pilot ,sf-express-isp_international_heavy_freight ,sf-express-isp_international_small_parcel ,sf-express-isp_international_standard_express_document ,sf-express-isp_international_standard_express_parcel ,sf-express-isp_next_morning_delivery ,sf-express-isp_register_mail ,sf-express-isp_same_day_delivery ,sf-express-isp_standard_express . |
order_number | string | A user-defined order number used to identify an order. |
Response example
{
"meta": {
"code": 200,
"message": "OK",
"details": []
},
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"status": "created",
"ship_date": "2019-11-01",
"created_at": "2019-11-01T00:00:00+00:00",
"updated_at": "2019-11-01T00:00:00+00:00",
"tracking_numbers": [
"SF235235235235"
],
"files": {
"label": {
"paper_size": "default",
"url": "https://sandbox-download.postmen.com/label/2019-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"invoice": {
"paper_size": "a4",
"url": "https://sandbox-download.postmen.com/invoice/2019-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"customs_declaration": null,
"manifest": null
},
"rate": {
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "sf-express-isp",
"description": "SF Express ISP"
},
"service_type": "sf-express-isp_standard_express",
"service_name": "Standard Express"
}
}
}
Retrieve a label
{}
curl --request GET \
--url https://sandbox-api.postmen.com/v3/labels/ \
--header 'content-type: application/json' \
--header 'postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e' \
using System;
using System.Net;
using System.IO;
class ExamplePostmen
{
static void Main(string[] args)
{
WebRequest httpWebRequest = WebRequest.Create("https://sandbox-api.postmen.com/v3/labels/");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "GET";
httpWebRequest.Headers["postmen-api-key"] = "8fc7966b-679b-4a57-911d-c5a663229c9e";
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
import com.squareup.okhttp.*;
public class test {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox-api.postmen.com/v3/labels/")
.get()
.addHeader("postmen-api-key", "8fc7966b-679b-4a57-911d-c5a663229c9e")
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
var request = require("request");
var options = {
method: 'GET',
url: 'https://sandbox-api.postmen.com/v3/labels/',
headers: {
'content-type': 'application/json',
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$url = 'https://sandbox-api.postmen.com/v3/labels/';
$method = 'GET';
$headers = array(
"content-type: application/json",
"postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e"
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
# Make sure to install requests: pip install requests
import requests
url = 'https://sandbox-api.postmen.com/v3/labels/'
headers = {
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e',
'content-type': 'application/json'
}
response = requests.request('GET', url, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI('https://sandbox-api.postmen.com/v3/labels/')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['postmen-api-key'] = '8fc7966b-679b-4a57-911d-c5a663229c9e'
request['content-type'] = 'application/json'
response = http.request(request)
puts response.read_body
Name | Type | Description |
---|---|---|
id | string | Label ID |
status | string | Accepts: creating ,created ,cancelling ,cancelled ,manifesting ,manifested ,failed . |
ship_date | string | Ship Date in YYYY-MM-DD |
tracking_numbers | array of strings | |
files | a files object | A files object |
rate | rate type | The amount of a charge or payment with reference to some basis of calculation. |
created_at | string | A formatted date. |
updated_at | string | A formatted date. |
Response example
{
"id": "00000000-0000-0000-0000-000000000000",
"status": "created",
"ship_date": "2019-11-01",
"created_at": "2019-11-01T00:00:00+00:00",
"updated_at": "2019-11-01T00:00:00+00:00",
"tracking_numbers": [
"SF235235235235"
],
"files": {
"label": {
"paper_size": "default",
"url": "https://sandbox-download.postmen.com/label/2019-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"invoice": {
"paper_size": "a4",
"url": "https://sandbox-download.postmen.com/invoice/2019-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"customs_declaration": null,
"manifest": null
},
"rate": {
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "sf-express-isp",
"description": "SF Express ISP"
},
"service_type": "sf-express-isp_standard_express",
"service_name": "Standard Express"
}
}
List all labels
Optional parameters
Name | Type | Description |
---|---|---|
shipper_account_id | string | Shipper account ID |
status | string | Label status Accepts: creating ,created ,cancelling ,cancelled ,manifesting ,manifested ,failed . |
limit | string | Number of records per page |
created_at_min | string | Start date and time of the record created (format YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+00:00, default: 24hrs ago) |
created_at_max | string | End date and time of the record created (format YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+00:00, default: NOW()) |
tracking_numbers | string | Tracking numbers (separated by comma) |
s | string | Partial search of tracking_number or reference |
next_token | string | Next token |
{}
curl --request GET \
--url https://sandbox-api.postmen.com/v3/labels \
--header 'content-type: application/json' \
--header 'postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e' \
using System;
using System.Net;
using System.IO;
class ExamplePostmen
{
static void Main(string[] args)
{
WebRequest httpWebRequest = WebRequest.Create("https://sandbox-api.postmen.com/v3/labels");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "GET";
httpWebRequest.Headers["postmen-api-key"] = "8fc7966b-679b-4a57-911d-c5a663229c9e";
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
import com.squareup.okhttp.*;
public class test {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox-api.postmen.com/v3/labels")
.get()
.addHeader("postmen-api-key", "8fc7966b-679b-4a57-911d-c5a663229c9e")
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
var request = require("request");
var options = {
method: 'GET',
url: 'https://sandbox-api.postmen.com/v3/labels',
headers: {
'content-type': 'application/json',
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$url = 'https://sandbox-api.postmen.com/v3/labels';
$method = 'GET';
$headers = array(
"content-type: application/json",
"postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e"
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
# Make sure to install requests: pip install requests
import requests
url = 'https://sandbox-api.postmen.com/v3/labels'
headers = {
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e',
'content-type': 'application/json'
}
response = requests.request('GET', url, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI('https://sandbox-api.postmen.com/v3/labels')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['postmen-api-key'] = '8fc7966b-679b-4a57-911d-c5a663229c9e'
request['content-type'] = 'application/json'
response = http.request(request)
puts response.read_body
Name | Type | Description |
---|---|---|
next_token | string or null | Any of string or null |
limit | number | Number of records per page |
labels | array of a label object | A label object |
Response example
{
"meta": {
"code": 200,
"message": "OK",
"details": []
},
"data": {
"next_token": "eyJjcmVhdGVkX2F0IjoiMjAxNS0xMS0y0000000000oyMC4wNjRaIiwiaWQiOiJlMGU1NGQ3My1iN2Qz0000000000kzZi1lMjgwNzc1ZDdlMDUiLCJ1c2VyX2lkIjoiN0000000000tNjIyNS00ZTBiLTg5ZTQtZTM3N2M3YWM5ZDk4In0=",
"limit": 1,
"created_at_min": "2019-11-26T08:49:15+00:00",
"created_at_max": "2019-11-27T08:49:15+00:00",
"labels": [
{
"id": "00000000-0000-0000-0000-000000000000",
"status": "created",
"ship_date": "2019-11-01",
"created_at": "2019-11-01T00:00:00+00:00",
"updated_at": "2019-11-01T00:00:00+00:00",
"tracking_numbers": [
"SF235235235235"
],
"files": {
"label": {
"paper_size": "default",
"url": "https://sandbox-download.postmen.com/label/2019-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"invoice": {
"paper_size": "a4",
"url": "https://sandbox-download.postmen.com/invoice/2019-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"customs_declaration": null,
"manifest": null
},
"rate": {
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "sf-express-isp",
"description": "SF Express ISP"
},
"service_type": "sf-express-isp_standard_express",
"service_name": "Standard Express"
}
}
]
}
}