Service
Standards
USPS Web Tools™
Application Programming Interface
User Guide
Version 3.5 (08/07/2023)
Table of Contents
2.0 Priority
Mail Service Standards API
3.0 Package
Services “StandardB” API
4.0 First
Class Mail Service Standards API
5.0 Express
Mail Service Commitments API
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.
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.
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.
Scheme |
Host |
Path |
API |
XML |
https:// |
secure.shippingapis.com |
/ShippingAPI.dll? |
API=PriorityMail |
&XML=(see
below) |
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.
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) |
|
|
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) |
|
Response: PriorityMail <PriorityMailResponse> <OriginZip>20024</OriginZip> <DestinationZip>20770</DestinationZip> <Days>1</Days> <EffectiveAcceptanceDate>2021-09-16</EffectiveAcceptanceDate> <ScheduledDeliveryDate>2021-09-17</ScheduledDeliveryDate> </PriorityMailResponse> |
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.
Scheme |
Host |
Path |
API |
XML |
https:// |
secure.shippingapis.com/ |
shippingapi.dll? |
API=StandardB |
&XML=(see
below) |
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 |
||||||||||||||
Required |
Defines mail class for commitment data.
For example: <MailClass>0<MailClass> |
String |
minOccurs="1"
maxOccurs="1" Enumeration ·
6 ·
601 ·
602 ·
603 ·
604 ·
605 |
|||||||||||||||
StandardBRequest |
Required
|
|
(Alias) |
|
|
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) |
|
Test XML Response: <StandardBResponse> <OriginZip>90201</OriginZip> <DestinationZip>21114</DestinationZip> <Days>7</Days> <EffectiveAcceptanceDate>2021-09-16</EffectiveAcceptanceDate> <ScheduledDeliveryDate>2021-09-23</ScheduledDeliveryDate> </StandardBResponse> |
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.
Scheme |
Host |
Path |
API |
XML |
https:// |
secure.shippingapis.com/ |
shippingapi.dll? |
API=FirstClassMail |
&XML=(see below) |
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.
For example: <MailClass>0<MailClass> |
String |
minOccurs="1"
maxOccurs="1" Enumeration ·
3 ·
301 ·
302 ·
303 ·
304 |
||||||||||||
FirstClassMailRequest |
Required once |
|
(Alias) |
|
|
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) |
|
Response FirstClassMail: <FirstClassMailResponse> <OriginZip>90201</OriginZip> <DestinationZip>21114</DestinationZip> <Days>3</Days> <EffectiveAcceptanceDate>2021-09-16</EffectiveAcceptanceDate> <ScheduledDeliveryDate>2021-09-19</ScheduledDeliveryDate> </FirstClassMailResponse> |
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.
Scheme |
Host |
Path |
API |
XML |
https:// |
secure.shippingapis.com/ |
shippingapi.dll? |
API=ExpressMailCommitment |
&XML=(see below) |
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) |
|
|
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
|
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) |
|
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> |