Create a PB Cross-Border Shipment

HTTP Request

POST /v1/shipments

Summary

This operation provides shipping and tracking services for a PB Cross-Border international shipment. To use this service, the merchant must first print a first-mile label to ship the parcel to a PB Cross-Border consolidation center. The merchant then provides the first-mile tracking number when using this API call.

This operation provides:

  • Shipping services from the consolidation center to the international destination. The returned rate is the cost to ship the parcel from the consolidation center to the international destination.
  • Tracking services for the full length of the journey, from the merchant’s origin address to the PB consolidation center to the international destination. The API returns a tracking number that covers the full journey.

Things to Consider

  1. The cost of the shipment is the cost from the PB Cross-Border consolidation center listed in the toAddress to the final destination.

  2. The following fields are required in the request’s address objects:

    • addressLines
    • cityTown
    • postalCode
    • countryCode
    • name

    For Canadian addresses, the stateProvince field is also required. Use the 2-letter province code.

  3. In the customInfo object, use only the currencyCode field, which is required. Set the value to USD:

    "customs": {
        "customsInfo": {
            "currencyCode": "USD"
        }
    }
    

Request URIs

Sandbox: https://api-sandbox.pitneybowes.com/shippingservices/v1/shipments
Production: https://api.pitneybowes.com/shippingservices/v1/shipments

Query Parameter

Name Description
includeDeliveryCommitment If set to true, returns estimated transit times in days.
carrier Required. Set this to PBI.

Request Headers

Name Description
Authorization Required. OAuth token generated using the Generate an OAuth Token API.
Content-Type Required. The media type of the request entity. Set this to application/json.
X-PB-TransactionId

Required. A unique identifier for the transaction, up to 25 characters.

Important: You must ensure this is a unique id.

X-PB-UnifiedErrorStructure Recommended. Set this to true to use the standard error object if an error occurs.

Request / Response Elements

Important

The API call sends and receives a shipment object. The table below describes all possible fields in a shipment object. Some fields in the shipment object do not apply to this operation.

Name Data Type Description
fromAddress address object

Required. Origin address.

If you want a different address to appear on the label from the one listed here, see How do I print a return address that is different from the origin address?

toAddress address object

Required. Destination address.

If you are shipping with United Parcel Service (UPS) to Puerto Rico or an international destination, and if the importer is different from the final recipient, this is the address of the importer. Enter the recipient’s address in the soldToAddress object. If importer’s address is the same as the final recipient, the toAddress and soldToAddress must match.

altReturnAddress address object

Applies only to the following:

  • USPS: If you are sending an international shipment through USPS and if you have set the NON_DELIVERY_OPTION shipment option to redirect, then enter the address that a returned parcel should go to.
  • PB Cross-Border: For a Create Shipment request, this is the address used to return a parcel from the Pitney Bowes consolidation center. If omitted, the fromAddress is used.
parcel parcel object Required. Contains physical characteristics of the parcel.
rates Array[rates object]

Required. Specifies the carrier, service, parcel, and other information. In a response, this field also contains the service charges.

Important: In a request, the rates array can contain only one rates object.

documents Array[documents object]

Conditional: Defines the label, manifest, or other shipment document. Applies as follows:

  • Required for Create Shipment requests except as noted in the next bullet.
  • Does not apply to a Cross-Border Create Shipment request.
  • Does not apply to Rate Parcel requests.
shipmentOptions Array[Object] Conditional: Each object in this array defines a shipment option. Required for Create Shipment requests. Does not apply to Rate Parcel requests. All Create Shipment requests require the SHIPPER_ID option. Please see the Things to Consider section on the carrier’s Create Shipment page for any additional requirements.
        name String The name of the shipment option. The shipmentOptions array requires this field.
        value String The value of the shipment option. The shipmentOptions array requires this field.
customs customs object

Conditional: Contains customs information. Required for:

  • USPS shipments to the following locations: International, APO/FPO/DPO, Territories/Possessions, FAS
  • PB Cross-Border
  • UPS shipments to the following locations: International, Puerto Rico
        customsInfo customsInfo object Customs clearance information used to fill out a commercial invoice.
        customsItems Array[customsItems object]

Information about each commodity in the shipment, used for customs clearance.

The maximum number of objects in this array is 30.

domesticShipmentDetails domestic shipment object PB Cross-Border Only. Required in Create Shipment requests; does not apply to Rate Parcel requests. Contains information about the domestic leg of the PB Cross-Border shipment.
soldToAddress address object

UPS Only. The final recipient of a United Parcel Service shipment. Required for a shipment from the U.S. to Puerto Rico or to an international destination. Otherwise optional.

This address must match the toAddress.countryCode, with the exception of shipments to Canada and to U.S. satellite countries.

If the final recipient’s address is the same as the importer’s address, the entries in the soldToAddress object must match the entries in the toAddress object.

shipmentType String USPS Return Labels Only. Required for USPS Return Labels. If you are creating a Pure Post Return label or Scan-Based Return label, include this field and set the value to RETURN.
references Array[Object]

