Create a Newgistics Shipment

HTTP Request

POST /v1/shipments

Summary

This operation creates a domestic label for a parcel that is part of a Newgistics shipment. The operation prints a label with a USPS-compliant barcode.

Before shipping with Newgistics, please see the Newgistics Overview page, which provides onboarding instructions, supported services, and other information.

Prerequisites

Before a merchant can use Newgistics, the merchant must be enrolled with a Newgistics facility and receive a set of Newgistics IDs. The merchant’s postage account must be enabled for Newgistics as a carrier. Please see the Onboard a Merchant instructions on the Newgistics Overview page.

Testing Newgistics Shipments in Sandbox

You can test this API in the sandbox environment without first onboarding a merchant. Pitney Bowes provides a set of default Newgistics IDs for use in sandbox. Please see the Newgistics IDs table.

Things to Consider

  1. The label generated is a post-paid label. Postage is not charged for a Newgistics label at the time of label generation.

  2. For supported services, parcel types, and label sizes, please see the Newgistics Reference page.

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

    Field Requirement
    fromAddress,
    toAddress

    In the fromAddress and toAddress objects, the following fields are required:

    • name
    • addressLines
    • postalCode
    • countryCode
    rates.carrier Set this to NEWGISTICS.
    parcel.dimension Set this to the correct dimensions. Dimensions are required for Newgistics shipments.
    shipmentOptions

    The following shipment options are required:

    • SHIPPER_ID: The merchant’s Shipper ID.
    • CLIENT_FACILITY_ID: The Client Facility ID assigned by Newgistics to the merchant. If testing in sandbox, set this to 0093.
    • CARRIER_FACILITY_ID: The Newgistics Facility ID assigned by Newgistics to the merchant. If testing in sandbox, set this to 1585.

    If you set an irregular parcel girth value in the parcel.dimension object, then you must include the IS_RECTANGULAR shipment option and set it to false.

  4. 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 (described below) through the MINIMAL_ADDRESS_VALIDATION shipment option.

    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.

    The following table describes describes both complete address validation, which is the default, and minimal address validation:

    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.
  5. You can subscribe the shipment to receive provisioned transit triggers by including the NOTIFICATIONS special service in the request. The merchant must be configured for Newgistics transit triggers to use this feature. For more information, see Newgistics Transit Triggers below.

  6. You can print custom messages on Newgistics labels using the PRINT_CUSTOM_MESSAGE_2 shipment option. See Shipment Options.

  7. Newgistics labels are supported for domestic shipments only.

    Note: You cannot print Newgistics labels for international destinations.

  8. Newgistics labels use 203 DPI by default. For all label settings, see Labels. If you use an APAC URI, see the Label Settings for APAC Services section.

  9. The ADD_TO_MANIFEST option is always considered true for Newgistics labels. If you set the option to false, the PB Shipping APIs ignore the setting and still consider the option to be true.

  10. To close out the day, see Create a Newgistics Manifest (Closeout).

Newgistics Transit Triggers

Merchants who are configured for Newgistics transit triggers can subscribe shipments to transit triggers by including the NOTIFICATIONS special service in the Create Shipment request. In the rates.specialServices array, create a special service with:

  • The specialServiceId set to NOTIFICATIONS

  • The inputParameters array containing the following parameters. All values are String values:

    Parameter Value
    RECIPIENT_NOTIFICATION_TYPE

    Required. The event to receive notifications for. Set this to either of the following:

    • ON_INTRANSIT
    • ON_DELIVER
    RECIPIENT_NOTIFICATION_EMAIL Required. Enables email notification. Set this to the email address to receive notifications. You must use the same email address for all events. Newgistics accepts only one email address for all notifications.
    RECIPIENT_NOTIFICATION_PHONE (FOR FUTURE USE) Enables text notification. Enter the phone number as a string of continuous numbers, without spaces or punctuation. For example: 1234567890

For example:

"rates": [ {
    "specialServices": [ {
        "specialServiceId":"NOTIFICATIONS",
        "inputParameters":[ {
            "name":"RECIPIENT_NOTIFICATION_TYPE",
            "value":"ON_DELIVER"
        },{
            "name":"RECIPIENT_NOTIFICATION_EMAIL",
            "value":"widgets@example.com"
        } ]
    }, ... ],
    ...
} ]

