Rate Calculator APIs

 

USPS Web Tools™

Application Programming Interface

用户指南

Version 3.14 (01/05/2024)

 

 

 

 

 

 

 

 


 

目录

1.0         Introduction. 3

1.1......... Before you get started: 3

2.0         Domestic Rates API - RateV4. 3

2.1......... Overview. 3

2.1.1     API Signature. 3

2.2......... Request Descriptions. 3

2.2.1     Sample Request 14

2.3......... Response Descriptions. 16

2.3.1     Sample Response. 24

2.4......... Error Responses. 33

3.0         International Rates API – IntlRateV2. 34

3.1......... Overview. 34

3.1.1     API Signature. 34

3.2......... Request Descriptions. 34

3.2.1     Sample Requests. 41

3.3......... Response Descriptions. 42

3.3.1     Sample Response. 48

4.0         Error Responses. 59

5.0         Appendix A – RateV4 CLASSID Values. 61

6.0         Appendix B – IntlRateV2 Service ID Values. 64


 

1.0   Introduction

This document contains a Reference Guide to the Rate Calculator APIs, RateV4 and IntlRateV2. See the Developer's 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.

备注: 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:

<Pounds>2</Pounds>

In this instance, you will replace “2” with the weight in pounds for the package.

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. If you need assistance with an error response, contact the USPS Internet Customer Care Center (ICCC) https://Emailus.usps.com/.

2.0   Domestic Rates API - RateV4

2.1     Overview

The RateV4 API lets customers calculate the rate for domestic packages and envelopes given the weight and dimensions of the item. The RateV4 API limits the data requested to twenty-five (25) packages per transaction.

2.1.1     API Signature

Scheme

Host

小道

API

XML

https://

secure.shippingapis.com

/ShippingAPI.dll?

API=RateV4

&XML=(see Tag Descriptions below)

2.2     Request Descriptions

Tag Name

Occurs

描述

类型

Validation

RateV4Request

需要

API=RateV4

This API returns the current USPS postage corresponding to the parameters given.

(Group)

 

RateV4Request / USERID

需要

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

例如:USERID="XXXXXXX"

NMTOKEN

 

RateV4Request / PASSWORD

Optional

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

例如:PASSWORD="XXXXXXX"

NMTOKEN

 

RateV4Request / Revision

Optional

Set this value to “2” to return all currently documented response fields.

例如:

<Revision>2</Revsion>

String

 

RateV4Request / Package

Required repeating up to 25 times

See the RateV4 Service Request chart for valid combinations of the following tags.

(Group)

 

RateV4Request / Package / Service

需要

Web Tools validates the entry to one of the service types.

 

例如:

<Service>PRIORITY MAIL EXPRESS</Service>

 

注意: For users that want to return all eligible products in a single RateV4 API call, please see details below regarding “ALL” calls:

<Service>

描述

所有

When <Service>=“ALL”, all eligible retail products will return in the API response.

在线

When <Service>=“ONLINE”, all eligible retail and commercial base/commercial products will return in the API response. Cubic products will return when eligible.

PLUS

When <Service>=“PLUS”, all eligible retail, commercial base/commercial, and commercial plus products will return in the API response. Cubic products will return when eligible.

String

whiteSpace=collapse
Enumerations=

·  ALL

·  ONLINE

·  PLUS

·  PRIORITY

·  PRIORITY COMMERCIAL

·  PRIORITY MAIL CUBIC

·  PRIORITY MAIL RETURNS

·  PRIORITY MAIL CUBIC RETURNS

·  FIRST CLASS

·  FIRST CLASS COMMERCIAL

·  PRIORITY MAIL EXPRESS

·  PRIORITY MAIL EXPRESS COMMERCIAL

·  PRIORITY MAIL EXPRESS RETURNS

·  GROUND ADVANTAGE

·  GROUND ADVANTAGE COMMERCIAL

·  GROUND ADVANTAGE CUBIC

·  GROUND ADVANTAGE RETURNS

·  PARCEL SELECT DE

·  MEDIA

·  LIBRARY

·  BPM

·  CONNECT LOCAL

RateV4Request / Package / Service DelOpt

Optional

This attribute specifies the service delivery option beyond normal/standard delivery. When the service delivery option attribute is indicated, the results returned will satisfy both the mail class and delivery option indicated.

 

例如:

<Service DelOpt="HAZMAT">PRIORITY</Service>

 

投递选项

描述

危险物品

危险品

PARCELLOCKER

Parcel Locker Delivery

HFP

存放待取

SUNHOL

周日/假日投递

标准

Normal Delivery

未知

Default - will result in current <Service> enumerations being used to determine response.

String

Default=UNKNOWN

Enumerations=

·  HAZMAT

·  PARCELLOCKER

·  HFP

·  SUNHOL

·  STANDARD

·  UNKNOWN

RateV4Request / Package / FirstClassMailType

Optional

The <FirstClassMailType> tag is returned only if the <ServiceType> submitted is “First Class

 

<FirstClassMailType>LETTER</FirstClassMailType>

 

注意: Flats are also known as Large Envelopes

String

whiteSpace=collapse

Enumerations=

·  LETTER

·  FLAT

·  POSTCARD

·  LARGE POSTCARD

RateV4Request / Package / ZipOrigination

需要

ZIP code must be valid.

例如: <ZipOrigination>20770</ZipOrigination>

String

whiteSpace=collapse
length=5
pattern=\d{5}

RateV4Request / Package / ZipDestination

需要

ZIP code must be valid.

例如: <ZipDestination>54324</ZipDestination>

String

length=5
whiteSpace=collapse
pattern=\d{5}

RateV4Request / Package / Pounds

需要

Value must be numeric.

 

Package weight cannot exceed 70 pounds. 

 

例如:

<Pounds>2</Pounds>

<Pounds>2.12345678</Pounds>

String

maxInclusive=70
minInclusive=0

RateV4Request / Package / Ounces

需要

Value must be numeric.

 

Package weight cannot exceed 70 pounds (1120 ounces). 

 

例如:

<Ounces>0</Ounces>

<Ounces>0.12345678</Ounces>

String

maxInclusive=1120.0
minInclusive=0.0

RateV4Request / Package / Container

需要

Use to specify container attributes that may affect postage; otherwise, leave blank.

 

注意: When <Service>=“PRIORITY MAIL CUBIC”, “PRIORITY MAIL CUBIC RETURNS” or “GROUND ADVANTAGE CUBIC”,  the only valid containers are “CUBIC PARCELS” or “CUBIC SOFT PACK”. It is recommended to pass the largest Cubic dimension as “Length” in <Length> request tag and the second largest dimension as “Width” in <Width> request tag.

注意: “VARIABLE” is used to denote that a customer is using packaging other than a USPS-produced Flat Rate Box/Envelope”.

 

注意: <Container> enumerations: “SM FLAT RATE BAG”, “LG FLAT RATE BAG”, “FLAT RATE BOX” only applicable when <Service>=“Connect Local.”

 

 

String

whiteSpace=collapse
Enumerations=

·  VARIABLE

·  FLAT RATE ENVELOPE

·  PADDED FLAT RATE ENVELOPE

·  LEGAL FLAT RATE ENVELOPE

·  SM FLAT RATE ENVELOPE

·  WINDOW FLAT RATE ENVELOPE

·  GIFT CARD FLAT RATE ENVELOPE

·  SM FLAT RATE BOX

·  MD FLAT RATE BOX

·  LG FLAT RATE BOX

·  CUBIC PARCELS

·  CUBIC SOFT PACK

·  SM FLAT RATE BAG

·  LG FLAT RATE BAG

·  FLAT RATE BOX

RateV4Request / Package / Width

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference DMM https://pe.usps.com/text/dmm300/index.htm

Decimal

minExclusive=0.0
totalDigits=10  

RateV4Request / Package / Length

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference DMM https://pe.usps.com/text/dmm300/index.htm

Decimal

minExclusive=0.0
totalDigits=10  

RateV4Request / Package / Height

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference DMM https://pe.usps.com/text/dmm300/index.htm

Decimal

minExclusive=0.0
totalDigits=10  

RateV4Request / Package / Girth

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference DMM https://pe.usps.com/text/dmm300/index.htm

Decimal

minExclusive=0.0
totalDigits=10  

RateV4Request / Package / Value

Optional

Available when RateV4Request [Revision='2'].

 

Package value. Used to determine availability and cost of extra services.

 

例如:

<Value>150.00</Value>

String

minOccurs=0

maxOccurs=1

RateV4Request / Package / AmountToCollect

Optional

Available when RateV4Request [Revision='2'].

 

Collect on delivery amount. Used to determine availability and cost of extra services.

 

例如: <AmountToCollect>150.00</AmountToCollect>

String

minExclusive=0.0
totalDigits=10

RateV4Request / Package / SpecialServices

Optional

Available when RateV4Request [Revision='2'].

 

Groups the SpecialServices elements.

 

Special Services prices and availability will not be returned when Service = “ALL”, “ONLINE”, or “PLUS”

(Group)

 

RateV4Request / Package / SpecialServices / SpecialService

Optional, repeating up to 10 times

Available when RateV4Request [Revision='2'].

 

Defines extra services in order to determine price and availability of additional services.

 

