Domestic Mail

Service

Standards

 

USPS Web Tools™

Application Programming Interface

User Guide

Version 3.5 (08/07/2023)

 

 

 


 

Table of Contents

1.0        Introduction to Web Tools. 3

1.1        Before you get started: 3

2.0        Priority Mail Service Standards API 3

2.1        Overview. 3

2.1.1        API Signature Table. 3

2.2        Request Descriptions. 3

2.2.1        Sample Request 4

2.3        Response Descriptions. 5

2.3.1        Sample Response. 5

3.0        Package Services “StandardB” API 5

3.1        Overview. 5

3.1.1        API Signature Table. 6

3.2        Request Descriptions. 6

3.2.1        Sample Request 7

3.3        Response Descriptions. 7

3.3.1        Sample Response. 7

4.0        First Class Mail Service Standards API 8

4.1        Overview. 8

4.1.1        API Signature Table. 8

4.2        Request Descriptions. 8

4.2.1        Sample Request 9

4.3        Response Descriptions. 9

4.3.1        Sample Response. 10

5.0        Express Mail Service Commitments API 10

5.1        Overview. 10

5.1.1        API Signature Table. 10

5.2        Request Descriptions. 10

5.2.1        Sample Request 11

5.3        Response Descriptions. 11

5.3.1        Sample Request 13


1.0   Introduction to Web Tools

This document contains a Reference Guide to the Package Service Standards APIs. See the Developers Guide to learn the administrative process for gaining access to the Web Tools APIs as well as the basic mechanism for calling the APIs and processing the results. The Developer’s Guide also contains information on testing and troubleshooting.

Note: The Request Parameter sections present the XML input tags for generating live requests along with the restrictions on the values allowed. An error message will be returned if an incorrect value is entered. Also, be aware of the maximum character amounts allowed for some tags. If the user enters more than those amounts, an error will not be generated. Web Tools will simply pass in the characters up to the maximum amount allowed and disregard the rest. This is important since the resulting value could prevent a correct response.

When building the XML request, pay particular attention to the order and case for tags. An error message will be returned if an incorrect value is entered. Remember that all data and attribute values in this document are for illustration purposes and are to be replaced by your actual values. For instance, a line of sample code may be:

<DestinationZIP>12345</DestinationZIP>

In this instance, you will replace “12345” with the destination Zip Code for your request.

1.1         Before you get started:

For information on registering and getting started with Web Tools, please refer to the Step-By-Step guide found on the Web Tools Technical Documentation Page.

 

2.0        Priority Mail Service Standards API

2.1         Overview

The Priority Mail Service Standards API receives requests and returns the number of days (on average) it will take a Priority Mail package to arrive at its destination. Ensure that end-users understand that these are service standards and not guaranteed commitments. The Priority Mail Service Standards API processes a single request.

2.1.1   API Signature Table

Scheme

Host

Path

API

XML

https://

secure.shippingapis.com

/ShippingAPI.dll?

API=PriorityMail

&XML=(see below)

 

2.2         Request Descriptions

Tag Name

Occurs

Description

Type

Validation

PriorityMailRequest

Required 

 

(Alias)

 

PriorityMailRequest / USERID

Required

This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID.

For Example: USERID="XXXXXXX"

NMTOKEN

 

PriorityMailRequest / PASSWORD

Optional

This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password.

For Example: PASSWORD="XXXXXXX"

NMTOKEN

 

PriorityMailRequest / OriginZip

Required

Origination and destination Zip Codes must be valid. Either the first 3 digits or first 5 digits of the Zip Code are entered between the open tag and close tag. 

For example:

<OriginZip>90210</OriginZip>

String

 

PriorityMailRequest / DestinationZip

Required

Origination and destination Zip Codes must be valid and must be 5 digits.

For example: <DestinationZip>20770</DestinationZip>

String

 

PriorityMailRequest / DestinationType

Optional

