Get Locker Info API
USPS Web Tools™
Application Programming Interface
Guía del usuario
Version 1.3 (02/15/2024)
Índice
This document contains a Reference Guide to the Get Locker Info API. See the Developers Guide to learn the administrative process for gaining access to the Web Tools APIs as well as the basic mechanism for calling the APIs and processing the results. The Developer’s Guide also contains information on testing and troubleshooting.
Note: The Request Parameter sections present the XML input tags for generating live requests along with the restrictions on the values allowed. An error message will be returned if an incorrect value is entered. Also, be aware of the maximum character amounts allowed for some tags. If the user enters more than those amounts, an error will not be generated. Web Tools will simply pass in the characters up to the maximum amount allowed and disregard the rest. This is important since the resulting value could prevent a correct response.
When building the XML request, pay particular attention to the order and case for tags. An error message will be returned if an incorrect value is entered. Remember that all data and attribute values in this document are for illustration purposes and are to be replaced by your actual values. For instance, a line of sample code may be:
<Pounds>2</Pounds>
In this instance, you will replace “2” with the weight in pounds for the package.
The Web Tools Get Locker Info API requires additional API permissions. Integrators should contact the Smart Locker Customer Onboarding Support team via email at USPSSmartLockerAPI@usps.gov to request access. Reference https://www.uspssmartpackagelockers.com/faq for details.
For additional USPS Web Tools information, please refer to the Step-By-Step guide found on the Technical Documentation section of the Web Tools page on usps.com/webtools.
The Web Tools Get Locker Info API (API=GetLockerInfo) allows integrators to search for operational USPS Smart Locker locations (identified by unique Facility ID <FacilityID>). The Facility ID output returned in the GetLockerInfo API is a required input for label creation to a Smart Locker via the eVS Domestic Label API.
This API enables integrators to search by City/State and/or ZIP or search all operational Smart Locker locations within the USPS network. If a Smart Locker location is available, the Facility ID and supporting information (such as maximum locker dimensions) is returned to enable integrators to select a locker that fits their package. When no City, State, or ZIP parameters are provided (i.e., “All” locker locations requested), the API will return the first 100 Smart Lockers and a location context value for integrators to use to call for additional locations.
Scheme |
Host |
Path |
API |
XML |
https:// |
secure.shippingapis.com |
/ShippingAPI.dll |
API=GetLockerInfo |
&XML= (see Tag Descriptions below) |
Tag Name |
Occurs |
Descripción |
Tipo |
Validation |
GetLockerInfoRequest |
Obligatorio |
API=GetLockerInfo |
Alias |
|
GetLockerInfoRequest / 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 |
|
GetLockerInfoRequest / PASSWORD |
Optional |
This attribute specifies your Web Tools password. See the Developer's Guide for information on your Password. Por Ejemplo: PASSWORD="XXXXXXX" |
NMTOKEN |
|
GetLockerInfoRequest /City |
Obligatorio |
City of the Post Office where the Smart Locker is located. To search by City, State must also be included. To return all lockers, do not populate. Por ejemplo: <City>Miami</City> Nota: <City> tag must always be included in the request; a value is not required. |
String |
|
GetLockerInfoRequest /State |
Obligatorio |
State of the Post Office where the Smart Locker is located. Value should be passed as two-letter state abbreviation. To search by State, City must also be included. To return all lockers, do not populate. Por ejemplo: <State>FL</State> Nota: <State> tag must always be included in the request; a value is not required. |
String |
minLength=2 maxLength=2 |
GetLockerInfoRequest /Zip5 |
Obligatorio |
5-digit ZIP code of the Post Office where the Smart Locker is located. To return all lockers, do not populate. Por ejemplo: <Zip5>33125</Zip5> Nota: <Zip5> tag must always be included in the request; a value is not required. |
String |
pattern=\d{5} |
GetLockerInfoRequest / AdditionalLocationsContextValue |
Optional |
Pagination feature used to return remaining lockers when more than 100 lockers satisfy search criteria. Nota: When results exceed 100 lockers, the <AdditionalLocationsContextValue> tag is returned. A subsequent request with this value will return the next 100 lockers until all data is returned indicated when this tag no longer returns in the XML response. |
String |
|
GetLockerInfoRequest |
Obligatorio |
|
Alias |
|
Simple Request <GetLockerInfoRequest USERID="XXXXXXXXX" PASSWORD=""> <City>Miami</City> <State>FL</State> <Zip5>33142</Zip5> </GetLockerInfoRequest> All Call – Returns All Operational Lockers (limited to 100 lockers per XML response) <GetLockerInfoRequest USERID="XXXXXXXXX" PASSWORD=""> <City></City> <State></State> <Zip5></Zip5> </GetLockerInfoRequest> Subsequent All Call – Returns remaining locations using context value returned in original XML response GetLockerInfoRequest USERID="XXXXXXXXX" PASSWORD=""> <City></City> <State></State> <Zip5></Zip5> <AdditionalLocationsContextValue>1365853</AdditionalLocationsContextValue> </GetLockerInfoRequest> |
Tag Name |
Occurs |
Descripción |
Tipo |
Validation |
GetLockerInfoResponse |
Obligatorio |
|
Alias |
|
GetLockerInfoResponse /Location |
Obligatorio |
|
String |
minOccurs="1" maxOccurs="100" |
GetLockerInfoResponse /Location/FacilityID |
Obligatorio |
Unique identifier of the Post Office where the Smart Locker is located. Nota: This value is required when generating a Smart Locker label in the Web Tools eVS Domestic Label API. |
String |
|
GetLockerInfoResponse /Location/LocationAddress |
Obligatorio |
Post Office (where the Smart Locker is located) Address group. |
Address Type |
|
GetLockerInfoResponse /Location/LocationAddress/Address1 |
Obligatorio |
Primary Street Address of the Post Office where the Smart Locker is located. |
String |
|
GetLockerInfoResponse /Location/LocationAddress/Address2 |
Optional |
Secondary Address (if available) of the Post Office where the Smart Locker is located. |
String |
|
GetLockerInfoResponse /Location/LocationAddress/City |
Obligatorio |
City of the Post Office where the Smart Locker is located. |
City Type |
maxLength ="28" minLength ="0" |
GetLockerInfoResponse /Location/LocationAddress/State |
Obligatorio |
State of the Post Office where the Smart Locker is located. Returned as two-letter state abbreviation. |
State Type |
[a-z or A-Z]{2} |
GetLockerInfoResponse /Location/LocationAddress/Zip5 |
Obligatorio |
5-digit ZIP code of the Post Office where the Smart Locker is located. |
Zip5 Type |
[0-9]{5} |
GetLockerInfoResponse /Location/LocationAddress/Zip4 |
Obligatorio |
4-digit ZIP code of the Post Office where the Smart Locker is located. |
Zip4 Type |
[0-9]{4} |
GetLockerInfoResponse /Location/LocationLatitude |
Obligatorio |
Latitude of the Post Office where the Smart Locker is located. |
String |
|
GetLockerInfoResponse /Location/LocationLongitude |
Obligatorio |
Longitude of the Post Office where the Smart Locker is located. |
String |
|
GetLockerInfoResponse /Location/DeliveryAddress |
Obligatorio |
Smart Locker Delivery Address group. |
Grupo |
|
GetLockerInfoResponse /Location/DeliveryAddress/Address1 |
Obligatorio |
Primary Street Delivery Address of the Smart Locker. (i.e., “USPS SMART LOCKER”) |
String |
|
GetLockerInfoResponse /Location/DeliveryAddress/Address2 |
Obligatorio |
Secondary Delivery Address of the Smart Locker (if available). |
String |
|
GetLockerInfoResponse /Location/DeliveryAddress/City |
Obligatorio |
Delivery City of the Smart Locker. |
String |
maxLength ="28" minLength ="0" |
GetLockerInfoResponse /Location/DeliveryAddress/State |
Obligatorio |
Delivery State of the Smart Locker. Returned as two-letter state abbreviation. |
String |
[a-z or A-Z]{2} |
GetLockerInfoResponse /Location/DeliveryAddress/Zip5 |
Obligatorio |
5-digit Delivery ZIP code of the Smart Locker. |
String |
[0-9]{5} |
GetLockerInfoResponse /Location/DeliveryAddress/Zip4 |
Obligatorio |
4-digit Delivery ZIP code of the Smart Locker. |
String |
[0-9]{4} |
GetLockerInfoResponse /Location/DeliveryAddress/DeliveryPoint |
Obligatorio |
2-digit Delivery Point Code (DPC) of the Smart Locker. |
String |
[0-9]{2} |
GetLockerInfoResponse /Location/LockerStatus |
Obligatorio |
Defaults to Operational. Nota: This API will only return lockers in “Operational” status. |
String |
|
GetLockerInfoResponse /Location/LockerOnline |
Obligatorio |
Status of an operational locker. |
Boolean |
True or False |
GetLockerInfoResponse /Location/LockerSizeMaximumLength |
Obligatorio |
Length of the biggest locker compartment for the locker unit. |
Decimal |
|
GetLockerInfoResponse /Location/LockerSizeMaximumWidth |
Obligatorio |
Width of the biggest locker compartment for the locker. |
Decimal |
|
GetLockerInfoResponse /Location/LockerSizeMaximumHeight |
Obligatorio |
Height of the biggest locker compartment for the locker unit. |
Decimal |
|
GetLockerInfoResponse /Location/ServiceDirectShip |
Obligatorio |
Indicates whether the locker can accept direct-to-locker shipments. |
Boolean |
True or False |
GetLockerInfoResponse /Location/ServiceRedelivery |
Obligatorio |
Indicates whether the locker can support redelivery. |
Boolean |
True or False |
GetLockerInfoResponse /Location/ServicePOBoxOverflow |
Obligatorio |
Indicates whether the locker can accept packages that cannot fit into a PO Box. |
Boolean |
True or False |
GetLockerInfoResponse /Location/PrepaidReturns |
Obligatorio |
Indicates whether the locker can accept prepaid returns. |
Boolean |
True or False |
GetLockerInfoResponse /Location/ServiceLabelPrinting |
Obligatorio |
Indicates whether the locker has printing capability. |
Boolean |
True or False |
GetLockerInfoResponse /AdditionalContextValue |
Optional |
Returns the 7-digit context value so integrators can obtain additional locations. |
Context Type |
[0-9]{7} |
GetLockerInfoResponse |
Obligatorio |
|
Alias |
|
GetLockerInfo Response (Single Response) <GetLockerInfoResponse> <Location> <FacilityID>1368559</FacilityID> <LocationName>JOSE MARTI</LocationName> <LocationAddress> <Address1>425 NW 27TH AVE</Address1> <Address2></Address2> <City>MIAMI</City> <State>FL</State> <Zip5>33125</Zip5> <Zip4>9998</Zip4> </LocationAddress> <LocationLatitude>25.7768520000</LocationLatitude> <LocationLongitude>-80.2391510000</LocationLongitude> <DeliveryAddress> <Address1>USPS SMART LOCKER</Address1> <Address2></Address2> <City>MIAMI</City> <State>FL</State> <Zip5>33125</Zip5> <Zip4>0100</Zip4> <DeliveryPoint>99</DeliveryPoint> </DeliveryAddress> <LockerStatus>Operational</LockerStatus> <LockerOnline>True</LockerOnline> <LockerSizeMaximumLength>18.50</LockerSizeMaximumLength> <LockerSizeMaximumWidth>14.50</LockerSizeMaximumWidth> <LockerSizeMaximumHeight>13.00</LockerSizeMaximumHeight> <ServiceDirectShip>True</ServiceDirectShip> <ServiceRedelivery>True</ServiceRedelivery> <ServicePOBoxOverflow>True</ServicePOBoxOverflow> <ServicePrepaidReturns>False</ServicePrepaidReturns> <ServiceLabelPrinting>False</ServiceLabelPrinting> </Location> </GetLockerInfoResponse> GetLockerInfo Response (Multiple Locations returned; exceeds 100) <GetLockerInfoResponse> <Location> <FacilityID>1368559</FacilityID> <LocationName>JOSE MARTI</LocationName> <LocationAddress> <Address1>425 NW 27TH AVE</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33125</Zip5> <Zip4>9998</Zip4> </LocationAddress> <LocationLatitude>25.7768520000</LocationLatitude> <LocationLongitude>-80.2391510000</LocationLongitude> <DeliveryAddress> <Address1>USPS SMART LOCKER</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33125</Zip5> <Zip4>0100</Zip4> </DeliveryAddress> <LockerStatus>Operational</LockerStatus> <LockerOnline>True</LockerOnline> <LockerSizeMaximumLength>18.50</LockerSizeMaximumLength> <LockerSizeMaximumWidth>14.50</LockerSizeMaximumWidth> <LockerSizeMaximumHeight>13.00</LockerSizeMaximumHeight> <ServiceDirectShip>True</ServiceDirectShip> <ServicePOBoxOverflow>True</ServicePOBoxOverflow> <ServicePrepaidReturns>False</ServicePrepaidReturns> <ServiceLabelPrinting>False</ServiceLabelPrinting> </Location> <Location> <FacilityID>1438606</FacilityID> <LocationName>ALLAPATTAH</LocationName> <LocationAddress> <Address1>1799 NW 28TH ST</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33142</Zip5> <Zip4>9998</Zip4> </LocationAddress> <LocationLatitude>25.8021180000</LocationLatitude> <LocationLongitude>-80.2253130000</LocationLongitude> <DeliveryAddress> <Address1>USPS SMART LOCKER</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33142</Zip5> <Zip4>0001</Zip4> </DeliveryAddress> <LockerStatus>Operational</LockerStatus> <LockerOnline>True</LockerOnline> <LockerSizeMaximumLength>18.50</LockerSizeMaximumLength> <LockerSizeMaximumWidth>14.50</LockerSizeMaximumWidth> <LockerSizeMaximumHeight>13.00</LockerSizeMaximumHeight> <ServiceDirectShip>True</ServiceDirectShip> <ServicePOBoxOverflow>True</ServicePOBoxOverflow> <ServicePrepaidReturns>False</ServicePrepaidReturns> <ServiceLabelPrinting>False</ServiceLabelPrinting> </Location> <Location> <FacilityID>1438765</FacilityID> <LocationName>NORLAND</LocationName> <LocationAddress> <Address1>18640 NW 2ND AVE</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33169</Zip5> <Zip4>9998</Zip4> </LocationAddress> <LocationLatitude>25.9454400000</LocationLatitude> <LocationLongitude>-80.2054020000</LocationLongitude> <DeliveryAddress> <Address1>USPS SMART LOCKER</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33169</Zip5> <Zip4>0001</Zip4> </DeliveryAddress> <LockerStatus>Operational</LockerStatus> <LockerOnline>True</LockerOnline> <LockerSizeMaximumLength>18.50</LockerSizeMaximumLength> <LockerSizeMaximumWidth>14.50</LockerSizeMaximumWidth> <LockerSizeMaximumHeight>13.00</LockerSizeMaximumHeight> <ServiceDirectShip>True</ServiceDirectShip> <ServicePOBoxOverflow>True</ServicePOBoxOverflow> <ServicePrepaidReturns>False</ServicePrepaidReturns> <ServiceLabelPrinting>False</ServiceLabelPrinting> </Location> <Location> <FacilityID>1439303</FacilityID> <LocationName>MILAM DAIRY</LocationName> <LocationAddress> <Address1>5600 NW 72ND AVE</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33166</Zip5> <Zip4>9998</Zip4> </LocationAddress> <LocationLatitude>25.8243630000</LocationLatitude> <LocationLongitude>-80.3152976000</LocationLongitude> <DeliveryAddress> <Address1>USPS SMART LOCKER</Address1> <Address2/> <City>MIAMI</City> <State>FL</State> <Zip5>33178</Zip5> <Zip4>0003</Zip4> </DeliveryAddress> <LockerStatus>Operational</LockerStatus> <LockerOnline>True</LockerOnline> <LockerSizeMaximumLength>18.50</LockerSizeMaximumLength> <LockerSizeMaximumWidth>14.50</LockerSizeMaximumWidth> <LockerSizeMaximumHeight>13.00</LockerSizeMaximumHeight> <ServiceDirectShip>True</ServiceDirectShip> <ServicePOBoxOverflow>True</ServicePOBoxOverflow> <ServicePrepaidReturns>False</ServicePrepaidReturns> <ServiceLabelPrinting>False</ServiceLabelPrinting> </Location> … [truncated for space] <AdditionalLocationsContextValue>1365853</AdditionalLocationsContextValue> </GetLockerInfoResponse> |
Error conditions are handled at the main XML document 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. If the search criteria does not return any data, an <Error> element will be returned within the <GetLockerInfoResponse> element, for example:
<GetLockerInfoResponse>
<Error>
<ErrorCode>-2147219102</ErrorCode>
<ErrorMessage>No Parcel Locker was found for the given search parameters.</ErrorMessage>
</Error>
</GetLockerInfoResponse>