An initial call without the SpecialService tag specified is recommended to determine base availability of special services for each mail class (<Service>).

The extra service definitions are as follows:

Special Service Name

ServiceID

保险

100

Insurance – Priority Mail Express

101

退回收据

102

货到付款

103

邮递证明(表格 3665)

104

Certified Mail

105

USPS 追踪服务

106

签收确认

108

挂号信

109

电子退回收据

110

Registered mail COD collection Charge

112

Return Receipt – Priority Mail Express

118

要求成人签名

119

成人签名受限投递

120

Insurance – Priority Mail

125

USPS Tracking Electronic

155

Signature Confirmation Electronic

156

邮递证明(表格 3817)

160

认证邮件受限投递

170

需要认证邮件成人签名

171

CERTIFIED MAIL 成人签名受限投递

172

Signature Confirm. Restrict. 投递

173

Signature Confirmation Electronic Restricted Delivery

174

货到付款受限投递

175

挂号邮件受限投递

176

保险受限投递

177

Insurance Restrict.  Delivery – Priority Mail

179

Insurance Restrict. Delivery – Priority Mail Express

178

Insurance Restrict. Delivery (Bulk Only)

180

Scan Retention

181

Scan + Signature Retention

182

USPS 标签递送服务

183

USPS Connect Sunday Delivery (Availability depends on Destination ZIP Code)

447

HAZMAT Services

ServiceID

Air Eligible Ethanol Package

810

Class 1 – Toy Propellant/Safety Fuse Package

811

Class 3 – Flammable Liquid Package

812

Class 7 – Radioactive Materials Package

813

Class 8 – Corrosive Materials Package

814

Class 8 – Nonspillable Wet Battery Package

815

Class 9 – Lithium Battery Marked – Ground Only Package

816

Class 9 – Lithium Battery – Returns Package

817

Class 9 – Lithium batteries, marked package

818

Class 9 – Dry Ice Package

819

Class 9 – Lithium batteries, unmarked package

820

Class 9 – Magnetized Materials Package

821

Division 4.1 – Flammable Solids or Safety Matches Package

822

Division 5.1 – Oxidizers Package

823

Division 5.2 – Organic Peroxides Package

824

Division 6.1 – Toxic Materials Package

825

Division 6.2 – Infectious Substances Package

826

Excepted Quantity Provision Package

827

Ground Only Hazardous Materials

828

ID8000 Consumer Commodity Package

829

Lighters Package

830

LTD QTY Ground Package

831

Small Quantity Provision Package

832

 

例如:

<SpecialServices>

<SpecialService>100<SpecialService>

<SpecialService>108<SpecialService>

</SpecialServices>

 

:When <SpecialService>= “125” and <Value> is less than or equal to $100, the insurance price returned will be zero (“$0.00”) to reflect baked-in insurance. If <Value> is greater than $100, the insurance price returned will reflect an extra cost since baked-in insurance was exceeded.

String

Enumerations=

·  100

·  101

·  102

·  103

·  104

·  105

·  106

·  108

·  109

·  110

·  112

·  118

·  119

·  120

·  125

·  155

·  156

·  160

·  170

·  171

·  172

·  173

·  174

·  175

·  176

·  177

·  178

·  179

·  180

·  181

·  182

·  447

HAZMAT Services:

·  810

·  811

·  812

·  813

·  814

·  815

·  816

·  817

·  818

·  819

·  820

·  821

·  822

·  823

·  824

·  825

·  826

·  827

·  828

·  829

·  830

·  831

·  832

 

RateV4Request / Package / Content

Optional

Available when RateV4Request[Revision='2'].

 

Groups the ContentType and ContentDescription elements.

团体

 

RateV4Request / Package / Content / ContentType

Optional

Available when RateV4Request [Revision=’2’].

 

Defines the type of content of the package.

 

String

Enumerations=

·  CREMATEDREMAINS

·  PERISHABLE

·  PHARMACEUTICALS

·  MEDICAL SUPPLIES

·  LIVES

RateV4Request / Package / Content / ContentDescription

Optional

Available when RateV4Request[Revision=’2’].

 

Describes the content of the package. Optional but required for ContentType ‘LIVES’.

String

Enumerations=

·  BEES

·  DAYOLDPOULTRY

·  ADULTBIRDS

·  OTHER

RateV4Request / Package / GroundOnly

Optional

Available when RateV4Request [Revision=’2’].

 

RateV4Request [Service=“GROUND ADVANTAGE’’]

 

Use “true” when shipment contains mailable hazardous materials, live animals and other “surface-only” items.

Boolean

Enumerations=

·  true

·  false

RateV4Request / Package / SortBy

Optional

Available when RateV4Request [Revision='2'].

 

Returns all mailing services available based on item shape. When specified, value in <Container> is ignored.

 

Available when:

RateV4Request[Service='ALL'] RateV4Request[Service='ONLINE']

 

例如:

<SortBy>PACKAGE</SortBy>

String

Enumerations=

·  LETTER

·  LARGEENVELOPE

·  PACKAGE

·  FLATRATE

RateV4Request / Package / Machinable

Optional

Machinable parcels are defined as parcels less than or equal to 15”x18”x22” inches and less than or equal 25 pounds. Any parcel that exceeds either threshold (dimensions or weight) will be considered nonmachinable.

 

说明:The API will validate provided dimensions and/or weight to determine machinability. In this case the <Machinable> tag will be ignored. If these are not provided, then the <Machinable> tag will be used to designate if shipment is Machinable (true) or Nonmachinable (false).


例如:

 <Machinable>正确</Machinable>

Boolean

whiteSpace=collapse

Enumerations=

·  true

·  false

RateV4Request / Package / ReturnLocations

Optional

Include Dropoff Locations in Response if available. Requires "ShipDate" tag.

Boolean

Enumerations=

·  true

·  false

RateV4Request / Package / ReturnServiceInfo

Optional

If a value of “true” is indicated in the request then the response will include the <ServiceInformation> tag containing mail service specific information

Boolean

Enumerations=

·  true

·  false

RateV4Request / Package / DropOffTime

Optional

Time Package Will Be Mailed. Enter drop off time in format: HH:mm, such as 13:45.

 

Inclusion of Drop Off Time will result increased accuracy of <CommitmentName> and <CommitmentDate> in the response for Priority Mail and Priority Mail Express variants.

 

例如:

<DropOffTime>13:45</DropOffTime>

String

·   

RateV4Request / Package / ShipDate

Optional

Date Package Will Be Mailed. Ship date may be today plus 0 to 30 days in advance. Enter the date in format: yyyy-mm-dd, such as 2013-07-28. If <ShipDate> value is not provided, the current date will be used for delivery date calculations.

 

Inclusion of Ship Date will result in <CommitmentName> and <CommitmentDate> in the response for Priority Mail and Priority Mail Express variants


例如:

<ShipDate>2013-07-28</ShipDate>

String

pattern=\d{2}-[a-zA-z]{3}-\d{4}

RateV4Request / Package / ShipDate Option

Optional

The value of this attribute specifies how the RateV4Response will structure the ShipDate Commitment data elements.

EMSH stands for Express Mail Sunday/Holiday and will return that response structure when used.

When HFP (Hold For Pickup) is used, an additional <CommitmentTime> element is returned and the Hold For Pickup response structure is used.

 

例如:

<ShipDate Option="HFP">2013-07-28</ ShipDate>

String

Default=EMSH

Enumerations=

·  EMSH

·  HFP

RateV4Request / Package / SortationLevel

Optional

 

分拣

描述

3D

3-Digit

5D

5-Digit

BAS

Basic

CR

邮递路线

MIX

Mixed NDC

大宗邮件分派中心 (NDC)

大宗邮件分派中心 (NDC)

PST

预分拣

SCF

SCG

TBE

EMM Tray Box

TBF

Full Tray Box

TBH

Half Tray Box

TBT

Full Tub Tray Box

 

Reference https://pe.usps.com/pricechange for additional details.

String

Enumerations=

·  3D

·  5D

·  BAS

·  CR

·  MIX

·  NDC

·  NONE

·  PST

·  SCF

·  TBE

·  TBF

·  TBT

·  TBH

 

RateV4Request / Package / DestinationEntryFacilityType

Conditionally Required

Drop Off location for destination entry products.

 

注意: Required when <Service>=“Parcel Select DE”.

 

Destination Type

价值

Destination Delivery Unit

DDU

Destination Network Distribution Unit

DNDC

Destination Sectional Center Facility

DSCF

Destination Hub

DHUB

String

Default = NONE

Enumerations=

·  DDU

·  DNDC

·  DCSF

·  DHUB

·  NONE

 

RateV4Request / Package / ReturnDimensionalWeight

Optional

This tag must be explicitly set to “true” for dimensional weight to be returned in the xml response.

Boolean

Enumerations=

·  true

·  false

RateV4Request / Package /TrackingRetentionPeriod

Optional

Used to determine period of Retention for tracking data.

ServiceID

<TrackingRetentionPeriod>

181

“0.5” (6 Months)

181

“1” (1 Year)

181

“3” (3 Years)

181

“5” (5 Years)

181

“7” (7 Years)

181

“10” (10 Years)

182

“3” (3 Years)

182

“5” (5 Years)

182

“7” (7 Years)

182