Destination Type for package. 

Valid Values:

“1” = PO-Addressee – Street (Default Value)

“2” = PO-Addressee – PO Box

“3” = Hold For Pick-up

For example: <DestinationType>1</DestinationType>

String

Enumeration

·        1

·        2

·        3

PriorityMailRequest / PMGuarantee

Optional

Default “N”

Boolean

 

PriorityMailRequest / MailClass

Required

Defines mail class for commitment data.

Mail Class Value

Description

2

Priority Mail

201

Priority Mail 1-Day (Deprecated)

202

Priority Mail 2-Day (Deprecated)

203

Priority Mail 3-Day (Deprecated)

204

Priority Mail Military

205

Priority Mail DPO

206

Priority Mail Offshore

For example:

<MailClass>0<MailClass>

 

Note: When <MailClass>=”201, 202, or 203”, 1-Day, 2-Day and/or 3-Day references will be removed from response data and a single XML response for Priority Mail service standards will return.

String

minOccurs="1" maxOccurs="1"

Enumeration

·        2

·        201

·        202

·        203

·        204

·        205

·        206

PriorityMailRequest

Required once

 

(Alias)

 

2.2.1   Sample Request

Request: PriorityMail:

<PriorityMailRequest USERID="XXXXXXXXX" PASSWORD="">

<OriginZip>90201</OriginZip>

<DestinationZip>21114</DestinationZip>

<MailClass>201</MailClass>

</PriorityMailRequest>

2.3         Response Descriptions

Tag Name

Occurs

Description

Type

Validation

PriorityMailResponse

Required

 

(Alias)

 

PriorityMailResponse / OriginZip

Required

OriginationZip sent in request.

String

 

PriorityMailResponse / DestinationZip

Required

DestinationZip sent in request.

String

 

PriorityMailResponse / Days

Optional

Numbers of days expected to deliver.

String

 

PriorityMailResponse / IsGuaranteed

Optional

Is the delivery guaranteed.

String

 

PriorityMailResponse / Message

Optional

Service Standards Messaging. Appears when applicable.

 

For example:<Msg>Your shipment may be delayed due to transportation issues.</Msg>

String

 

PriorityMailResponse / EffectiveAcceptanceDate

Optional

Effective Acceptance Date is returned when <DestinationType> is specified in the request.

String

 

PriorityMailResponse / ScheduledDeliveryDate

Optional

Scheduled Delivery Date is returned when <DestinationType> is specified in the request.

String

 

PriorityMailResponse

Required

 

(Alias)

 

2.3.1     Sample Response

Response: PriorityMail

<PriorityMailResponse>

<OriginZip>20024</OriginZip>

<DestinationZip>20770</DestinationZip>

<Days>1</Days>

<EffectiveAcceptanceDate>2021-09-16</EffectiveAcceptanceDate>

<ScheduledDeliveryDate>2021-09-17</ScheduledDeliveryDate>

</PriorityMailResponse>

3.0        Package Services “StandardB” API

3.1         Overview

The Package Services “StandardB” API receives requests and returns the average number of days it will take a package to arrive at its destination. There are four types of Package Services: Standard Post, Bound Printed Matter, Library Mail, and Media Mail. The Package Services “StandardB” API processes a single request. Ensure that end-users understand that these are service standards and not guaranteed commitments.

3.1.1     API Signature Table

Scheme

Host

Path

API

XML

https://

secure.shippingapis.com/

shippingapi.dll?

API=StandardB

&XML=(see below)

3.2         Request Descriptions

Tag Name

Occurs

Description

Type

Validation

StandardBRequest

Required 

 

(Alias)

 

StandardBRequest / USERID

Required

This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID.

For Example: USERID="XXXXXXX"

NMTOKEN

 

StandardBRequest / PASSWORD

Optional

This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password.

For Example: PASSWORD="XXXXXXX"

NMTOKEN

 