Applies only to the following:

  • PB Cross-Border: Required in a Create Shipment request; does not apply to a Rate Parcel request. Contains the buyer order ID. The array takes an object with two String elements. Set name to ORDER_NUMBER, and set value to the order ID:

    {
        "name": "ORDER_NUMBER",
        "value": "<order_ID>"
    }
    
  • Newgistics: Optional. This array maps client-generated identifiers to fields in the Newgistics package record. The information in this array does not appear on the shipping label. The array takes up to three objects, and each object maps an identifier to a specific Newgistics field. An object’s sequence in the array determines which Newgistics field the object maps to. The first object in the array maps to the Newgistics “ReferenceNumber” field; the second to the “AddlRef1” field; and the third to the “AddlRef2” field.

    Use the syntax shown below. Enter the names in the order shown. If you enter different names, the system will change them to the names below. In the value fields, enter the client-generated identifiers. The values must be strings of no more than 50 characters each. For additional information on using references, merchants can contact their Newgistics representatives.

    {
        "name": "ReferenceNumber",
        "value": "<client identifier 1>"
    }, {
        "name": "AddlRef1",
        "value": "<client identifier 2>"
    }, {
        "name": "AddlRef2",
        "value": "<client identifier 3>"
    }
    
shipmentId String Response Only. Unique identifier for the shipment, generated by the system in response to shipment purchase.
parcelTrackingNumber String Response Only. Tracking number assigned to the shipment by the system.

Sample Requests

See the following examples:

Sample Request with Categories

curl -X POST .../v1/shipments \
-H "Authorization: Bearer olVCndjE5lFnQkXaNKHYwQajz8qB" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 2f1d2c42aa5c1fe4-2945bb" \
-d '
{
    "fromAddress": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Kathryn Smith",
        "company": "Shop",
        "phone": "1234567890",
        "email": "Kathryn@example.com",
        "residential": false
    },
    "toAddress": {
        "addressLines": [
            "3 1st Ave NW"
        ],
        "cityTown": "Mayo",
        "stateProvince": "YT",
        "postalCode": "1M0",
        "countryCode": "AU",
        "name": "Julie Jones",
        "residential": true,
        "email": "richard@example.com",
        "phone": "1234567890"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 17
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": "8",
            "width": "4",
            "height": "6"
        }
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXPS",
        "parcelType": "PKG"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "USD"
        },
        "customsItems": [ {
            "description": "foundation",
            "quantity": 10,
            "unitPrice": 8,
            "itemId": "303O",
            "url": "www.example.com/beauty",
            "categories": [ {
                "categoryCode": "SF",
                "descriptions": [ {
                    "locale": "en_US",
                    "name": "Skin Foundation, Ochre, 2 Fluid Ounces"
                } ]
            } ]
        } ]
    },
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    },{
        "name": "CARRIER_FACILITY_ID",
        "value": "US_ELOVATIONS_KY"
    },{
        "name": "CLIENT_FACILITY_ID",
        "value": "CVG"
    } ],
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "123789"
    } ],
    "domesticShipmentDetails": {
        "shipperTrackingNumber": "USPS13600150468397",
        "carrier": "USPS"
    },
    "altReturnAddress ": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Manager",
        "company": "Returns",
        "phone": "1234567890",
        "email": "manager@example.com",
        "residential": false
    }
}'

Sample Response with Categories

{
    "fromAddress": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Kathryn Smith",
        "company": "Shop",
        "phone": "1234567890",
        "email": "Kathryn@example.com",
        "residential": false
    },
    "toAddress": {
        "addressLines": [
            "3 1st Ave NW"
        ],
        "cityTown": "Mayo",
        "stateProvince": "YT",
        "postalCode": "1M0",
        "countryCode": "AU",
        "name": "Julie Jones",
        "phone": "1234567890",
        "email": "julie@example.com",
        "residential": true
    },
    "altReturnAddress ": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Manager",
        "company": "Returns",
        "phone": "1234567890",
        "email": "manager@example.com",
        "residential": false
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 17
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": "8",
            "width": "4",
            "height": "6"
        },
        "valueOfGoods": 80
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXPS",
        "parcelType": "PKG",
        "baseCharge": 35.25,
        "totalCarrierCharge": 40.49,
        "currencyCode": "USD",
        "totalTaxAmount": 5.24
    } ],
    "shipmentOptions": [ {
            "name": "SHIPPER_ID",
            "value": "9024324564"
        },{
            "name": "CARRIER_FACILITY_ID",
            "value": "US_ELOVATIONS_KY"
        },{
            "name": "CLIENT_FACILITY_ID",
            "value": "CVG"
        } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "USD"
        },
        "customsItems": [ {
            "itemId": "303O",
            "description": "foundation",
            "quantity": 10,
            "unitPrice": 8,
            "url": "www.example.com/beauty"
            "categories": [ {
                "categoryCode": "SF",
                "descriptions": [ {
                    "locale": "en_US",
                    "name": "Skin Foundation, Ochre, 2 Fluid Ounces"
                } ]
            } ]
        } ]
    },
    "domesticShipmentDetails": {
        "carrier": "USPS",
        "shipperTrackingNumber": "USPS13600150468397"
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "123789"
    } ],
    "parcelTrackingNumber": "UPGUS001580DCC1281C0",
    "shipmentId": "UPGUS001580DCC1281C0"
}