Note: To configure transit triggers, contact Newgistics Implementation or Account Management.

Request URIs

Sandbox URI: https://api-sandbox.pitneybowes.com/shippingservices/v1/shipments
Production URI: https://api.pitneybowes.com/shippingservices/v1/shipments

Request URIs for APAC

For requests that originate in the Asia-Pacific (APAC) region, Pitney Bowes provides regional URIs to optimize performance. To issue the request from the APAC region, use one of the following URIs. If you use an APAC URI to create a shipment, you must also use an APAC URI if you manifest or void the shipment. When using an APAC URI, you must set the carrier query parameter to Newgistics:

Sandbox URI for APAC: https://apac-sandbox.shippingapi.pitneybowes.com/shippingservices/v1/shipments?carrier=Newgistics
Production URI for APAC: https://apac.shippingapi.pitneybowes.com/shippingservices/v1/shipments?carrier=Newgistics

Query Parameter

Name Description
carrier Applies to requests from the Asia-Pacific region. If your request originates in the Asia-Pacific region and if you use the Asia-Pacific URIs, you must set the carrier query parameter to Newgistics.

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

Important

The API call sends and receives a Shipment Object. The table below describes all the elements in a Shipment Object. Some elements are not applicable to Newgistics shipments and are marked as such.

Important:   Please see the above Things to Consider for the required values when creating Newgistics shipments.

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.