StandardBRequest / OriginZip

Required

Origination and destination Zip Codes must be valid. Either the first 3 digits or first 5 digits of the Zip Code are entered between the open tag and close tag. 

For example:

<OriginZip>90210</OriginZip>

String

 

StandardBRequest / DestinationZip

Required

Origination and destination Zip Codes must be valid and must be 5 digits.

For example:

<DestinationZip>20770</DestinationZip>

String

 

StandardBRequest / DestinationType

Optional

Destination Type for package. 

Valid Values:

“1” = PO-Addressee – Street (Default Value)

“2” = PO-Addressee – PO Box

“3” = Hold For Pick-up

For example: <DestinationType>1</DestinationType>

String

Enumeration

·        1

·        2

·        3

StandardBRequest / MailClass

Required

Defines mail class for commitment data.

Mail Class Value

Description

6

Package Services

601

Parcel Select (Deprecated)

602

Standard Post

603

Media Mail

604

Library Mail

605

Bound Printed Matter

For example:

<MailClass>0<MailClass>

String

minOccurs="1" maxOccurs="1"

Enumeration

·        6

·        601

·        602

·        603

·        604

·        605

StandardBRequest

Required

 

(Alias)

 

3.2.1     Sample Request

Test XML Request:

<StandardBRequest USERID="XXXXXXXXX" PASSWORD="">

<OriginZip>90201</OriginZip>

<DestinationZip>21114</DestinationZip>

<MailClass>601</MailClass>

</StandardBRequest>

3.3         Response Descriptions

Tag Name

Occurs

Description

Type

Validation

StandardBResponse

Required

 

(Alias)

 

StandardBResponse / OriginZip

Required

OriginationZip sent in request.

 

String

 

StandardBResponse / DestinationZip

Required

DestinationZip sent in request.

 

String

 

StandardBResponse / Days

Optional

Numbers of days expected to deliver.

 

String

 

StandardBResponse / Message

Optional

Service Standards Messaging. Appears when applicable.

 

For example:<Msg>Your shipment may be delayed due to transportation issues.</Msg>

String

 

StandardBResponse / EffectiveAcceptanceDate

Optional

Effective Acceptance Date is returned when <DestinationType> is specified in the request.

String

 

StandardBResponse / ScheduledDeliveryDate

Optional

Scheduled Delivery Date is returned when <DestinationType> is specified in the request.

String

 

StandardBResponse

Required

 

(Alias)

 

3.3.1     Sample Response

Test XML Response:

<StandardBResponse>

<OriginZip>90201</OriginZip>

<DestinationZip>21114</DestinationZip>

<Days>7</Days>

<EffectiveAcceptanceDate>2021-09-16</EffectiveAcceptanceDate>

<ScheduledDeliveryDate>2021-09-23</ScheduledDeliveryDate>

</StandardBResponse>

 

4.0        First Class Mail Service Standards API

4.1         Overview

The First Class Mail Service Standards API receives requests and returns the average number of days it will take a package to arrive at its destination. The First Class Mail Service Standards API processes a single request. Ensure that end-users understand that these are service standards and not guaranteed commitments. Note: Effective July 9th, 2023, First-Class Package Service was replaced with Ground Advantage. The First Class Mail Service Standards API supports First-Class Mail flats and Ground Advantage parcels.

4.1.1     API Signature Table

Scheme

Host

Path

API

XML

https://

secure.shippingapis.com/

shippingapi.dll?

API=FirstClassMail

&XML=(see below)

4.2         Request Descriptions

Tag Name

Occurs

Description

Type

Validation

FirstClassMailRequest

Required 

 

(Alias)

 

FirstClassMailRequest / USERID

Required

This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID.

For Example: USERID="XXXXXXX"

NMTOKEN

 

FirstClassMailRequest / PASSWORD

Optional

This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password.

For Example: PASSWORD="XXXXXXX"

NMTOKEN

 