“10” (10 Years)

String

minOccurs=0

maxOccurs=1

Enumerations=

·  0.5

·  1

·  3

·  5

·  7

·  10

RateV4Request / Package / ReturnFees

Optional

This tag must be set to “true” for <Fees> to be returned. This tag is used so customers can see what fees apply to their postage.

Boolean

Default=false

Enumerations=

·  true

·  false

 

RateV4Request / Package / ReturnHSCodeReqd

Optional

Include <ReturnHSCodeReqd>=“Y” (Yes) to return <HSCodeReqd> indicator in response to identify which APO/FPO/DPO destinations will require valid Harmonization Code and Content/Item descriptions due to international shipping regulatory mandates.

 

Per international shipping regulatory mandates, shipments to European Union (EU) countries are required to contain a valid Harmonization Code and Content/Item description. Harmonization Code (i.e., HS Tariff Number) must be based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization. To learn more about providing acceptable item descriptions, view the chart below or read the EU’s guidance on acceptable terms at Guidance on Acceptable and Unacceptable Terms for the Description of Goods.

 

Default=N

Enumerations=

·  Y

·  N

 

RateV4Request

需要

 

(alias)

 

2.2.1     Sample Request

Request: RateV4

<RateV4Request USERID="XXXXXXXXX" PASSWORD="">

    <Revision>2</Revision>

    <Package ID="0">

        <Service>优先</Service>

        <ZipOrigination>22201</ZipOrigination>

        <ZipDestination>26301</ZipDestination>

        <Pounds>8</Pounds>

        <Ounces>2</Ounces>

        <Container></Container>

        <Width></Width>

        <Length></Length>

        <Height></Height>

        <Girth></Girth>

    </Package>

</RateV4Request>

 

Request: RateV4 Military – APO Example:

<RateV4Request USERID="XXXXXXXXX" PASSWORD="">

    <Revision>2</Revision>

    <Package ID="1">

        <Service>Priority Mail</Service>

        <ZipOrigination>18702</ZipOrigination>

        <ZipDestination>09067</ZipDestination>

        <Pounds>2</Pounds>

        <Ounces>0</Ounces>

        <Container></Container>

        <ReturnHSCodeReqd>Y</ReturnHSCodeReqd>

    </Package>

</RateV4Request>

 

Request: RateV4 Parcel Select DE Example:

<RateV4Request USERID="XXXXXXXXX" PASSWORD="">

    <Revision>2</Revision>

    <Package ID="1ST">

        <Service>PARCEL SELECT DE</Service>

        <ZipOrigination>73108</ZipOrigination>

        <ZipDestination>75232</ZipDestination>

        <Pounds>10</Pounds>

        <Ounces>0</Ounces>

        <Container>VARIABLE</Container>

        <SpecialServices>

            <SpecialService/>

        </SpecialServices>

        <SortationLevel>None</SortationLevel>

        <DestinationEntryFacilityType>DNDC</DestinationEntryFacilityType>

    </Package>

</RateV4Request>

 

Request: RateV4 Connect Local Example:

<RateV4Request USERID="XXXXXXXXX" PASSWORD="">

    <Revision>2</Revision>

    <Package ID="1">

        <Service>CONNECT LOCAL</Service>

        <ZipOrigination>18708</ZipOrigination>

        <ZipDestination>89701</ZipDestination>

        <Pounds>0</Pounds>

        <Ounces>12</Ounces>

        <Container>统一邮资包装盒</Container>

        <AmountToCollect/>

        <SpecialServices>

            <SpecialService></SpecialService>

        </SpecialServices>

        <SortationLevel></SortationLevel>

        <DestinationEntryFacilityType>DDU</DestinationEntryFacilityType>

    </Package>

</RateV4Request>

 

Request: RateV4 – Non Standard Fee Example

<RateV4Request USERID="XXXXXXXXX" PASSWORD="">

    <Revision>2</Revision>

    <Package ID="1">

        <Service>所有</Service>

        <FirstClassMailType />

        <ZipOrigination>18702</ZipOrigination>

        <ZipDestination>16901</ZipDestination>

        <Pounds>1</Pounds>

        <Ounces>2</Ounces>

        <Container>Variable</Container>

        <Width>20</Width>

        <Length>31</Length>

        <Height>20</Height>

        <Girth></Girth>

        <Machinable>错误</Machinable>

        <ReturnLocations>False</ReturnLocations>

        <ReturnServiceInfo>False</ReturnServiceInfo>

        <ShipDate>01/01/2023</ShipDate>

        <ReturnFees>true</ReturnFees>

    </Package>

</RateV4Request>

 

Request: RateV4 – <Service DelOpt> Example

<RateV4Request USERID="XXXXXXXXXX">

  <Revision>2</Revision>

  <Package ID="1">

    <Service DelOpt="ParcelLocker">all</Service>

    <ZipOrigination>20770</ZipOrigination>

    <ZipDestination>54324</ZipDestination>

    <Pounds>0</Pounds>

    <Ounces>1</Ounces>

    <Container></Container>

    <Size>Regular</Size>

    <SortBy>package</SortBy>

    <Machinable>正确</Machinable>

    <ShipDate>04/22/2023</ShipDate>

  </Package>

</RateV4Request>

2.3     Response Descriptions

Tag Name

Occurs

描述

类型

Validation

RateV4Response

需要

 

(Group)

 

RateV4Response / Package

Required repeating up to 25 times

 

(Group)

 

RateV4Response / Package / ZipOrigination

需要

Origination ZIP Code from request

String

whiteSpace=collapse
length=5
pattern=\d{5}  

RateV4Response / Package / ZipDestination

需要

Destination ZIP Code from request

String

whiteSpace=collapse
length=5
pattern=\d{5}  

RateV4Response / Package / Pounds

需要

Package Weight (Pounds) from request

Integer

maxInclusive=70
minInclusive=0  

RateV4Response / Package / Ounces

需要

Package Weight (Ounces) from request

Decimal

maxInclusive=1120.0
minInclusive=0.0
totalDigits=10  

RateV4Response / Package / FirstClassMailType

Optional

Appears when RateV4Request [Service='FIRST CLASS'].

 

例如: <FirstClassMailType>LETTER</FirstClassMailType

String

whiteSpace=collapse

RateV4Response / Package / Container

Optional

Shipping Container (appears where applicable: RateV4Request[Service='ALL' or Service='PRIORITY EXPRESS*' or Service='PRIORITY*'])  

String

whiteSpace=collapse

RateV4Response / Package / Machinable

Optional

Machinable (appears where applicable: RateV4Request[Service='ALL'])

String

 

RateV4Response / Package / Zone

Optional

USPS defined distance codes assigned to each origin and destination ZIP Code pairing for every ZIP Code number in the nation. These distance codes, referred to as zones, are designated as “1 through 9"

String

 

RateV4Response / Package / Postage

Required repeating up to unbounded times

Postage tag contains a nested postal rate and service description.  

(Group)

 

RateV4Response / Package / Postage / CLASSID

需要

A mail class identifier for the postage returned. Not necessarily unique within a <Package/>. Refer to Appendix A for all domestic CLASSID values.

Integer

 

RateV4Response / Package / Postage / MailService

需要

Service Type name  

String

 

RateV4Response / Package / Postage / Rate

需要

Retail Rate Published Retail Rates are available at our Postal Explorer Price List.

Decimal

 

RateV4Response / Package / Postage / CommercialRate

Optional

Commercial Rate. Published Commercial and Commercial Base Rates are available at our Postal Explorer Price List.

 

Appears only where applicable for published Commercial and Commercial Base products and when requested via RateV4Request[e.g., Service='ONLINE' or

Service='PRIORITY COMMERCIAL' or

Service='CONNECT LOCAL'].

Decimal

 

RateV4Response / Package / Postage / CommercialPlusRate

Optional

Commercial Rate. Appears only where applicable for published Commercial Plus products and when requested via RateV4Request[e.g., Service='PLUS'].

Decimal

 

RateV4Response / Package / Postage / MaxDimensions

Optional

Maximum dimensions for a USPS produced product. Appears where applicable: RateV4Request[SortBy=PACKAGE]

String

 

RateV4Response / Package / Postage / ServiceInformation

Optional

Mail Service Information. Appears where applicable: RateV4Request[ReturnServiceInfo=’true’]

String

 

RateV4Response / Package / Postage / Zone

Optional

Zone code for the specific service. Appears when the service zone is different from the standard zone assigned to the origin and destination ZIP code.

String

 

RateV4Response / Package / Postage / (Choice)

Optional

This choice depends on the RateV4Request / ShipDate / Option attribute. If the attribute is missing or has the enumeration value of EMSH then the original Express Mail Sunday/Holiday structure is used. Otherwise, if the attribute has the enumeration value of HFP, then the Hold For Pickup structure is used. If RateV4Request / ShipDate is not present, then neither choice is returned.

(Choice)

 

RateV4Response / Package / Postage / (Choice) / (sequence)

if used:
需要

This sequence consisting of CommitmentDate and Location nodes is mutually exclusive with RateV4Response / Package / Postage / Commitment.

(Group)

 

RateV4Response / Package / Postage / (Choice) / (sequence) / CommitmentDate

Required once

