Create a PB Presort Shipment

HTTP Request

POST /v1/shipments

Summary

This operation creates a label for a parcel that is part of a PB Presort pickup. For an overview of PB Presort, please see the PB Presort Overview.

Prerequisites

To use PB Presort, a merchant must be enrolled with a PB Presort facility and receive a Mailer ID, Job number, and other information required for shipping through PB Presort. To enroll a merchant, please see Onboard a Merchant to use PB Presort.

Things to Consider

  1. For supported services, parcel types, and labels, see the PB Presort Reference page.

  2. When issuing the API call, you must set the following:

    Field Value
    rates.carrier PBPRESORT
    parcel.dimension Set this to the correct dimensions. Dimensions are required for PB Presort shipments.
    shipmentOptions

    The following shipment options are required:

    • SHIPPER_ID: The merchant’s Shipper ID.
    • PERMIT_NUMBER: The merchant’s permit number for flats.
  3. Postage is not charged at the time the PB Presort label is generated. The printed label is a post-paid label.

  4. Shipments created with a parcel type of LGENV and service of either BPM or STANDARD print a label with an IMb.

    Shipments created with package type of PKG and service of BPM print a label with an IMpb.

  5. Pitney Bowes verifies addresses for accuracy against current USPS data and makes corrections to delivery lines and last lines when possible. You can optionally limit the extent of corrections by enabling minimal address validation (described below) through the MINIMAL_ADDRESS_VALIDATION shipment option.

    IMPORTANT: If you enable minimal address validation, the shipper takes 100% responsibility for any undelivered packages due to violation of carrier-addressing guidelines and is responsible for any surcharge or adjustment fee levied by the carrier for such a violation.

    The following table describes describes both complete address validation, which is the default, and minimal address validation:

    Complete Address Validation
    Minimal Address Validation
    Evaluates the entire address against the current USPS address information. Evaluates the entire address against the current USPS address information.
    If current USPS address information indicates no delivery to the address, the API returns an error. If current USPS address information indicates no delivery to the address, the API returns an error.
    If the address cannot be validated against current USPS address information, the API returns an error.

    If the entire address cannot be validated against current USPS address information, the API checks whether just the last line (city/state/postal code) can be validated:

    • If the last line cannot be validated, the API returns an error.

    • If the last line can be validated, the API checks whether the delivery line (street address) has the correct format (e.g., a street number and street name). If it does, the API returns the address with any corrections only to the last line.

      The API does not verify or change the delivery line. The API returns the delivery line exactly as it is specified in the request.

      The API does not provide a ZIP+4 or 2-digit delivery point.

      If you use minimal address validation, ensure the delivery line you enter is actually deliverable.

    If the API determines the address is a match or close match, the API returns the address with any corrections. The API also returns the ZIP+4 and the 2-digit delivery point. If the API determines the address is a match or close match, the API returns the address with any corrections only to the last line. The API also returns the ZIP+4 and the 2-digit delivery point.
  6. PB Presort does not support the following:

    • Rating is not supported for PB Presort shipments. Instead, use the rate charts provided by Pitney Bowes.
    • Refund requests are not supported for PB Presort labels. A Void Shipment request for a PB Presort label will fail.
    • The Transaction Reports API does not retrieve PB Presort labels.
    • You cannot use the FUTURE_SHIPMENT_DATE shipment option when generating a PB Presort label.
  7. PB Presort labels are supported for domestic shipments only.

    Note: You cannot print PB Presort labels for international destinations.

  8. Tracking events show up only after PB Presort uploads the Shipping Services File to USPS. Tracking information can take a while to appear.

    You can use the Tracking API to retrieve tracking events. You must set the carrier query parameter to USPS in the Tracking API request.

  9. Before the pickup driver arrives, you must generate a PB Presort pickup slip (similar to a USPS manifest) identifying the parcels in the pickup. See Create a PB Presort Pickup Slip.

Request URIs

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

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-ShipmentGroupId Required. The job number that represents the agreement between the merchant and PB Presort. This was provided by Pitney Bowes during merchant onboarding for PB Presort.
X-PB-Integrator-CarrierId Required. The merchant’s Mailer ID (MID), as provided by Pitney Bowes during merchant onboarding for PB Presort.
X-PB-UnifiedErrorStructure Recommended. Set this to true to use the standard error object if an error occurs.

