Create a USPS Scan-Based Return Label

Note

USPS® will retire the Scan-Based Return program August 29, 2020.

August 2020 Deprecation of SBR

USPS® is retiring the Scan-Based Return (SBR) program August 29, 2020. In its place, you can use PB Expedited Returns. For more information, contact your Client Success Manager or ClientServicesTechSupport@pb.com.

HTTP Request

POST /v1/shipments

Summary

This operation prints a USPS® Scan-Based Return (SBR) label. 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).

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. SBR labels are supported for domestic shipments only.

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

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

  4. SBR labels cannot be voided. If you try to void an SBR label, an error is returned.

  5. You can view the history of an SBR label through Transaction Reports. The printStatus field displays the 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. Once a 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.

  6. 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
  7. The following special services are supported:

    Special Service Special Service ID
    Signature Confirmation Sig
    Insurance Ins
  8. The following label options are supported:

    Size File Format
    DOC_4X6 PDF, PNG, ZPL2
    DOC_8X11 PDF, PNG
  9. 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.
  10. Do not include X-PB-Shipper-Rate-Plan and X-PB-Integrator-CarrierId in the request header.

  11. You can optionally enable minimal address validation through the MINIMAL_ADDRESS_VALIDATION shipment option. 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.

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

  13. See also 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 CBDS 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 the Create CBDS Shipment request if the merchant prints the first-label prior to invoking the API.
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 prints the first-mile label prior to invoking the Create CBDS Shipment API. This object contains information about the first-mile leg of the shipment.
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 Returns and Standard Returns.
references Array[Object]

Merchant-defined values. Applies 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": { ... },
    "toAddress": { ... },
    "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": { ... },
    "toAddress": { ... },
    "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"
}

Error Codes

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