Expected Delivery Date: yyyy-mm-dd. Can only returned when ShipDate tag is present in the request.

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / CommitmentName

Optional

Expected Delivery returned in number of days. Ex. <CommitmentName>3-Day</CommitmentName>

Inclusion of ShipDate with Priority Mail and Priority Mail Express variants will return both <CommitmentName> and <CommitmentDate> in the response.

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location

Optional repeating up to 200 times

Collection of Dropoff Locations with Cutoff times. Only returned with Express Mail variants, when "ShipDate" tag is present in the request, and the "ReturnLocations" tag is not false.

 

例如:

<Location>
<CutOff>8:00 PM</CutOff>
<Facility>EXPRESS MAIL COLLECTION BOX</Facility>
<Street>9201 EDGEWORTH DR</Street>
<City>CAPITOL HEIGHTS</City>
<State>MD</State>
<Zip>20790</Zip>
</Location> 

(Group)

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location / CutOff

需要

Local cutoff time for drop-off  

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location / Facility

需要

Facility Name  

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location / Street

需要

Facility Address  

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location / City

需要

Facility City  

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location / State

需要

Facility State  

String

 

RateV4Response / Package / Postage / (Choice) / (sequence) / Location / Zip

需要

Facility Zip  

String

 

RateV4Response / Package / Postage / (Choice) / Commitment

if used:
Required once repeating up to 5 times

This node is mutually exclusive with RateV4Response / Package / Postage / CommitmentDate and RateV4Response / Package / Postage / Location.

 

Inclusion of ShipDate with Option="HFP" will return <CommitmentTime>, <CommitmentName>, and <CommitmentDate> in the response in this Hold for Pickup structure.

(Group)

 

RateV4Response / Package / Postage / (Choice) / Commitment / CommitmentDate

Required once

Expected Delivery Date: yyyy-mm-dd. Can only returned when ShipDate tag is present in the request.

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / CommitmentName

Optional

Expected Delivery returned in number of days. Ex. <CommitmentName>3-Day</CommitmentName>

Inclusion of ShipDate with Priority Mail and Priority Mail Express variants will return both <CommitmentName> and <CommitmentDate> in the response.

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / CommitmentTime

Required once

