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.

Before you can print SBR labels, you must enable SBR services on your account. To enable this service, please contact the PB support team at: ShippingAPISupport@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 Label Sizes and Formats.

    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.
    fromAddress

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

    • name or company
    • email
    • phone
    • addressLines (address line 1)
    • cityTown
    • stateProvince
    • postalCode
    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. Addresses are validated for accuracy prior to processing the label request. The Pitney Bowes Address Validation (AV) engine validates addresses against current USPS data and makes corrections when possible. You can optionally enable minimal address validation through the MINIMAL_ADDRESS_VALIDATION shipment option.

    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.

    The following table describes how address validation works.

    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.


  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 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, see How do I print a return address that is different from the origin address?

toAddress address object

Required. Destination address.

Note: If you are shipping with UPS (available only in Sandbox) 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 entries toAddress and soldToAddress must match.

altReturnAddress address object USPS Only. 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.
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] Conditional: Required for Create Shipment requests; does not apply to Rate Package requests. Defines the label, manifest, or other shipment document.
shipmentOptions Array[Object] Conditional: Required for Create Shipment requests; does not apply to Rate Package requests. Each object in this array defines a shipment option. Please see the Things to Consider section on your carrier’s Create Shipment page for required options. Note that the SHIPPER_ID option is required for all shipments.
        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

This field contains customs information.

Applies to the following:

  • For USPS, applies to shipments to these locations:
    • International
    • APO/FPO/DPO
    • Territories/Possessions
    • FAS
  • For UPS (available only in Sandbox), applies to shipments to these locations:
    • International
    • Puerto Rico
soldToAddress address object

UPS Only. (Available only in Sandbox)

This object is required for shipments from the U.S. to Puerto Rico or an international destination.

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

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

shipmentType String USPS SBR Only. If you are creating a USPS 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: <unique_transaction_id>" \
-H "X-PB-UnifiedErrorStructure: true" \
-d '
{
    "fromAddress": {
        "company": "Pitney Bowes Inc.",
        "name": "John Q",
        "phone": "203-000-0000",
        "email": "john.q@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": 6,
            "height": 6
        }
    },
    "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"
    } ],
    "shipmentType": "RETURN"
}'

Sample Response

{
    "fromAddress": {
        "company": "Pitney Bowes Inc.",
        "name": "John Q",
        "phone": "203-000-0000",
        "email": "john.q@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": 6,
            "height": 6,
            "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": "2018-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 Complete Shipping APIs error codes, see Error Codes.