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 Onboarding a Merchant to use PB Presort.

Things to Consider

  1. For supported services, special services, parcel types, and label sizes, please 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. Addresses are validated for accuracy prior to processing the label request. By default, address validation does the following:

    • Verifies the delivery line (street address) and last line (city/state/postal code) for completeness.
    • Returns an error if the address is incomplete or if current USPS data indicates no delivery to that address.
    • Makes corrections to the delivery line or last line when possible.

    If you set MINIMAL_ADDRESS_VALIDATION to true in the request body, the API changes the behavior of bullet 3: the API makes corrections only to the last line (city/state/postal code). The delivery line (street address) is printed exactly as specified in the request. Keep in mind, the API still checks the whole address for completeness and still returns an error if any part of the address, including the delivery line, is incomplete or marked “Undeliverable” by USPS. If you use minimal address validation, always ensure the delivery line you enter is actually deliverable.

    Note: When MINIMAL_ADDRESS_VALIDATION is set to true, 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.

  5. 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.
  6. Tracking events are generated once 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. The events show up only after the Shipping Services File is uploaded to USPS by PB Presort.

  7. 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 (new) Available in Sandbox: Set this to true to use the standard error object if an error occurs.

Request / Response Elements

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

IMPORTANT: The API call sends and receives a shipment object. Fields that do not apply to this operation are marked as such.

Name Data Type Description
fromAddress address object

Required. Origin address.

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

toAddress address object Required. Destination address.
altReturnAddress address object International Shipments Only. If you are sending an international shipment and if you have set the NON_DELIVERY_OPTION shipment option to redirect, then enter the address that a returned parcel should go to.
parcel parcel object Required. Contains physical characteristics of the parcel.
rates Array[rates object]

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

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

documents Array[documents object] A list of shipment documents pertaining to a shipment, including the label. This field does not apply to Rate a Package requests.
shipmentOptions Array[Object]

Each object in this array defines a shipment option. The available options depend on the carrier, origin country, and destination country.

Required if you are creating a shipment. For shipments the array must contain the SHIPPER_ID option. Other requirements might also apply, depending on the type of shipment.

        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

Applies only to these shipments:

  • International
  • APO/FPO/DPO
  • Territories/Possessions
  • FAS

This field contains customs information.

shipmentType String SBR Labels Only. If you are creating a Scan-Based Return (SBR) label, include this field and set the value to RETURN.
references Array[Object]

Newgistics Only. 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": "9014942890"
    }, {
        "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": "9014942890"
    }, {
        "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 Complete Shipping APIs error codes, see Error Codes.