FirstClassMailRequest / OriginZip

Required

Origination and destination Zip Codes must be valid. Either the first 3 digits or first 5 digits of the Zip Code are entered between the open tag and close tag. 

For example:

<OriginZip>90210</OriginZip>

String

 

FirstClassMailRequest / DestinationZip

Required

Origination and destination Zip Codes must be valid and must be 5 digits.

For example:

<DestinationZip>20770</DestinationZip>

String

 

FirstClassMailRequest / DestinationType

Optional

Destination Type for package. 

1 = PO-Addressee – Street (Default)

2 = PO-Addressee – PO Box

3 = Hold For Pick-up

For example:

<DestinationType>1</DestinationType>

String

Enumeration

·        1

·        2

·        3

FirstClassMailRequest / MailClass

Required

Defines mail class for commitment data.

Mail Class Value

Description

3

USPS Ground Advantage (up to 15.999 oz)

301

First-Class Mail Letters

302

First-Class Mail Flats

303

First-Class Mail Cards

304

USPS Ground Advantage (up to 15.999 oz)

 

For example:

<MailClass>0<MailClass>

String

minOccurs="1" maxOccurs="1"

Enumeration

·        3

·        301

·        302

·        303

·        304

FirstClassMailRequest

Required once

 

(Alias)

 

4.2.1     Sample Request

Request: FirstClassMail

<FirstClassMailRequest USERID="XXXXXXXXX" PASSWORD="">

<OriginZip>90201</OriginZip>

<DestinationZip>21114</DestinationZip>

<MailClass>301</MailClass>

</FirstClassMailRequest>

4.3         Response Descriptions

Tag Name

Occurs

Description

Type

Validation

FirstClassMailResponse

Required

 

(Alias)

 

FirstClassMailResponse / OriginZip

Required

OriginationZip sent in request.

String

 

FirstClassMailResponse / DestinationZip

Required

DestinationZip sent in request.

String

 

FirstClassMailResponse / Days

Optional

Numbers of days expected to deliver.

String

 

FirstClassMailResponse / Message

Optional

Service Standards Messaging. Appears when applicable.

 

For example:<Msg>Your shipment may be delayed due to transportation issues.</Msg>

String

 

FirstClassMailResponse / EffectiveAcceptanceDate

Optional

Effective Acceptance Date is returned when <DestinationType> is specified in the request.

String

 

FirstClassMailResponse / ScheduledDeliveryDate

Optional

Scheduled Delivery Date is returned when <DestinationType> is specified in the request.

String

 

FirstClassMailResponse

Required

 

(Alias)

 

4.3.1     Sample Response

Response FirstClassMail:

<FirstClassMailResponse>

<OriginZip>90201</OriginZip>

<DestinationZip>21114</DestinationZip>

<Days>3</Days>

<EffectiveAcceptanceDate>2021-09-16</EffectiveAcceptanceDate>

<ScheduledDeliveryDate>2021-09-19</ScheduledDeliveryDate>

</FirstClassMailResponse>

 

5.0        Express Mail Service Commitments API

5.1         Overview

The Express Mail Service Commitments API provides delivery commitments for Express Mail packages for the given Zip Codes to include package drop-off information. A user provides an origination and a destination Zip Code and an optional current or future date that the package will be shipped.

5.1.1     API Signature Table

Scheme

Host

Path

API

XML

https://

secure.shippingapis.com/

shippingapi.dll?

API=ExpressMailCommitment

&XML=(see below)

5.2         Request Descriptions

Tag Name

Occurs

Description

Type

Validation

ExpressMailCommitmentRequest

Required 

 

(Alias)

 

ExpressMailCommitmentRequest / USERID

Required

This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID.

For Example: USERID="XXXXXXX"

NMTOKEN

 

ExpressMailCommitmentRequest / PASSWORD

Optional

This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password.

For Example: PASSWORD="XXXXXXX"

