Create a Newgistics Shipment

HTTP Request

POST /v1/shipments

Summary

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

Prerequisites

To use Newgistics, a merchant must be enrolled with Newgistics and obtain a Client Facility ID, a Newgistics Facility ID, and a Newgistics Merchant ID. To enroll a merchant, see Onboarding a Merchant with Newgistics.

Once you have enrolled with Newgistics, you must enable the Newgistics service on your PB account. To enable this service, please contact the PB Support team at ShippingAPISupport@pb.com.

Testing in Sandbox

When testing in the sandbox environment, use the sandbox ID values listed in 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. Newgistics supports the following services, special services, and parcel type:

    Services BPM (Bound Printed Matter)
    PRCLSEL (Parcel Select)
    PSLW (Parcel Select Lightweight)
    FCM (First-Class Mail)
    PM (Priority Mail)
    Special Services DelCon (Delivery Confirmation)
    Sig (Signature Confirmation)
    NOTIFICATIONS (Subscribe to provisioned transit triggers)
    Parcel Type PKG (Package)

     

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

    Field Value
    rates.carrier NEWGISTICS
    parcel.dimension Set this to the correct dimensions. Dimensions are required for Newgistics shipments.
    documents.size

    Set this to one of the following:

    • DOC_4X5
    • DOC_4X6
    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. For default values for the sandbox environment, see Newgistics IDs.
    • CARRIER_FACILITY_ID: The Newgistics Facility ID assigned by Newgistics to the merchant. For default values for the sandbox environment, see Newgistics IDs.

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

  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.

    In the rates.specialServices array, create a special service with the specialServiceId set to NOTIFICATIONS. In the inputParameters array, add 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 an example, see the Sample Request below on this page.

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

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

  7. The resolution for a Newgistics label is 203 DPI (Dots Per Inch).

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

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

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 a shipment object. Some elements are not applicable to Newgistics shipments and are marked as such.

IMPORTANT: 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, 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 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": "9024998978"
    }, {
        "name": "IS_RECTANGULAR",
        "value": "false"
    }, {
        "name": "CLIENT_FACILITY_ID",
        "value": "0093"
    }, {
        "name": "CARRIER_FACILITY_ID",
        "value": "1585"
    } ],
    "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": "9024998978"
    }, {
        "name": "IS_RECTANGULAR",
        "value": "false"
    }, {
        "name": "CLIENT_FACILITY_ID",
        "value": "0093"
    }, {
        "name": "CARRIER_FACILITY_ID",
        "value": "1585"
    } ],
    "references": [ {
        "name": "ReferenceNumber",
        "value": "OR1234"
    }, {
        "name": "AddlRef1",
        "value": "CC123456"
    }, {
        "name": "AddlRef2",
        "value": "CC4321"
    } ],
    "shipmentId": "NEWGISTICS2200744454",
    "parcelTrackingNumber": "4209004692612123456789000000130487"
}

Sample Newgistics Label

Sample Newgistics Label

Error Codes

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