Servicio
Estándares
USPS Web Tools™
Application Programming Interface
Guía del usuario
Version 3.5 (08/07/2023)
Índice
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.
Nota: 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 |
Descripción |
Tipo |
Validation |
||||||||||||||||
PriorityMailRequest |
Obligatorio |
|
(Alias) |
|
||||||||||||||||
PriorityMailRequest / USERID |
Obligatorio |
This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID. Por Ejemplo: USERID="XXXXXXX" |
NMTOKEN |
|
||||||||||||||||
PriorityMailRequest / PASSWORD |
Optional |
This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password. Por Ejemplo: PASSWORD="XXXXXXX" |
NMTOKEN |
|
||||||||||||||||
PriorityMailRequest / OriginZip |
Obligatorio |
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. Por ejemplo: <OriginZip>90210</OriginZip> |
String |
|
||||||||||||||||
PriorityMailRequest / DestinationZip |
Obligatorio |
Origination and destination Zip Codes must be valid and must be 5 digits. Por ejemplo: <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 Por ejemplo: <DestinationType>1</DestinationType> |
String |
Enumeration · 1 · 2 · 3 |
||||||||||||||||
PriorityMailRequest / PMGuarantee |
Optional |
Default “N” |
Boolean |
|
||||||||||||||||
PriorityMailRequest / MailClass |
Obligatorio |
Defines mail class for commitment data.
Por ejemplo: <MailClass>0<MailClass> Nota: 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 |
Descripción |
Tipo |
Validation |
PriorityMailResponse |
Obligatorio |
|
(Alias) |
|
PriorityMailResponse / OriginZip |
Obligatorio |
OriginationZip sent in request. |
String |
|
PriorityMailResponse / DestinationZip |
Obligatorio |
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 |
Obligatorio |
|
(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 |
Descripción |
Tipo |
Validation |
||||||||||||||
StandardBRequest |
Obligatorio |
|
(Alias)
|
|
||||||||||||||
StandardBRequest / USERID |
Obligatorio |
This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID. Por Ejemplo: USERID="XXXXXXX" |
NMTOKEN |
|
||||||||||||||
StandardBRequest / PASSWORD |
Optional |
This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password. Por Ejemplo: PASSWORD="XXXXXXX" |
NMTOKEN |
|
||||||||||||||
StandardBRequest / OriginZip |
Obligatorio
|
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. Por ejemplo: <OriginZip>90210</OriginZip> |
String |
|
||||||||||||||
StandardBRequest / DestinationZip |
Obligatorio |
Origination and destination Zip Codes must be valid and must be 5 digits. Por ejemplo: <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 Por ejemplo: <DestinationType>1</DestinationType> |
String |
Enumeration · 1 · 2 · 3 |
||||||||||||||
Obligatorio |
Defines mail class for commitment data.
Por ejemplo: <MailClass>0<MailClass> |
String |
minOccurs="1" maxOccurs="1" Enumeration · 6 · 601 · 602 · 603 · 604 · 605 |
|||||||||||||||
StandardBRequest |
Obligatorio
|
|
(Alias) |
|
|
Tag Name |
Occurs |
Descripción |
Tipo |
Validation |
StandardBResponse |
Obligatorio |
|
(Alias)
|
|
StandardBResponse / OriginZip |
Obligatorio |
OriginationZip sent in request. |
String |
|
StandardBResponse / DestinationZip |
Obligatorio |
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 |
Obligatorio |
|
(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. Nota: 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 |
Descripción |
Tipo |
Validation |
||||||||||||
FirstClassMailRequest |
Obligatorio |
|
(Alias) |
|
||||||||||||
FirstClassMailRequest / USERID |
Obligatorio |
This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID. Por Ejemplo: USERID="XXXXXXX" |
NMTOKEN |
|
||||||||||||
FirstClassMailRequest / PASSWORD |
Optional |
This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password. Por Ejemplo: PASSWORD="XXXXXXX" |
NMTOKEN |
|
||||||||||||
FirstClassMailRequest / OriginZip |
Obligatorio |
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. Por ejemplo: <OriginZip>90210</OriginZip> |
String |
|
||||||||||||
FirstClassMailRequest / DestinationZip |
Obligatorio |
Origination and destination Zip Codes must be valid and must be 5 digits. Por ejemplo: <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 Por ejemplo: <DestinationType>1</DestinationType> |
String |
Enumeration · 1 · 2 · 3 |
||||||||||||
FirstClassMailRequest / MailClass |
Obligatorio |
Defines mail class for commitment data.
Por ejemplo: <MailClass>0<MailClass> |
String |
minOccurs="1" maxOccurs="1" Enumeration · 3 · 301 · 302 · 303 · 304 |
||||||||||||
FirstClassMailRequest |
Required once |
|
(Alias) |
|
|
Tag Name |
Occurs |
Descripción |
Tipo |
Validation |
FirstClassMailResponse |
Obligatorio |
|
(Alias) |
|
FirstClassMailResponse / OriginZip |
Obligatorio |
OriginationZip sent in request. |
String |
|
FirstClassMailResponse / DestinationZip |
Obligatorio |
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 |
Obligatorio |
|
(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 |
Descripción |
Tipo |
Validation |
ExpressMailCommitmentRequest |
Obligatorio |
|
(Alias)
|
|
ExpressMailCommitmentRequest / USERID |
Obligatorio |
This attribute specifies your Web Tools user ID. See the Developer's Guide for information on obtaining your USERID. Por Ejemplo: USERID="XXXXXXX" |
NMTOKEN |
|
ExpressMailCommitmentRequest / PASSWORD |
Optional |
This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password. Por Ejemplo: PASSWORD="XXXXXXX" |
NMTOKEN |
|
ExpressMailCommitmentRequest / OriginZIP |
Obligatorio
|
5 Digit Zip Code of the package destination. Por ejemplo: <OriginZIP>90210</OriginZIP> |
String |
|
ExpressMailCommitmentRequest / DestinationZIP |
Obligatorio |
Origination and destination Zip Codes must be valid and must be 5 digits. Por ejemplo: <DestinationZIP>20770</DestinationZIP> |
String |
|
ExpressMailCommitmentRequest / Date |
Obligatorio |
Date package is shipped. Can be left blank. Can use formats MM/DD/YYYY or DD-MMM-YYYY. Por ejemplo: <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. Por ejemplo: <DropOffTime>15:00</ DropOffTime > |
String |
|
ExpressMailCommitmentRequest / ReturnDates |
Optional |
Indicates if Scheduled Delivery and Effective Acceptance dates should be returned. Specify ‘true’ or ‘false’. Por ejemplo: <ReturnDates>verdadero</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 |
Obligatorio |
|
(Alias) |
|
|
Tag Name |
Occurs |
Descripción |
Tipo |
Validation |
||||||||||
ExpressMailCommitmentResponse |
Obligatorio |
|
(Alias) |
|
||||||||||
ExpressMailCommitmentResponse / OriginZIP |
Obligatorio |
OriginationZip sent in request. |
String |
|
||||||||||
ExpressMailCommitmentResponse / OriginCity |
Obligatorio |
Originating City. |
String |
|
||||||||||
ExpressMailCommitmentResponse / OriginState |
Obligatorio |
Originating State. |
String |
|
||||||||||
ExpressMailCommitmentResponse / DestinationZIP |
Obligatorio |
DestinationZip sent in request. |
String |
|
||||||||||
ExpressMailCommitmentResponse / DestinationCity |
Obligatorio |
Destinating City. |
String |
|
||||||||||
ExpressMailCommitmentResponse / DestinationState |
Obligatorio |
Destinating State. |
String |
|
||||||||||
ExpressMailCommitmentResponse / Date |
Obligatorio |
Date package shipped. |
String |
|
||||||||||
ExpressMailCommitmentResponse / Time |
Obligatorio |
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 p.m.) |
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 |
Fecha de entrega programada. 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 |
Obligatorio |
|
(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>EN OFICINA POSTAL</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>EN OFICINA POSTAL</Facility> <Street>55 GRASSO PLZ</Street> <City>SAINT LOUIS</City> <State>MO</State> <Zip>63123</Zip> </Location> </Commitment> </ExpressMailCommitmentResponse> |