Sample Request without Categories

curl -X POST .../v1/shipments \
-H "Authorization: Bearer olVCndjE5lFnQkXaNKHYwQajz8qB" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 2f1d2c42aa5c1fe4-2945bc" \
-d '
{
    "fromAddress": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Kathryn Smith",
        "company": "Shop",
        "phone": "1234567890",
        "email": "Kathryn@example.com",
        "residential": false
    },
    "toAddress": {
        "addressLines": [
            "3 1st Ave NW"
        ],
        "cityTown": "Mayo",
        "stateProvince": "YT",
        "postalCode": "1M0",
        "countryCode": "AU",
        "name": "Richard Jones",
        "residential": true,
        "email": "richard@example.com",
        "phone": "1234567890"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 5
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": "6",
            "width": "2.5",
            "height": "5",
            "irregularParcelGirth": 0.002
        }
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXPS",
        "parcelType": "PKG"
    } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "USD"
        },
        "customsItems": [ {
            "itemId": "c378",
            "description": "shirt",
            "quantity": 2,
            "unitPrice": 10,
            "url": "www.example.com/shirts"
        },{
            "itemId": "c422",
            "description": "dress",
            "quantity": 2,
            "unitPrice": 10,
            "url": "www.example.com/dresses"
        } ]
    },
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    },{
        "name": "CARRIER_FACILITY_ID",
        "value": "US_ELOVATIONS_KY"
    },{
        "name": "CLIENT_FACILITY_ID",
        "value": "CVG"
    } ],
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "123456"
    } ],
    "domesticShipmentDetails": {
        "shipperTrackingNumber": "USPS13600150468398",
        "carrier": "USPS",
        "dcAddress": {
            "name": "Retail Distribution Center",
            "addressLines": [
                "2100 Distribution Rd"
            ],
            "cityTown": "Auburn",
            "stateProvince": "AL",
            "countryCode": "US",
            "postalCode": "36830"
        }
    }
    "altReturnAddress ": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Manager",
        "company": "Returns",
        "phone": "1234567890",
        "email": "manager@example.com",
        "residential": false
    }
}'

Sample Response without Categories

{
    "fromAddress": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Kathryn Smith",
        "company": "Shop",
        "phone": "1234567890",
        "email": "Kathryn@example.com",
        "residential": false
    },
    "toAddress": {
        "addressLines": [
            "3 1st Ave NW"
        ],
        "cityTown": "Mayo",
        "stateProvince": "YT",
        "postalCode": "1M0",
        "countryCode": "AU",
        "name": "Richard Jones",
        "phone": "1234567890",
        "email": "richard@example.com",
        "residential": true
    },
    "altReturnAddress ": {
        "addressLines": [
            "2358 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US",
        "name": "Manager",
        "company": "Returns",
        "phone": "1234567890",
        "email": "manager@example.com",
        "residential": false
    },
    "parcel": {
        "dimension": {
            "length": 6,
            "height": 5,
            "width": 2.5,
            "unitOfMeasurement": "IN",
            "irregularParcelGirth": "0.002"
        },
        "weight": {
            "weight": 5,
            "unitOfMeasurement": "OZ"
        },
        "valueOfGoods": 40
    },
    "rates": [ {
        "carrier": "PBI",
        "serviceId": "PBXPS",
        "parcelType": "PKG",
        "baseCharge": 14.68,
        "totalCarrierCharge": 20.04,
        "currencyCode": "USD",
        "totalTaxAmount": 5.36
    } ],
    "shipmentOptions": [ {
            "name": "SHIPPER_ID",
            "value": "9024324564"
        },{
            "name": "CARRIER_FACILITY_ID",
            "value": "US_ELOVATIONS_KY"
        },{
            "name": "CLIENT_FACILITY_ID",
            "value": "CVG"
        } ],
    "customs": {
        "customsInfo": {
            "currencyCode": "USD"
        },

       "customsItems": [ {
            "itemId": "c378",
            "description": "shirt",
            "quantity": 2,
            "unitPrice": 10,
            "url": "www.example.com/shirts"
        },{
            "itemId": "c422",
            "description": "dress",
            "quantity": 2,
            "unitPrice": 10,
            "url": "www.example.com/dresses"
        } ]
    },
    "domesticShipmentDetails": {
        "carrier": "USPS",
        "shipperTrackingNumber": "USPS13600150468398",
        "dcAddress": {
            "addressLines": [
                "2100 Distribution Rd"
            ],
            "cityTown": "Auburn",
            "stateProvince": "AL",
            "postalCode": "36830",
            "countryCode": "US",
            "name": "Retail Distribution Center"
        }
    },
    "references": [ {
        "name": "ORDER_NUMBER",
        "value": "123456"
    } ],
    "parcelTrackingNumber": "UPGUS00152BFFC104092",
    "shipmentId": "UPGUS00152BFFC104092"
}

Error Codes

For common error codes specific to this API call, please see 13#####.

For all error codes for the PB Shipping APIs, please see Error Codes.