Create a USPS Scan-Based Return Label

HTTP Request

POST /v1/shipments

Summary

This operation prints a USPS® scan-based return (SBR) label. Unlike prepaid return services, SBR services allow you to print return labels without incurring postage charges at the time of print. Postage is automatically deducted only when the return label is scanned into the USPS mail stream. If the label is not used, no charges incur. An SBR label is valid for 90 days after it is printed. SBR labels use standard rates (Commercial Base Price).

Before you can print SBR labels, you must enable SBR services on your account. To enable this service, please contact Client Services Tech Support at ClientServicesTechSupport@pb.com.

Note: SBR labels are available only when you use USPS as the carrier. SBR labels are not available if you use PB Presort as the carrier.

Things to Consider

  1. Activating this service on your developer account allows all your merchant accounts to use this service.

  2. The following USPS services and parcel types are supported with SBR labels:

    Service Name Service ID Parcel Type
    First-Class Package Return Service FCM PKG
    Priority Mail Return Service PM PKG
    Ground Return Service PRCLSEL PKG
  3. The following special services are supported for SBR labels. For important considerations when using special services, please see USPS special services.

    Special Service Special Service ID
    Signature Confirmation Sig
    Insurance Ins
  4. The following label sizes and file formats are supported for SBR labels. For important considerations when printing labels, please see USPS Labels.

    Size File Format
    DOC_4X6 PDF, PNG, ZPL2
    DOC_8X11 PDF, PNG
  5. SBR labels are supported for domestic shipments only.

    Note: You cannot print SBR labels to or from APO/FPO, US territories, or international destinations.

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

    Field Value
    shipmentType RETURN
    toAddress

    Set to the address where the merchandise is returned to. The following fields are required:

    • addressLines
    • postalCode
    • countryCode
    fromAddress

    Set to the address of the user who is returning the merchandise. The following fields are required:

    • addressLines
    • cityTown
    • stateProvince
    • postalCode
    • countryCode
    • Either name or company
    • phone
    • email
    ADD_TO_MANIFEST Set to false or omit it all together. Otherwise an error will be returned.
  7. Do not include X-PB-Shipper-Rate-Plan and X-PB-Integrator-CarrierId in the request header.

  8. 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 through the MINIMAL_ADDRESS_VALIDATION shipment option. For a comparison of complete and minimal address validation, see What is minimal address validation?

    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.

  9. There is no charge to print an SBR label. Postage is automatically deducted only when the return label is scanned into the USPS mail stream.

  10. To view transaction history for SBR labels, use the Transaction Reports API. The API returns the printStatus field, which displays a label’s status:

    • SBRPrinted: The SBR label is printed but not yet scanned into the USPS mailstream.
    • SBRCharged: The SBR label is scanned into the USPS mailstream. Note that once an SBR label is scanned, it typically takes two days for the API to display the event. When it does, the API adds a new transaction for the label with printStatus set to SBRCharged.
    • NULL: The label is not an SBR label.

    To retrieve a report that displays only SBR transactions, use the printStatus query parameter when calling the Transaction Reports API.

  11. Return labels cannot be voided. If you try to void an SBR label, an error will be returned.

  12. Labels retrieved through URLs are available for 24 hours after label creation.

  13. For answers to common questions, please see the SBR FAQs.

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-UnifiedErrorStructure Recommended. Set this to true to use the standard error object if an error occurs.

Request / Response Elements

The API call sends and receives a Shipment Object. The following table describes all possible fields in a Shipment Object.

Important

Some fields in the Shipment Object do not apply to this operation and are marked accordingly.

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.

FedEx, UPS: If you are shipping with FedEx or 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.
  • CBDS: 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. The altReturnAddress is not returned in the response.
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 shipping document created by the API call.

This field is required except in the following cases:

  • This field does not apply to Rate Parcel requests.
  • This field does not apply to CBDS First-Mile Exclusive shipments.
shipmentOptions Array[Object]

Required. Each object in this array defines a shipment option. Specify each option as a name-value pair in the array.

The SHIPPER_ID option is required. For any additional requirements for a carrier or service, please see the Things to Consider section on the carrier’s Create Shipment page.

        name String The name of the shipment option.
        value String The value of the shipment option.
customs Object