Expected Pickup Time on day of delivery. Ex. <CommitmentTime>6:00 PM</CommitmentTime>. Must include <ShipDate> Option="HFP" (i.e., <ShipDate Option="HFP">MM/DD/YYYY</ ShipDate> in the request to return <CommitmentTime>.

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location

Optional repeating up to 200 times

Collection of Dropoff Locations with Cutoff times. Only returned with Priority Mail Express Mail variants, when "ShipDate" tag is present in the request, and the "ReturnLocations" tag is not false.

 

例如:

<Location>
<CutOff>8:00 PM</CutOff>
<Facility>EXPRESS MAIL COLLECTION BOX</Facility>
<Street>9201 EDGEWORTH DR</Street>
<City>CAPITOL HEIGHTS</City>
<State>MD</State>
<Zip>20790</Zip>
</Location> 

(Group)

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location / CutOff

需要

Local cutoff time for drop-off  

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location / Facility

需要

Facility Name  

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location / Street

需要

Facility Address  

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location / City

需要

Facility City  

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location / State

需要

Facility State  

String

 

RateV4Response / Package / Postage / (Choice) / Commitment / Location / Zip

需要

Facility Zip  

String

 

RateV4Response / Package / Postage / SpecialServices

Optional

Returned when RateV4Request[Revision='2'].

 

Groups the Special Service elements.

(Group)

 

RateV4Response / Package / Postage / SpecialServices / SpecialService

Required, repeating up to unbounded times

Returned when RateV4Request[Revision='2'].

 

SpecialService” contains nested service name, availability, and pricing.

(Group)

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / ServiceID

需要

Returned when RateV4Request[Revision='2'].

 

Special service ID

Integer

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / ServiceName

需要

Returned when RateV4Request[Revision='2'].

 

Special service name

String

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / Available

需要

Returned when RateV4Request[Revision='2'].

 

Availability of special service. Availability may change depending on special services passed (selected) in request.

Boolean

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / AvailableOnline

需要

Returned when RateV4Request[Revision='2'].

 

Availability of special service for online only rates. Not all special services have online rates.

Boolean

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / AvailableCPP

需要

Returned when RateV4Request[Revision='2'].

 

Availability of special service for Commercial Plus Price only. Not all special services have Commercial Plus Prices.

Boolean

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / Price

需要

Returned when RateV4Request[Revision='2'].

 

Special service pricing. Pricing may change depending on special services passed (selected) in request.

Decimal

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / PriceOnline

需要

Returned when RateV4Request[Revision='2'].

 

Special service pricing. Pricing may change depending on special services passed (selected) in request. Not all special services have online rates.

Decimal

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / PriceCPP

需要

Returned when RateV4Request[Revision='2'].

 

Special service Commercial Plus Pricing. Commercial Plus Pricing may change depending on special services passed (selected) in request. Not all special services have Commercial Plus Pricing.

Decimal

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / DeclaredValueRequired

Optional

Returned if applicable when RateV4Request[Revision='2'].

 

Indicates if special service requires a declared package value (specified in RateV4Request[Value])to determine correct pricing.

Boolean

 

RateV4Response / Package / Postage / SpecialServices / SpecialService / DueSenderRequired

Optional

Returned if applicable when RateV4Request[Revision='2'].

 

Indicates if special service requires a due sender amount (specified in RateV4Request[AmountToCollect]) to determine correct pricing.

Boolean

 

RateV4Response / Package / Postage / DimensionalWeightRate

Optional

Dimensional weight retail rate

String

 

RateV4Response / Package / Postage / DimensionalWeightCommercialRate

Optional

Dimensional weight commercial base rate

String

 

RateV4Response / Package / Postage / DimensionalWeightCommercialPlusRate

Optional

Dimensional weight commercial plus rate

String

 

RateV4Response / Package / Postage / Fees

Optional

Returns when <ReturnFees> = “true”

 

Dimensional weight pricing will include length and volume fees to account for cost of processing oversized parcels

String

 

RateV4Response / Package / Postage / Fees / Fee

需要

 

String

 

RateV4Response / Package / Postage / Fees / Fee / FeeType

需要

Indicates what type of Fee is being requested:

-        Non Standard Length Fee

-        Non Standard Volume Fee

String

 

RateV4Response / Package / Postage / Fees / Fee / FeeType / FeePrice

需要

Non Standard Length Fee(s)

a. 15" < x < 22" = $0 (for all packages)

b. 22" < x < 30" = $2 (for DDU entered packages)

c. 22" < x < 30" = $3 (for DNDC/DSCF entered packages)

d. 22" < x < 30" = $4 (for all other packages)

e. x > 30" = $7.50 (for DDU entered packages)

f. x > 30" = $11.25 (for DNDC/DSCF entered packages)

g. x > 30" = $15 (for all other packages)

 

Non Standard Volume Fee(s)

a. x > 2 cubic feet (3546 cubic inches) = $15 (for all packages)

 

Live Animal Transportation Fee(s)

a. $0.20 (for all packages)

 

Nonmachinable Fee(s)

a. $0.25 (for all packages)

 

String

 

RateV4Response / Package / Postage / Fees / Fee / FeeType / FeePrice / FeeInformation

需要

Fee Information indicates the fee is <Rate>

String

 

RateV4Response / Package / Postage / Fees / Fee / FeeType / FeePrice / FeeInformation / FeeInfo FeeInfoType =”PriceType

需要

Fee Information indicates the fee is <Rate>

String

 

RateV4Response / Package / HSCodeReqd

Optional

Returns when <ReturnHSCodeReqd>=“Y” (Yes).

 

When <HSCodeReqd>True</HSCodeReqd>

Indicates which APO/FPO/DPO destinations will require valid Harmonization Code and Content/Item descriptions because of new international shipping regulatory mandates.

 

Per international shipping regulatory mandates, shipments to European Union (EU) countries are required to contain a valid Harmonization Code and Content/Item description. Harmonization Code (i.e., HS Tariff Number) must be based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization. To learn more about providing acceptable item descriptions, view the chart below or read the EU’s guidance on acceptable terms at Guidance on Acceptable and Unacceptable Terms for the Description of Goods.

String

Enumerations=

·  True

·  False

RateV4Response / Package / Restriction / Restrictions

需要

APO/FPO Restrictions provided if the Destination ZIP Code is an APO/FPO ZIP Code.  

String

 

RateV4Response / Attributes

需要

When <ReturnFees> = True, the new Attributes tag will return to show Oversize fees and/or Dimensional Weight fees.

Any future package attributes that impact a price returned will be included in the attributes tag.

String

 

RateV4Response / Attributes / Attribute Key

需要

Attribute Key:

  • DimensionalWeightR = RetailRate
  • DimensionalWeightCB = Commercial Rate
  • DimensionalWeightCP = Commerical Plus Rate
  • 超过尺寸

 

String

 

RateV4Response / Package / Error

if used:
需要

Error document (indicates request could not be completed).  

 

See the Error Responses section below.

RateV4Response

需要

 

(alias)

 

2.3.1     Sample Response

《response: RateV4:

<RateV4Response>

    <Package ID="0">

        <ZipOrigination>22201</ZipOrigination>

        <ZipDestination>26301</ZipDestination>

        <Pounds>8</Pounds>

        <Ounces>2</Ounces>

        <Container>VARIABLE</Container>

        <Zone>3</Zone>

        <Postage CLASSID="1">

            <MailService>Priority Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;</MailService>

            <Rate>15.05</Rate>

            <SpecialServices>

                <SpecialService>

                    <ServiceID>119</ServiceID>

                    <ServiceName>Adult Signature Required</ServiceName>

                    <Available>正确</Available>

                    <Price>9.05</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>120</ServiceID>

                    <ServiceName>Adult Signature Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>9.35</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>104</ServiceID>

                    <ServiceName>Certificate of Mailing (Form 3817)</ServiceName>

                    <Available>正确</Available>

                    <Price>1.85</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>105</ServiceID>

                    <ServiceName>Certified Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>4.15</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>170</ServiceID>

                    <ServiceName>Certified Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>10.80</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>171</ServiceID>

                    <ServiceName>Certified Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Adult Signature Required</ServiceName>

                    <Available>正确</Available>

                    <Price>10.80</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>172</ServiceID>

                    <ServiceName>Certified Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Adult Signature Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>10.80</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>103</ServiceID>

                    <ServiceName>Collect on Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>9.60</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>175</ServiceID>

                    <ServiceName>Collect on Delivery Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>16.15</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>125</ServiceID>

                    <ServiceName>Insurance</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>179</ServiceID>

                    <ServiceName>Insurance Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>109</ServiceID>

                    <ServiceName>Registered Mail&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>15.25</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>176</ServiceID>

                    <ServiceName>Registered Mail&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>21.80</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>181</ServiceID>

                    <ServiceName>Scan Retention</ServiceName>

                    <Available>正确</Available>

                    <Price>0.99</Price>

                    <DeclaredValueRequired>false</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>183</ServiceID>

                    <ServiceName>USPS Label Delivery Service</ServiceName>

                    <Available>正确</Available>

                    <Price>1.25</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>108</ServiceID>

                    <ServiceName>Signature Confirmation&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>3.80</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>173</ServiceID>

                    <ServiceName>Signature Confirmation&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>10.35</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>156</ServiceID>

                    <ServiceName>Signature Confirmation&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Electronic</ServiceName>

                    <Available>正确</Available>

                    <Price>3.25</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>174</ServiceID>

                    <ServiceName>Signature Confirmation&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Electronic Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>9.80</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>106</ServiceID>

                    <ServiceName>USPS Tracking&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>155</ServiceID>

                    <ServiceName>USPS Tracking&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Electronic</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                </SpecialService>

            </SpecialServices>

        </Postage>

    </Package>

</RateV4Response>

 

《response: RateV4 Military APO Example:

<RateV4Response>

    <Package ID="1">

        <ZipOrigination>18702</ZipOrigination>

        <ZipDestination>09067</ZipDestination>

        <Pounds>2</Pounds>

        <Ounces>0</Ounces>

        <Container>VARIABLE</Container>

        <Zone>5</Zone>

        <Postage CLASSID="1">

            <MailService>Priority Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;</MailService>

            <Rate>12.75</Rate>

            <SpecialServices>

                <SpecialService>

                    <ServiceID>104</ServiceID>

                    <ServiceName>Certificate of Mailing (Form 3817)</ServiceName>

                    <Available>正确</Available>

                    <Price>1.75</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>105</ServiceID>

                    <ServiceName>Certified Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>4.00</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>170</ServiceID>

                    <ServiceName>Certified Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>10.35</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>125</ServiceID>

                    <ServiceName>Insurance</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>179</ServiceID>

                    <ServiceName>Insurance Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>109</ServiceID>

                    <ServiceName>Registered Mail&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>14.65</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>176</ServiceID>

                    <ServiceName>Registered Mail&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Restricted Delivery</ServiceName>

                    <Available>正确</Available>

                    <Price>20.90</Price>

                    <DeclaredValueRequired>true</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>181</ServiceID>

                    <ServiceName>Scan Retention</ServiceName>

                    <Available>正确</Available>

                    <Price>0.99</Price>

                    <DeclaredValueRequired>false</DeclaredValueRequired>

                    <DueSenderRequired>false</DueSenderRequired>

                </SpecialService>

                <SpecialService>

                    <ServiceID>106</ServiceID>

                    <ServiceName>USPS Tracking&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                </SpecialService>

                <SpecialService>

                    <ServiceID>155</ServiceID>

                    <ServiceName>USPS Tracking&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Electronic</ServiceName>

                    <Available>正确</Available>

                    <Price>0.00</Price>

                </SpecialService>

            </SpecialServices>

            <HSCodeReqd>True</HSCodeReqd>

        </Postage>

        <Restriction>

            <Restrictions>B. Other than for PMEMS and the exceptions listed below, a customs declaration PS Form 2976 or PS Form 2976-A is required for all items weighing 16 ounces or more, and for all items (regardless of weight) containing potentially dutiable mail contents (e.g., merchandise or goods) addressed to or from this ZIP Code. Other than the exceptions listed below, all PMEMS mailpieces (regardless of mail contents or weight) addressed to or from this ZIP Code must bear a properly completed PS Form 2976-B. The surface area of the address side of the mailpiece must be large enough to contain the applicable customs declaration. The following exceptions apply to known mailers, who for this purpose are defined as follows:B. Business mailers who enter volume mailings through business mail entry units or other bulk mail acceptance locations, pay postage through advance deposit accounts, use permit imprints for postage payment, and submit completed postage statements at the time of entry that certify that the mailpieces contain no dangerous materials that are prohibited by postal regulations. Such business mailers are exempt from providing customs documentation on non-dutiable letters and printed matter.B. All federal, state, and local government agencies whose mailings are regarded as "Official Mail." Such agencies are exempt from providing customs documentation, except for any items addressed to an MPO or DPO to which restriction "B2" applies. C. Cigarettes and other tobacco products, including tobacco leaves, chewing and pipe tobacco, snuff, and cigars are prohibited, including those that are authorized in Publication 52 under PACT. C2. E-cigarettes and related products (e.g., nicotine liquids, e-liquids, parts, or supplies) are prohibited. D. Coffee is prohibited. E. Medicines (prescription, over-the-counter, vitamins, and supplements) are prohibited when mailed to individuals for human or animal use. This prohibition does not apply when medicines are sent as Official Mail only between specifically designated agencies such as pharmaceutical distributors, hospitals, clinics, and pharmacies. U. Mail addressed to Retirees (Box R) is limited to 16 ounces and up to a 90-day supply of TRICARE medications. This restriction does not apply to mail endorsed "Free Matter for the Blind or Handicapped." F3. Replica weapons and inert explosive devices (such as grenades) and weapons parts are prohibited. H. Meats, including preserved meats, bones, skin, hair, feathers, horns or hoofs of hoofed animals, and wool samples whether hermetically sealed or not, are prohibited. M. Fruits, vegetables, live animals, and live plants are prohibited. R. All alcoholic beverages, including those mailable under Publication 52, Part 421, are prohibited. S. Synthetic cannabinoids used to stimulate the central nervous system commonly known as "synthetic marijuana," "K2," or "Spice" are prohibited. F. Firearms of any type are prohibited, except firearms mailed to or by official U.S. government agencies. This restriction does not apply to firearms mailed from this MPO ZIP Code, provided ATF and USPS regulations are met. Antique firearms do not require an ATF form. </Restrictions>

        </Restriction>

    </Package>

</RateV4Response>

 

Response: RateV4 – Non Standard Fee Example

<RateV4Response>

    <Package ID="1">

        <ZipOrigination>18702</ZipOrigination>

        <ZipDestination>16901</ZipDestination>

        <Pounds>1</Pounds>

        <Ounces>2</Ounces>

        <Machinable>错误</Machinable>

        <Zone>2</Zone>

        <Postage CLASSID="4058">

            <MailService>USPS Ground Advantage&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; HAZMAT</MailService>

            <Rate>113.55</Rate>

            <Fees>

                <Fee>

                    <FeeType>Nonstandard Length fee > 30 in.</FeeType>

                    <FeePrice>7.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

                <Fee>

                    <FeeType>Nonstandard Volume fee > 2 cu. ft.</FeeType>

                    <FeePrice>15.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

            </Fees>

            <Attributes>

                <Attribute Key="Oversized">正确</Attribute>

            </Attributes>

        </Postage>

        <Postage CLASSID="1058">

            <MailService>USPS Ground Advantage&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService>

            <Rate>113.55</Rate>

            <Fees>

                <Fee>

                    <FeeType>Nonstandard Length fee > 30 in.</FeeType>

                    <FeePrice>7.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

                <Fee>

                    <FeeType>Nonstandard Volume fee > 2 cu. ft.</FeeType>

                    <FeePrice>15.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

            </Fees>

            <Attributes>

                <Attribute Key="Oversized">正确</Attribute>

            </Attributes>

        </Postage>

        <Postage CLASSID="2058">

            <MailService>USPS Ground Advantage&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Hold For Pickup</MailService>

            <Rate>113.55</Rate>

            <Fees>

                <Fee>

                    <FeeType>Nonstandard Length fee > 30 in.</FeeType>

                    <FeePrice>7.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

                <Fee>

                    <FeeType>Nonstandard Volume fee > 2 cu. ft.</FeeType>

                    <FeePrice>15.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

            </Fees>

            <Attributes>

                <Attribute Key="Oversized">正确</Attribute>

            </Attributes>

        </Postage>

        <Postage CLASSID="6058">

            <MailService>USPS Ground Advantage&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Parcel Locker</MailService>

            <Rate>113.55</Rate>

            <Fees>

                <Fee>

                    <FeeType>Nonstandard Length fee > 30 in.</FeeType>

                    <FeePrice>7.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

                <Fee>

                    <FeeType>Nonstandard Volume fee > 2 cu. ft.</FeeType>

                    <FeePrice>15.00</FeePrice>

                    <FeeInformation>

                        <FeeInfo FeeInfoType="PriceType">Rate</FeeInfo>

                    </FeeInformation>

                </Fee>

            </Fees>

            <Attributes>

                <Attribute Key="Oversized">正确</Attribute>

            </Attributes>

        </Postage>

    </Package>

</RateV4Response>

 

RateV4 Response - <Service DelOpt = Parcel Locker> Example

<RateV4Response>

    <Package ID="1">

        <ZipOrigination>20770</ZipOrigination>

        <ZipDestination>54324</ZipDestination>

        <Pounds>0</Pounds>

        <Ounces>1</Ounces>

        <Machinable>正确</Machinable>

        <Zone>5</Zone>

        <Postage CLASSID="6058">

            <MailService>USPS Ground Advantage&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Parcel Locker</MailService>

            <Rate>5.05</Rate>

        </Postage>

        <Postage CLASSID="6001">

            <MailService>Priority Mail Express 2-Day&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Parcel Locker</MailService>

            <Rate>35.50</Rate>

            <CommitmentDate>2023-08-04</CommitmentDate>

            <CommitmentName>2-Day</CommitmentName>

        </Postage>

        <Postage CLASSID="6010">

            <MailService>Priority Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Parcel Locker</MailService>

            <Rate>10.65</Rate>

            <CommitmentDate>2023-08-05</CommitmentDate>

            <CommitmentName>2-Day</CommitmentName>

        </Postage>

        <Postage CLASSID="6096">

            <MailService>USPS Ground Advantage&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Cubic Parcel Locker</MailService>

            <Rate>0.00</Rate>

            <CommercialRate>6.88</CommercialRate>

        </Postage>

        <Postage CLASSID="6012">

            <MailService>Priority Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Large Flat Rate Box Parcel Locker</MailService>

            <Rate>22.80</Rate>

            <MaxDimensions>USPS-Produced Box: 12-1/4"(L) X 12"(W) X 6"(H)</MaxDimensions>

            <CommitmentDate>2023-08-05</CommitmentDate>

            <CommitmentName>2-Day</CommitmentName>

        </Postage>

        <Postage CLASSID="6013">

            <MailService>Priority Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Medium Flat Rate Box Parcel Locker</MailService>

            <Rate>17.10</Rate>

            <MaxDimensions>USPS-Produced Box: 13-5/8" x 11-7/8" x 3-3/8" or 11" x 8-1/2" x 5-1/2"</MaxDimensions>

            <CommitmentDate>2023-08-05</CommitmentDate>

            <CommitmentName>2-Day</CommitmentName>

        </Postage>

        <Postage CLASSID="6014">

            <MailService>Priority Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Small Flat Rate Box Parcel Locker</MailService>

            <Rate>10.20</Rate>

            <MaxDimensions>USPS-Produced Box: 8-5/8" x 5-3/8" x 1-5/8"</MaxDimensions>

            <CommitmentDate>2023-08-05</CommitmentDate>

            <CommitmentName>2-Day</CommitmentName>

        </Postage>

        <Postage CLASSID="6076">

            <MailService>Media Mail Parcel Parcel Locker</MailService>

            <Rate>3.92</Rate>

        </Postage>

        <Postage CLASSID="6075">

            <MailService>Library Mail Parcel Parcel Locker</MailService>

            <Rate>3.72</Rate>

        </Postage>

    </Package>

</RateV4Response>

2.4     Error Responses

Error conditions are handled at the main XML document level and Package node level.  When parsing, it is best to check for an error document first before checking for good data.  Error documents have the following format:

 

 

<Error>

<Number></Number>

<Source></Source>

<Description></Description>

<HelpFile></HelpFile>

<HelpContext></HelpContext>

</Error>

Where:

·        Number = the error number generated by the Web Tools server.

·        Source = the component and interface that generated the error on the Web Tools server.

·        Description = the error description.

·        HelpFile = [reserved for future use].

·        HelpContext = [reserved for future use].

Errors that are further down in the hierarchy also follow the above format. An <Error> element may be returned at the top (response) level if there is a problem with the syntax of the request, or if a system error occurs.  But if there is a problem with a specific Package within the request, an <Error> element will be returned within the <Package> element that pertains to the specific package ID.  Since the RateV4 API allows you to submit multiple packages within a single request document, the response may contain a mix of domestic rate information and

 

errors. For requests containing multiple package IDs, you need to check if there is an <Error> within a given <Package> element, as well as checking for an error at the top level for example:

 

<RateV4Response>

<Package ID="0">

<ZipOrigination>07747</ZipOrigination>

<ZipDestination>90210</ZipDestination>

<Pounds>11</Pounds>

<Ounces>4</Ounces>

<Container></Container>

<Zone>8</Zone>

<Postage CLASSID="3">

<MailService>Priority Mail Express&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService>

<Rate>92.85</Rate>

</Postage>

</Package>

<Package ID="1">

<Error>

<Number>-2147219498</Number>

<Source>DomesticRatesV4;RateEngineV4.ProcessRequest</Source>

<Description>Please enter a valid ZIP Code for the sender.  </Description>

<HelpFile></HelpFile>

<HelpContext>1000440</HelpContext>

</Error>

</Package>

</RateV4Response>

 

3.0   International Rates API – IntlRateV2

3.1     Overview

The IntlRateV2 API lets customers calculate the rate for international packages and envelopes given the weight and dimensions of the item. The IntlRateV2 API limits the data requested to twenty-five (25) packages per transaction. For specifications such as package dimensions, delivery information, etc, please refer to the International Mail Manual (IMM) at http://pe.usps.com/.

3.1.1     API Signature

Scheme

Host

小道

API

XML

https://

secure.shippingapis.com

/ShippingAPI.dll?

API=IntlRateV2

&XML=(see below)

3.2     Request Descriptions

Tag Name

Occurs

描述

类型

Validation

IntlRateV2Request

需要

API=IntlRateV2

This API returns the current international USPS postage corresponding to the parameters given.

(Group)

 

IntlRateV2Request / USERID

需要

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

例如:USERID="XXXXXXX"

NMTOKEN

 

IntlRateV2Request / PASSWORD

Optional

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

例如:PASSWORD="XXXXXXX"

NMTOKEN

 

IntlRateV2Request / Revision

Optional

Set this value to “2” to return all currently documented response fields.

例如:

<Revision>2</Revsion>

String

 

IntlRateV2Request / Package

Required repeating up to 25 times

Opening Package tag.  

(Group)

 

IntlRateV2Request / Package / ID

需要

No restriction on number or type of characters provided valid XML syntax and unique to request. 
例如:

<Package ID="0">...</Package>

NMTOKEN

 

IntlRateV2Request / Package / Pounds

需要

Value must be numeric. Package weight generally cannot exceed 70 pounds.  Maximum Decimal places are 8. Refer to the International Mail Manual (IMM) for weight requirements per country and mail service. The IMM can be found at the Postal Explorer web site. 
例如:

<Pounds>2</Pounds>

<Pounds>2.12345678</Pounds>

Integer

minInclusive=0  

IntlRateV2Request / Package / Ounces

需要

Value must be numeric. Package weight generally cannot exceed 70 pounds.  Maximum Decimal places are 8. Refer to the International Mail Manual (IMM) for weight requirements per country and mail service. The IMM can be found at the Postal Explorer web site

例如:

<Ounces>4</Ounces>

<Ounces>4.12345678</Ounces>

Decimal

minInclusive=0.0  

IntlRateV2Request / Package / Machinable

Optional

Indicates whether or not the item is machinable. A surcharge is applied to a First-Class Mail International item if it has one or more non-machinable characteristics. See International Mail Manual (IMM) Section 241.217 for more information. 

例如: <Machinable>正确</Machinable>

Boolean

default=true
 

IntlRateV2Request / Package / MailType

需要

Package type being shipped.

 

例如: <MailType>Package</MailType>

注意: Airmail M-Bag prices will return for retail pricing when available including when <MailType>=“ALL.”Reference https://pe.usps.com/text/imm/immc2_026.htm for M-Bag pricing details.

注意: When <MailType>= “ALL” is indicated in XML request and a <TrackingRetentionPeriod> value is not specified, the lowest tracking retention period values (i.e., “0.5” (6 months) for ServiceID=“181” and “3” (3 years) for ServiceID=“182”) will be used to return available USPS Tracking Plus extra service options for supported mail services.

String

Default = NONE

Enumerations=

·  ALL

·  PACKAGE

·  POSTCARDS

·  ENVELOPE

·  LETTER

·  LARGEENVELOPE

·  FLATRATE

·  AIRMAIL MBAG

IntlRateV2Request / Package / GXG

Optional

If GXG rate is desired, then this group must be specified. Note that if this data precludes delivery, due to size or availability of service at the destination, then GXG rates simply will not be returned (not an error condition.)  

(Group)

 

IntlRateV2Request / Package / GXG / POBoxFlag

需要

Specify as "Y" if the destination is a post office box.  

例如:

<POBoxFlag>Y</POBoxFlag>

String

Enumerations=

·        Y

·        N

IntlRateV2Request / Package / GXG / GiftFlag

需要

Specify as "Y" if the package contains a gift.  

例如:

<GiftFlag>Y</GiftFlag>

String

Enumerations=

·        Y

·        N

IntlRateV2Request / Package / ValueOfContents

需要

If specified, used to compute Insurance fee (if insurance is available for service and destination).

例如: <ValueOfContents>103.00</ValueOfContents

String

 

IntlRateV2Request / Package / Country

需要

Entries must be from the USPS list of valid countries from the International Country Listings. To access the International Country Listings, go to the Index of Countries and Localities.

例如:

<Country>Albania</Country>  

String

 

IntlRateV2Request / Package / Container

Optional

Used to specify a container. When package is a roll, integrators should pass <Container>= “ROLL” in XML request. If package is not a roll, integrators should not populate – label response will assume package is not a roll.

 

注意:When <Container>= “ROLL”, errors will return if dimensions provided in XML request do not meet IMM 251.22 requirements. https://pe.usps.com/text/imm/immc2_021.htm.

String

Enumerations=

·        VARIABLE

·        RECTANGULAR

·        ROLL

 

IntlRateV2Request / Package / Size

Deprecated

注意: This tag has been deprecated

 

<Size> tag and any values within the <Size> tag will not result in an error response and will not impact rates that are returned.

String

 

IntlRateV2Request / Package / Width

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference IMM https://pe.usps.com/text/imm/welcome.htm

Integer

minExclusive=0  

IntlRateV2Request / Package / Length

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference IMM https://pe.usps.com/text/imm/welcome.htm

Integer

minExclusive=0  

IntlRateV2Request / Package / Height

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference IMM https://pe.usps.com/text/imm/welcome.htm

Integer

minExclusive=0  

IntlRateV2Request / Package / Girth

Optional

Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.  

 

For more details on dimensional weight pricing or dimension validation reference IMM https://pe.usps.com/text/imm/welcome.htm

Integer

minExclusive=0  

IntlRateV2Request / Package / OriginZip

Optional

Available when Revision= “2”.

 

Origin ZIP Code is required to determine Priority Mail International price to Canadian destinations and is used to determine mail-ability of Global Express Guaranteed. When provided, the response will return a list of Post Office locations where GXG is accepted. The Origin ZIP Code must be valid. 

 

例如:<OriginZip>20770</OriginZip

String

length=5
pattern=\d{5}  

IntlRateV2Request / Package / CommercialFlag

Optional

Returns commercial base postage.

For example: <CommercialFlag>Y<CommercialFlag>

String

Enumerations=

·        Y

·        N

IntlRateV2Request / Package / CommercialPlusFlag

Optional

Returns commercial plus postage.

For example: <CommercialPlusFlag>Y<CommercialPlusFlag>

String

Enumerations=

·        Y

·        N

IntlRateV2Request / Package / ExtraServices

Optional

Available when IntlRateV2Request[Revision='2'].

 

Groups the ExtraService elements.  

(Group)

 

IntlRateV2Request / Package / ExtraServices / ExtraService

Required, repeating up to 6 times

Available when IntlRateV2Request[Revision='2'].Defines extra services in order to determine price and availability of additional services.

 

An initial rate call without the ExtraService tag specified is recommended to determine base availability of extra services for each mail service.

 

The extra service definitions are as follows:

Extra Service Name

ServiceID

挂号信

103

Insurance – Global Express Guaranteed

106

Insurance – Priority Mail International

108

退回收据

105

交寄证明

100

电子 USPS Delivery Confirmation International

109

Scan Retention

181

Scan + Signature Retention

182

Integer

Enumerations=

·        103

·        106

·        108

·        105

·        100

·        109

·        181

·        182

 

IntlRateV2Request/Package/ AcceptanceDateTime

Optional

Available when IntlRateV2Request[Revision='2'].

 

Date and Time the package is accepted by USPS. The AcceptanceDateTime tag along with the DestinationPostalCode and OriginZip is used to calculate the GuaranteeAvailability and also GuaranteeAvailability response tag for PMEI services in Kahala countries. ISO 8601 formatted date. 

YYYY-MM-DDThh:mm:ss+/-hh:mm

For example, 2014-01-22T14:30:51-06:00

DateTime

 

IntlRateV2Request/Package/ DestinationPostalCode

Optional

Available when IntlRateV2Request[Revision='2'].

 

Destination Postal Code

 

The AcceptanceDateTime tag along with the DestinationPostalCode and OriginZip is used to calculate the GuaranteeAvailability and also GuaranteeAvailability response tag for PMEI services in Kahala countries.

String

 

IntlRateV2Request/Package/ Content

Optional

Used to describe the contents of the package.

(Group)

 

IntlRateV2Request/Package/ Content/ContentType

Required if Content supplied.

Contains the enumerated description of the items in the package. 

 

NonnegotiableDocument” and “Documents” both signify mailable non-negotiable documents and are insured automatically for up to $100, though Insurance will not be returned as an extra service. Additional Insurance cannot be purchased. 

 

Any non-document ContentType values are insured automatically for up to $200 and Insurance will be returned as an explicit extra service in the response. Additional Insurance can be purchased for values $200 and greater.

String

Enumerations=

·  CrematedRemains

·  NonnegotiableDocum

·  Pharmaceuticals

·  MedicalSupplies

·  Documents

IntlRateV2Request/Package/ Content/ContentDescription

Optional

For future use

String

 

IntlRateV2Request / Package /TrackingRetentionPeriod

Optional

Used to determine period of Retention for tracking data.

 

注意: When <ExtraService>= “181” or “182” provided in XML request, a valid <TrackingRetentionPeriod> (see table below) is required otherwise a new error will return to indicate the specified ServiceID and Tracking Retention period combination is invalid.

ServiceID

<TrackingRetentionPeriod>

181

“0.5” (6 Months)

181

“1” (1 Year)

181

“3” (3 Years)

181

“5” (5 Years)

181

“7” (7 Years)

182

“3” (3 Years)

182

“5” (5 Years)

182

“7” (7 Years)

 

 

String

minOccurs=0

maxOccurs=1

Enumerations=

·        0.5

·        1

·        3

·        5

·        7

IntlRateV2Request / Package / ReturnHSCodeReqd

Optional

When this tag is set to “Y” for Yes then <HSCodeReqd> will return, which is an indicator for which destinations will require valid Harmonization Code and Content/Item descriptions because of new international shipping regulatory mandates.

 

Per international shipping regulatory mandates, shipments to European Union (EU) countries are required to contain a valid Harmonization Code and Content/Item description. Harmonization Code (i.e., HS Tariff Number) must be based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization. To learn more about providing acceptable item descriptions, view the chart below or read the EU’s guidance on acceptable terms at Guidance on Acceptable and Unacceptable Terms for the Description of Goods.

 

Default= N

Enumerations=

·        Y (Yes)

·        N (No)

IntlRateV2Request

Required once

 

(alias)

 

3.2.1     Sample Requests

Request: IntlRateV2:

IntlRateV2Request USERID="XXXXXXXXX" PASSWORD="">

    <Revision>2</Revision>

    <Package ID="1ST">

        <Pounds>15.12345678</Pounds>

        <Ounces>0</Ounces>

        <Machinable>正确</Machinable>

        <MailType>Package</MailType>

        <GXG>

            <POBoxFlag>Y</POBoxFlag>

            <GiftFlag>Y</GiftFlag>

        </GXG>

        <ValueOfContents>200</ValueOfContents>

        <Country>《United Kingdom</Country>

        <Container>VARIABLE</Container>

        <Width>10</Width>

        <Length>15</Length>

        <Height>10</Height>

        <Girth>0</Girth>

        <OriginZip>18701</OriginZip>

        <CommercialFlag>N</CommercialFlag>

        <AcceptanceDateTime>2023-07-15T13:15:00-06:00</AcceptanceDateTime>

        <DestinationPostalCode>2046</DestinationPostalCode>

        <ReturnHSCodeReqd>Y</ReturnHSCodeReqd>

    </Package>

    <Package ID="2ND">

        <Pounds>2</Pounds>

        <Ounces>0</Ounces>

        <MailType>All</MailType>

        <ValueOfContents>95.75</ValueOfContents>

        <Country>Kazakhstan</Country>

        <Container>长方形</Container>

        <Width>5</Width>

        <Length>10</Length>

        <Height>3</Height>

        <Girth>0</Girth>

        <OriginZip></OriginZip>

        <CommercialFlag>N</CommercialFlag>

        <ReturnHSCodeReqd>N</ReturnHSCodeReqd>

    </Package>

</IntlRateV2Request>

3.3     Response Descriptions

Tag Name

Occurs

描述

类型

Validation

IntlRateV2Response

需要

Opening document tag.  

(Group)

 

IntlRateV2Response / Package

Required repeating up to 25 times

Corresponds to each "Package" node in the request. Each "Package" node will contain either an "Error" node or the rate results.  

(Group)

 

IntlRateV2Response / Package / ID

需要

Package Identification Number (matches IntlRateV2Request/Package/ID) 

NMTOKEN

 

IntlRateV2Response / Package / Prohibitions

需要

Prohibitions  

String

 

IntlRateV2Response / Package / Restrictions

需要

限制  

String

 

IntlRateV2Response / Package / Observations

需要

Observations  

String

 

IntlRateV2Response / Package / CustomsForms

需要

海关表单  

String

 

IntlRateV2Response / Package / ExpressMail

需要

特快专递  

String

 

IntlRateV2Response / Package / AreasServed

需要

Areas Served  

String

 

IntlRateV2Response / Package / AdditionalRestrictions

需要

Additional restrictions on items being shipped to destination country.  

String

 

IntlRateV2Response /  Package / Content

Optional

Echoes the Content from the request. If the Content request is not populated on the request, this tag will not be returned.

(Group)

 

IntlRateV2Response / Package / Content /

ContentType

Optional

Echoes the ContentType from the request. If the Content request is not populated on the request, this tag will not be returned.

String

 

IntlRateV2Response / Package / Content /

ContentDescription

Optional

Echoes the ContentDescription from the request. If the Content request is not populated on the request, this tag will not be returned.

String

 

IntlRateV2Response / Package / Service

Required repeating up to unbounded times

"Service" tag contains a nested rate and service name.  

(Group)

 

IntlRateV2Response / Package / Service / ID

需要

An Integer reflective of the <SvcDescription/>. Refer to Appendix B for all international Service ID values.

Integer

minInclusive=0 

IntlRateV2Response / Package / Service / Pounds

需要

Weight of package (pounds)  

Integer

 

IntlRateV2Response / Package / Service / Ounces

需要

Weight of package (ounces)  

Decimal

 

IntlRateV2Response / Package / Service / Machinable

Optional

If specified in request this is echoed back if relevant to computed postage.  

String

 

IntlRateV2Response / Package / Service / MailType

需要

If specified in request this is echoed back if relevant to computed postage.  

String

 

IntlRateV2Response / Package / Service / GXG

Optional

If specified in request this is echoed back if relevant to computed postage.  

(Group)

 

IntlRateV2Response / Package / Service / GXG / POBoxFlag

需要

If specified in request this is echoed back if relevant to computed postage.  

String

 

IntlRateV2Response / Package / Service / GXG / GiftFlag

需要

If specified in request this is echoed back if relevant to computed postage.  

String

 

IntlRateV2Response / Package / Service / Container

需要

If specified in request this is echoed back if relevant to computed postage.  

String

 

IntlRateV2Response / Package / Service / Width

Optional

Value must be numeric. Units are inches.

 

 

Integer

 

IntlRateV2Response / Package / Service / Length

Optional

Value must be numeric. Units are inches.

 

 

Integer

 

IntlRateV2Response / Package / Service / Height

Optional

Value must be numeric. Units are inches.

 

 

Integer

 

IntlRateV2Response / Package / Service / Girth

Optional

Value must be numeric. Units are inches.

 

 

Integer

 

IntlRateV2Response / Package / Service / Country

需要

Destination Country  

String

 

IntlRateV2Response / Package / Service / Postage

需要

Postage Rate Charged  

Decimal

 

IntlRateV2Response / Package / Service / CommercialPostage

Optional

Commercial Base Rate.  Returned if specified in request.

Decimal

 

IntlRateV2Response / Package / Service / CommercialPlusPostage

Optional

Commercial Plus Rate.  Returned if specified in request.

Decimal

 

IntlRateV2Response / Package / Service / ExtraServices

需要

Groups the Extra Service elements.

(Group)

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService

Optional, repeating up to unbounded times

ExtraService” contains nested service name, availability, and pricing.

 

When IntlRateV2Request[Revision<'2'], the only service returned is Insurance.

(Group)

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService / ServiceID

需要

Extra service ID

Integer

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService / ServiceName

需要

Extra service name

String

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService / Available

需要

Availability of extra service.  Availability may change depending on extra services passed (selected) in request.

Boolean

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService / OnlineAvailable

Optional

Availability of online pricing for extra service.  Availability may change depending on extra services passed (selected) in request.

 

Returns when IntlRateV2Request[Revision='2'] and IntlRateV2Request[CommercialPrice=’Y'].

Boolean

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService / Price

需要

Extra service pricing. Pricing may change depending on extra services passed in request.

 

When IntlRateV2Request[Revision<'2'], the insurance fee is fully calculated.

Decimal

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService OnlinePrice

Optional

Online extra service pricing. Pricing may change depending on extra services passed in request.

 

Returns when IntlRateV2Request[Revision='2'] and IntlRateV2Request[CommercialPrice=’Y'].

Decimal

 

IntlRateV2Response / Package / Service / ExtraServices / ExtraService DeclaredValueRequired

Optional

Indicates if package value is required to calculate extra service rate.

 

Returns when IntlRateV2Request[Revision='2'].

Boolean

 

IntlRateV2Response / Package / Service / ValueOfContents

Optional

This echoes back the value provided in the request. This value is used to calculate the insurance fee (ServiceID=1 under Extra Services) or the Insurance Comment explaining why Insurance Fee is not given.

Decimal

pattern=\d+\.\d\d  

IntlRateV2Response / Package / Service / InsComment

Optional

Returned when IntlRateV2Request[Revision<'2'] only.

 

Explains why no insurance fee is returned, one of three reasons: SERVICE means insurance is not available for this service; DESTINATION means that insurance is not available to the given country via this service; INSURED VALUE means insurance is available for the country and service, but not for the given value.  

String

Enumerations=

·  INSURED VALUE

·  SERVICE

·  DESTINATION

IntlRateV2Response / Package / Service / ParcelIndemnityCoverage

Optional

Deprecated. Tag will no longer be returned. Automatic indemnity coverage has been replaced by the baked-in Insurance amounts of $200 or $100.

Decimal

pattern=\d+\.\d\d  

IntlRateV2Response / Package / Service / SvcCommitments

需要

Service Commitments  

String

 

IntlRateV2Response / Package / Service / SvcDescription

需要

Service Description  

String

 

IntlRateV2Response / Package / Service / MaxDimensions

需要

Maximum Dimensions of Package Allowed  

String

 

IntlRateV2Response / Package / Service / MaxWeight

需要

Maximum Weight of Package Allowed  

Integer

 

IntlRateV2Response / Package / Service / GuaranteeAvailability

Optional once

If the Revision tag >= 2 in the request, the service  type is one of the following:  Priority Express Mail International, PMEI Flat Rate Envelope, PMEI Legal Flat Rate Envelope, and PMEI Padded Flat Rate Envelope, and the country is a Kahala country, the GuaranteeAvailability tag will display the estimated scheduled delivery date.  If not, the tag will contain the estimated scheduled delivery days.

The AcceptanceDateTime tag along with the DestinationPostalCode and OriginZip is used to calculate the GuaranteeAvailability and also GuaranteeAvailability response tag for PMEI services in Kahala countries.

If an estimated scheduled delivery date is available, the format will be

MM/DD/YYYY

e.g.,

01/29/2014. 

If an estimated scheduled delivery date is not available, the format will be a String.

e.g.,

3 - 5 business days to many major markets

String

 

IntlRateV2Response / Package / Service / GXGLocations

Optional

Mailing locations for GXG packages.  Based on OriginZip sent in request.

(Group)

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice

Optional

Individual Post Office information for mailing GXG packages.

(Group)

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / Name

需要

Name of Post Office.

String

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / Address

需要

Street Address of Post Office.

String

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / City

需要

City in which Post Office is located.

String

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / State

需要

State in which Post Office is located.

String

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / ZipCode

需要

Zip Code of Post Office.

String

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / RetailGXGCutOffTime

需要

Retail/GXG cut off time at location.

String

 

IntlRateV2Response / Package / Service / GXGLocations / PostOffice / SaturdayCutOffTime

需要

Saturday cut off time at location.

String

 

IntlRateV2Response / Package / HSCodeReqd

Optional

Returns when <ReturnHSCodeReqd> = “Y”

 

When <HSCodeReqd>True</HSCodeReqd>

Indicates which destinations will require valid Harmonization Code and Content/Item descriptions because of new international shipping regulatory mandates.

 

Per international shipping regulatory mandates, shipments to European Union (EU) countries are required to contain a valid Harmonization Code and Content/Item description. Harmonization Code (i.e., HS Tariff Number) must be based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization. To learn more about providing acceptable item descriptions, view the chart below or read the EU’s guidance on acceptable terms at Guidance on Acceptable and Unacceptable Terms for the Description of Goods.

String

Enumerations

·        True

·        False

IntlRateV2Response

需要

 

(alias)

 

 

3.3.1     Sample Response

《response: IntlRateV2:

<IntlRateV2Response>

    <Package ID="1ST">

        <Prohibitions>Aerosols.

Ammunition, except lead pellets.