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.

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 USPS special services can be used with the services specified above:

    Special Service Special Service ID
    Signature Confirmation Sig
    Insurance Ins

     

  4. The following file formats are supported with SBR labels:

    File Format Size
    PDF DOC_4X6,
    DOC_8X11
    PNG DOC_4X6,
    DOC_8X11
    ZPL2 DOC_4X6
  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. An error is returned if validation fails. By default, the complete address (the address lines and the city/state/zip) is validated.

    If you set MINIMAL_ADDRESS_VALIDATION to true in the shipmentOptions array, then only the city/state/zip is checked for validity. The address lines are not validated and are printed on the label exactly as specified in the request.

    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.

  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 Data Type Description
Authorization String Required. OAuth token generated using the Generate an OAuth Token API.
Content-Type String Required. The media type of the request entity. Set this to application/json.
X-PB-TransactionId String

Required. A unique identifier for the transaction, up to 25 characters.

Important: You must ensure this is a unique id.

Request / Response Elements

The API call sends and receives a shipment object. The table below describes all the elements in the shipment object.

IMPORTANT: 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: <unique_transaction_id>" \
-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": "9024998978"
    }, {
        "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": "9024998978"
    }, {
        "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 Shipping APIs error codes, see Error Codes.