Shipping to Peru

Ship to Peru: the two-letter department code, the city as free text, and what you can test in sandbox.

Peru's departments have two codes each, and only the two-letter one is unique: LIM is both Lima and Lima Capital. Send two letters, and the rest is an ordinary address.

At a glance

Postal codeRequired by the API: 15001
DepartmentA two-letter code, in state. Lima Capital is LR
CityFree text: Miraflores
House numbernumber, required to create a label
Tax IDRUC or DNI, in identificationNumber. Optional
CurrencyQuote in PEN. The label is charged in your account's currency
In sandboxNo carrier completes the cycle

What an address to Peru needs

The fields of a Peruvian address. Where the address form (GET /generic-form?country_code=PE&form=address_info) differs, the table says so:

FieldRequiredWhat goes in it
streetyesAv. Larco
stateyesA two-letter department code — LR, AR. Never the name
cityyesMiraflores — free text, no catalog
postalCodeyesRequired by the API, although the form hides it: 15001
numberyes, for the labelBuilding number
identificationNumbernoRUC or DNI
referencenoFree text for the carrier

Send the house number as number. The sandbox's address form calls it streetNumber; production and the API use number. Thirteen countries differ this way: see Address Rules by Country.

The department code

API reference → Get states by country

curl https://queries.envia.com/state?country_code=PE

26 departments, each with a two-letter and a three-letter code:

{ "name": "Amazonas", "code_2_digits": "AM", "code_3_digits": "AMA", "country_code": "PE" }

Both are accepted. Send code_2_digits: it is the only unique one. LIM is both Lima (LP) and Lima Capital (LR), and GET /state/PE/LIM answers with the two. Miraflores, San Isidro and the rest of the metropolitan area are LR.

A name in state fails:

{ "meta": "error", "error": { "code": 400, "message": "String is too long at #->properties:origin->$ref[#/definitions/address]->properties:state" } }

state takes 2 to 3 characters. The error names the schema path, not the problem: when you see it, a name went where a code belongs.

All 26 departments and their codes
SendAlso in the catalogName
AMAMAAmazonas
ANANCAncash
APAPUApurimac
ARAREArequipa
AYAYAAyacucho
CJCAJCajamarca
CLCALCallao
CSCUSCusco
HVHUVHuancavelica
HCHUCHuanuco
ICICAIca
JUJUNJunin
LLLALLa Libertad
LBLAMLambayeque
LPLIMLima
LRLIMLima Capital
LOLORLoreto
MDMDDMadre de Dios
MQMOQMoquegua
PAPASPasco
PIPIUPiura
PUPUNPuno
SMSAMSan Martin
TATACTacna
TUTUMTumbes
UCUCAUcayali

Repeated codes. LIM is both Lima and Lima Capital — send the two-letter code, which is unique (LP, LR).

The list comes from GET /state?country_code=PE.

A complete address

{
  "name": "Carlos Quispe",
  "email": "[email protected]",
  "phone": "+51 900 000 000",
  "street": "Av. Larco",
  "number": "345",
  "city": "Miraflores",
  "state": "LR",
  "postalCode": "15001",
  "country": "PE"
}

GET /provinces/{state_code} does not help here: /provinces/LR returns an empty list. Peruvian cities are free text.

Ship it

The calls are the same in every country. Shipping to Chile walks through all five — carriers, quote, label, track and cancel — under Ship it, end to end; use them with the Peruvian address above. Check which carriers your account has for Peru with Carriers by country.

International, into and out of Peru

A shipment that crosses the Peruvian border is an ordinary international shipment: see International Shipping & Customs. The RUC or DNI in identificationNumber stays optional.

Testing in sandbox

Why Peru cannot be tested end to end in sandbox
  • Olva Courier is the only carrier the test account has for a domestic Peruvian lane, and it answers 1102 There is no coverage for the selected addresses for Lima and Arequipa.
  • Other carrier names answer 1101, which means not enabled on the account.
  • Sandbox does check the address: a state that is too long or a missing postalCode fails with 400 before any carrier is asked. The address above passes that check.

In production you use the carriers enabled on your account.

Next steps


Did this page help you?