Conditional. For shipments that use customs forms, this object contains the customs information. This field is required for the following carriers in the following situations:

  • USPS: Required for shipments to international destinations and to APO/FPO/DPO, Territories/Possessions, and FAS
  • CBDS: Required for all shipments
  • FedEx: Required for shipments to international destinations and Puerto Rico
  • UPS: Required for shipments to international destinations and Puerto Rico
        customsInfo Customs Info Object Customs clearance information used to fill out a commercial invoice.
        customsItems Array[Customs Items 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 Details Object CBDS Only. Required if the merchant uses the CBDS First-Mile Exclusive solution. Contains information about the domestic leg of the shipment. This field does not apply to the First-Mile Inclusive solution.
soldToAddress Address Object

Applies only to FedEx and UPS. This contains 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 Return Labels Only. Set this to RETURN. Required for Expedited, Standard, and Scan-Based returns.
references Array[Object]

Enters shipper-generated values. Applies only to the following:

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: <unique_transaction_id>" \
-H "X-PB-UnifiedErrorStructure: true" \
-d '
{
    "shipmentType": "RETURN",
    "fromAddress": {
        "company": "Pitney Bowes Inc.",
        "name": "John Smith",
        "phone": "203-000-0000",
        "email": "john@example.com",
        "residential": false,
        "addressLines": [ "27 Waterview Drive" ],
        "cityTown": "Shelton",
        "stateProvince": "CT",
        "postalCode": "06484",
        "countryCode": "US"
    },
    "toAddress": {
        "company": "ABC Company",
        "name": "Rufous Sirius Canid",
        "phone": "919 555-1212",
        "email": "rs.canid@example.com",
        "residential": false,
        "addressLines": [ "2429 Hillsborough" ],
        "cityTown": "Raleigh",
        "stateProvince": "NC",
        "postalCode": "27607",
        "countryCode": "US"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 38
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": 6,
            "width": 4,
            "height": 4
        }
    },
    "rates": [ {
        "carrier": "USPS",
        "parcelType": "PKG",
        "inductionPostalCode": "06484",
        "serviceId": "PM"
    } ],
    "documents": [ {
        "size": "DOC_4X6",
        "printDialogOption": "NO_PRINT_DIALOG",
        "type": "SHIPPING_LABEL",
        "contentType": "URL",
        "fileFormat": "PDF"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    }, {
        "name": "ADD_TO_MANIFEST",
        "value": "false"
    }, {
        "name": "HIDE_TOTAL_CARRIER_CHARGE",
        "value": "true"
    } ]
}'

Sample Response

{
    "fromAddress": {
        "company": "Pitney Bowes Inc.",
        "name": "John Smith",
        "phone": "203-000-0000",
        "email": "john@example.com",
        "residential": false,
        "addressLines": [ "27 Waterview Dr" ],
        "cityTown": "Shelton",
        "stateProvince": "CT",
        "postalCode": "06484-4361",
        "countryCode": "US"
        "deliveryPoint": "27",
        "carrierRoute": "C010"
    },
    "toAddress": {
        "company": "ABC Company",
        "name": "Rufous Sirius Canid",
        "phone": "919 555-1212",
        "email": "rs.canid@example.com",
        "residential": false,
        "addressLines": [
            "2429 Hillsborough St"
        ],
        "cityTown": "Raleigh",
        "stateProvince": "NC",
        "postalCode": "27607-7248",
        "countryCode": "US",
        "deliveryPoint": "28",
        "carrierRoute": "C013"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 38
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": 6,
            "width": 4,
            "height": 4,
            "irregularParcelGirth": 0
        }
    },
    "rates": [ {
        "carrier": "USPS",
        "parcelType": "PKG",
        "inductionPostalCode": "06484",
        "specialServices": [ {
            "specialServiceId": "USPS Returns Service",
            "inputParameters": [],
            "fee": 0
        } ],
        "serviceId": "PM",
        "dimensionalWeight": {
            "weight": 0,
            "unitOfMeasurement": "OZ"
        },
        "baseCharge": 7.86,
        "totalCarrierCharge": 7.86,
        "currencyCode": "USD",
        "destinationZone": "4"
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "contentType": "URL",
        "fileFormat": "PDF",
        "contents": "https://.../usps/716434537/inbound/label/fa8ce7a41b2d4f57bd43cfc4a0f7915e.pdf"
    } ],
    "shipmentOptions": [ {
        "name": "HIDE_TOTAL_CARRIER_CHARGE",
        "value": "true"
    }, {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    }, {
        "name": "ADD_TO_MANIFEST",
        "value": "false"
    }, {
        "name": "FUTURE_SHIPMENT_DATE",
        "value": "2019-07-20"
    }, {
        "name": "MINIMAL_ADDRESS_VALIDATION",
        "value": "false"
    } ],
    "shipmentId": "USPS2200088600398894",
    "parcelTrackingNumber": "9301920516000000018858"
}

Sample SBR Label

Sample SBR Label

Error Codes

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