Note for UPS: If you are shipping with United Parcel Service (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.
  • PB Cross-Border: 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.
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 shipment document. Applies as follows:

  • Required for Create Shipment requests except as noted in the next bullet.
  • Does not apply to a Cross-Border Create Shipment request.
  • Does not apply to Rate Parcel requests.
shipmentOptions Array[Object] Conditional. Each object in this array defines a shipment option. Required for Create Shipment requests. Does not apply to Rate Parcel requests. All Create Shipment requests require the SHIPPER_ID option. Please see the Things to Consider section on the carrier’s Create Shipment page for any additional requirements.
        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 Object

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

  • USPS shipments to international destinations and to APO/FPO/DPO, Territories/Possessions, and FAS
  • PB Cross-Border
  • UPS 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 PB Cross-Border Only. Required in Create Shipment requests; does not apply to Rate Parcel requests. Contains information about the domestic leg of the PB Cross-Border shipment.
soldToAddress Address Object

UPS Only. 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 USPS Return Labels Only. Required for USPS Return Labels. If you are creating a Pure Post Return label or Scan-Based Return label, include this field and set the value to RETURN.
references Array[Object]

Applies only to the following:

  • PB Cross-Border: Required in a Create Shipment request; does not apply to a Rate Parcel request. Contains the buyer order ID. The array takes an object with two String elements. Set name to ORDER_NUMBER, and set value to the order ID:

    {
        "name": "ORDER_NUMBER",
        "value": "<order_ID>"
    }
    
  • Newgistics: Optional. 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 l8wHkQKaBjC5VEaYldQnFXnzoqNj" \
-H "Content-Type: application/json" \
-H "X-PB-TransactionId: 5a2d2cf4-f2c4-41ba-91e2" \
-d '
{
    "fromAddress": {
        "company": "Widgets",
        "name": "Jon",
        "phone": "123-456-7890",
        "email": "widgets@example.com",
        "residential": false,
        "addressLines": [ "2352 Bent Creek Rd" ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830",
        "countryCode": "US"
    },
    "toAddress": {
        "company": "Books",
        "name": "Jane",
        "phone": "785-000-000",
        "email": "books@example.com",
        "residential": false,
        "addressLines": [ "121 N Santa Fe Ave" ],
        "cityTown": "Salina",
        "stateProvince": "KS",
        "postalCode": "67401",
        "countryCode": "US"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": "32"
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": "10",
            "width": "4",
            "height": "6",
            "irregularParcelGirth": "20"
        }
    },
    "rates": [ {
        "carrier": "NEWGISTICS",
        "serviceId": "PRCLSEL",
        "parcelType": "PKG",
        "specialServices": [ {
            "specialServiceId": "DelCon"
        }, {
            "specialServiceId":"NOTIFICATIONS",
            "inputParameters":[ {
                "name":"RECIPIENT_NOTIFICATION_TYPE",
                "value":"ON_DELIVER"
            },{
                "name":"RECIPIENT_NOTIFICATION_EMAIL",
                "value":"widgets@example.com"
            } ]
        } ]
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "contentType": "BASE64",
        "size": "DOC_4X6",
        "fileFormat": "ZPL2"
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    }, {
        "name": "IS_RECTANGULAR",
        "value": "false"
    }, {
        "name": "CLIENT_FACILITY_ID",
        "value": "0093"
    }, {
        "name": "CARRIER_FACILITY_ID",
        "value": "1585"
    }, {
        "name": "NON_DELIVERY_OPTION",
        "value": "ChangeServiceRequested"
    } ],
    "references": [ {
        "name": "ReferenceNumber",
        "value": "OR1234"
    }, {
        "name": "AddlRef1",
        "value": "CC123456"
    }, {
        "name": "AddlRef2",
        "value": "CC4321"
    } ]
}'

Sample Response

{
    "fromAddress": {
        "company": "Widgets",
        "name": "Jon",
        "phone": "123-456-7890",
        "email": "widgets@example.com",
        "residential": false,
        "addressLines": [
            "2352 Bent Creek Rd"
        ],
        "cityTown": "Auburn",
        "stateProvince": "AL",
        "postalCode": "36830-6433",
        "countryCode": "US",
        "deliveryPoint": "52"
    },
    "toAddress": {
        "company": "Books",
        "name": "Jane",
        "phone": "785-000-000",
        "email": "books@example.com",
        "residential": false,
        "addressLines": [
            "121 N Santa Fe Ave"
        ],
        "cityTown": "Salina",
        "stateProvince": "KS",
        "postalCode": "67401-2615",
        "countryCode": "US",
        "deliveryPoint": "21"
    },
    "parcel": {
        "weight": {
            "unitOfMeasurement": "OZ",
            "weight": 32
        },
        "dimension": {
            "unitOfMeasurement": "IN",
            "length": 10,
            "width": 4,
            "height": 6,
            "irregularParcelGirth": 20
        }
    },
    "rates": [ {
        "carrier": "NEWGISTICS",
        "parcelType": "PKG",
        "specialServices": [ {
            "specialServiceId": "DelCon",
            "inputParameters": []
        }, {
            "specialServiceId":"NOTIFICATIONS",
            "inputParameters":[ {
                "name":"RECIPIENT_NOTIFICATION_TYPE",
                "value":"ON_DELIVER"
            },{
                "name":"RECIPIENT_NOTIFICATION_EMAIL",
                "value":"widgets@example.com"
            } ]
        } ],
        "serviceId": "PRCLSEL"
    } ],
    "documents": [ {
        "type": "SHIPPING_LABEL",
        "contentType": "BASE64",
        "fileFormat": "ZPL2",
        "pages": [ {
            "contents": "XlhBXkxIMCwxNX5TRDIwXkxSTl5DSTI3Xk..."
        } ]
    } ],
    "shipmentOptions": [ {
        "name": "SHIPPER_ID",
        "value": "9024324564"
    }, {
        "name": "IS_RECTANGULAR",
        "value": "false"
    }, {
        "name": "CLIENT_FACILITY_ID",
        "value": "0093"
    }, {
        "name": "CARRIER_FACILITY_ID",
        "value": "1585"
    }, {
        "name": "NON_DELIVERY_OPTION",
        "value": "ChangeServiceRequested"
    } ],
    "references": [ {
        "name": "ReferenceNumber",
        "value": "OR1234"
    }, {
        "name": "AddlRef1",
        "value": "CC123456"
    }, {
        "name": "AddlRef2",
        "value": "CC4321"
    } ],
    "shipmentId": "NEWGISTICS2200744454",
    "parcelTrackingNumber": "4209004692612123456789000000130487"
}

Sample Newgistics Label

  • The top of label displays the Return Address, the Endorsement (for example: “Return Service Requested”), and the Ship To Address.
  • The middle of label displays the Mail Class (for example: Parcel Select) and displays information used internally by Newgistics.
  • The bottom of label displays the USPS Tracking Barcode and the Delivery Post Office.
Sample Newgistics Label

Error Codes

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