NMTOKEN

 

ExpressMailCommitmentRequest / OriginZIP

Required

5 Digit Zip Code of the package destination. 

For example:

<OriginZIP>90210</OriginZIP>

String

 

ExpressMailCommitmentRequest / DestinationZIP

Required

Origination and destination Zip Codes must be valid and must be 5 digits.

For example:

<DestinationZIP>20770</DestinationZIP>

String

 

ExpressMailCommitmentRequest / Date

Required

Date package is shipped. Can be left blank. Can use formats MM/DD/YYYY or DD-MMM-YYYY.

For example:

<Date>05-May-2014</Date>

String

 

ExpressMailCommitmentRequest / DropOffTime

Optional

Time package is shipped. This tag can be omitted or left blank. Use format HH:MM such as 13:30.

For example:

<DropOffTime>15:00</ DropOffTime >

String

 

ExpressMailCommitmentRequest / ReturnDates

Optional

Indicates if Scheduled Delivery and Effective Acceptance dates should be returned. Specify ‘true’ or ‘false’.

For example:

<ReturnDates>true</ReturnDates>

String

 

ExpressMailCommitmentRequest / PMGuarantee

Optional

Indicator to display Guarantee information for applicable service types.

 “Y” = Yes, display

“N” = No, do not display (Default Value)

String

Enumeration

·        Y

·        N

ExpressMailCommitmentRequest

Required

 

(Alias)

 

5.2.1     Sample Request

Request: ExpressMailCommitment

<ExpressMailCommitmentRequest USERID="XXXXXXXXX" PASSWORD="">

<OriginZIP>63123</OriginZIP>

<DestinationZIP>89301</DestinationZIP>

<Date>05-26-2021</Date>

<DropOffTime>09:00</DropOffTime>

<ReturnDates>true</ReturnDates>

<PMGuarantee>Y</PMGuarantee>

</ExpressMailCommitmentRequest>

 

5.3         Response Descriptions

Tag Name

Occurs

Description

Type

Validation

ExpressMailCommitmentResponse

Required 

 

(Alias)

 

ExpressMailCommitmentResponse / OriginZIP

Required

OriginationZip sent in request.

String

 

ExpressMailCommitmentResponse / OriginCity

Required

Originating City.

String

 

ExpressMailCommitmentResponse / OriginState

Required

Originating State.

String

 

ExpressMailCommitmentResponse / DestinationZIP

Required

DestinationZip sent in request.

String

 

ExpressMailCommitmentResponse / DestinationCity

Required

Destinating City.

String

 

ExpressMailCommitmentResponse / DestinationState

Required

Destinating State.

String

 

ExpressMailCommitmentResponse / Date

Required

Date package shipped.

String

 

ExpressMailCommitmentResponse / Time

Required

Time.

String

 

ExpressMailCommitmentResponse / ExpeditedTransMessage

Optional

Expedited Transportation Message. Returned when applicable and the request has the ReturnDates set to true.

String

 

ExpressMailCommitmentResponse / MsgCode

Optional

Message Code. Returned when applicable and the request has the ReturnDates set to true.

 

Valid Message Code

“TM103” = Your shipment may be delayed due to transportation issues.

String

Enumeration=

·        TM103

ExpressMailCommitmentResponse / Msg

Optional

Message Text. Returned when applicable and the request has the ReturnDates set to true.

 

For example:<Msg>Your shipment may be delayed due to transportation issues.</Msg>

String

 

ExpressMailCommitmentResponse / EffectiveAcceptanceDate

Optional

Effective Acceptance Date. Returned when the request has the ReturnDates set to true.

String

 

ExpressMailCommitmentResponse / Commitment

Optional

Holds the details of a commitment. Returned if valid.

(Group)

 

ExpressMailCommitmentResponse / Commitment / Name

Optional

Commitment Name

String

Enumeration=

·        1-Day

·        2-Day

·        3-Day