Request / Response Elements

Important

See the above Things to Consider before creating the PB Presort shipment.

Important

The API call sends and receives a shipment object. The table below describes all possible fields in a shipment object. Some fields might not apply to your 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 Request

curl -X POST .../v1/shipments \
-H "Authorization: Bearer <oauth_token>" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 24c7d104-31de-4f6f-8bd0" \
-H "X-PB-ShipmentGroupId: 123456789" \
-H "X-PB-Integrator-CarrierId: 987654321" \
-H "X-PB-UnifiedErrorStructure: true" \
-d '
{
    "fromAddress": {
        "company": "Pitney Bowes Inc.",
        "name": "PB",
        "phone": "303-555-1213",
        "email": "pb@example.com",
        "residential": false,
        "addressLines": [
            "4750 Walnut Street"
        ],
        "cityTown": "Boulder",
        "stateProvince": "CO",
        "postalCode": "80301",
        "countryCode": "US"
    },
    "toAddress": {
        "company": "ABC Company",
        "name": "ABC",
        "phone": "203-555-1212",
        "email": "abc@example.com",
        "residential": false,
        "addressLines": [
            "114 Whitney Ave"
        ],
        "cityTown": "New Haven",
        "stateProvince": "CT",
        "postalCode": "06510",
        "countryCode": "US"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 3
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": 12,
            "width": 0.25,
            "height": 9
        }
    },
    "rates": [ {
        "carrier": "PBPRESORT",
        "serviceId": "BPM",
        "parcelType": "LGENV",
        "currencyCode": "USD"
    } ],
    "documents": [ {
        "size": "DOC_6X4",
        "printDialogOption": "NO_PRINT_DIALOG",
        "type": "SHIPPING_LABEL",
        "contentType": "URL",
        "fileFormat": "PDF"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    }, {
        "name": "MINIMAL_ADDRESS_VALIDATION",
        "value": "true"
    }, {
        "name": "PERMIT_NUMBER",
        "value": "SHFL"
    } ]
}'

Sample Response

{
    "fromAddress": {
        "company": "Pitney Bowes Inc.",
        "name": "PB",
        "phone": "303-555-1213",
        "email": "pb@example.com",
        "residential": false,
        "addressLines": [
            "4750 Walnut Street"
        ],
        "cityTown": "Boulder",
        "stateProvince": "CO",
        "postalCode": "80301-2532",
        "countryCode": "US",
        "deliveryPoint": "99",
        "carrierRoute": "C033"
    },
    "toAddress": {
        "company": "ABC Company",
        "name": "ABC",
        "phone": "203-555-1212",
        "email": "abc@example.com",
        "residential": false,
        "addressLines": [
            "114 Whitney Ave"
        ],
        "cityTown": "New Haven",
        "stateProvince": "CT",
        "postalCode": "06510-1238",
        "countryCode": "US",
        "deliveryPoint": "14",
        "carrierRoute": "C001"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 3
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": 12,
            "width": 0.25,
            "height": 9
        }
    },
    "rates": [ {
        "carrier": "PBPRESORT",
        "parcelType": "LGENV",
        "inductionPostalCode": "80301",
        "serviceId": "BPM",
        "baseCharge": 0,
        "totalCarrierCharge": 0,
        "currencyCode": "USD",
        "destinationZone": "1"
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "contentType": "URL",
        "fileFormat": "PDF",
        "contents": "https://.../pbpresort/793833492/outbound/label/6ad8a496574a4cc2ac66d9d9af31138e.pdf"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    }, {
        "name": "MINIMAL_ADDRESS_VALIDATION",
        "value": "true"
    }, {
        "name": "PERMIT_NUMBER",
        "value": "SHFL"
    } ],
    "shipmentId": "PBPRESORT2200122647812392",
    "parcelTrackingNumber": "0070698765432100221106510123814"
}

Sample PB Presort Label

The following is a sample label for a BPM Large Envelope.

Sample PB Presort Label

Error Codes

For a list of all PB Shipping APIs error codes, see Error Codes.