·        DPO

·        Military

ExpressMailCommitmentResponse / Commitment / Time

Optional

Commitment Time. (eg: 6:00 PM)

String

 

ExpressMailCommitmentResponse / Commitment / Sequence

Optional

Commitment Sequence

Seq #  

Service Standard

A0118

1-Day at 6:00 PM

B0118

1-Day at 6:00 PM

A0218

2-Day at 6:00 PM

B0218

2-Day at 6:00 PM

String

Enumeration=

·        A0118

·        B0118

·        A0218

·        B0218

ExpressMailCommitmentResponse / Commitment / Location

Optional

Groups drop off location information.

(Group)

 

ExpressMailCommitmentResponse / Commitment / Location / ScheduledDeliveryDate

Optional

Scheduled Delivery Date. Returned when the request has the ReturnDates set to true.

String

 

ExpressMailCommitmentResponse / Commitment / Location / CutOff

Optional

Cut-Off Time.

String

 

ExpressMailCommitmentResponse / Commitment / Location / Facility

Optional

Facility Type

String

Enumeration=

·        POST OFFICE

·        PRIORITY MAIL EXPRESS COLLECTION BOX

·        AIR MAIL FACILITY

ExpressMailCommitmentResponse / Commitment / Location / Street

Optional

Facility Street

String

 

ExpressMailCommitmentResponse / Commitment / Location / City

Optional

Facility City

String

 

ExpressMailCommitmentResponse / Commitment / Location / State

Optional

Facility State

String

 

ExpressMailCommitmentResponse / Commitment / Location / Zip

Optional

Facility Zip Code

String

 

ExpressMailCommitmentResponse / Commitment / Location /  IsGuaranteed

Optional

Indicates if Guaranee is offered. Will only be returned if the PMGuarantee in the request is set to “Y”.

1 = Guaranteed

2 = No Guarantee

3 = Temporary No Guarantee

String

Enumeration=

·        1

·        2

·        3

ExpressMailCommitmentResponse / Message

Optional

Message indicating over 200 location, when there are more than the 200 returned.

String

 

ExpressMailCommitmentResponse

Required 

 

(Alias)

 

5.3.1     Sample Request

Response: ExpressMailCommitment

<ExpressMailCommitmentResponse>

<OriginZIP>63123</OriginZIP>

<OriginCity>SAINT LOUIS</OriginCity>

<OriginState>MO</OriginState>

<DestinationZIP>89301</DestinationZIP>

<DestinationCity>ELY</DestinationCity>

<DestinationState>NV</DestinationState>

<Date>26-May-2021</Date>

<Time>9:00AM</Time>

<EffectiveAcceptanceDate>2021-05-26</EffectiveAcceptanceDate>

<Commitment>

<CommitmentName>2-Day</CommitmentName>

<CommitmentTime>6:00 PM</CommitmentTime>

<CommitmentSequence>A0218</CommitmentSequence>

<Location>

<ScheduledDeliveryDate>2021-05-28</ScheduledDeliveryDate>

<CutOff>5:30 PM</CutOff>

<Facility>POST OFFICE</Facility>

<Street>55 GRASSO PLZ</Street>

<City>SAINT LOUIS</City>

<State>MO</State>

<Zip>63123</Zip>

</Location>

</Commitment>

<Commitment>

<CommitmentName>2-Day</CommitmentName>

<CommitmentTime>6:00 PM</CommitmentTime>

<CommitmentSequence>B0218</CommitmentSequence>

<Location>

<ScheduledDeliveryDate>2021-05-28</ScheduledDeliveryDate>

<CutOff>5:30 PM</CutOff>

<Facility>POST OFFICE</Facility>

<Street>55 GRASSO PLZ</Street>

<City>SAINT LOUIS</City>

<State>MO</State>

<Zip>63123</Zip>

</Location>

</Commitment>

</ExpressMailCommitmentResponse>