Skip to content

Generar guia

Esta guía te permite generar una guía de envío utilizando el API de DrEnvio. Incluye información sobre los distintos entornos disponibles, la lista de transportistas compatibles, los parámetros de solicitud, la estructura de la respuesta y más.

Environments

DrEnvio API supports two environments: Production and Sandbox.

Production Environment El entorno de producción es donde se procesan los envíos reales. Para utilizar el API de producción, envía tus solicitudes a la siguiente URL:

URL utilizada para la generación de envíos con Redpack y en el caso de Fedex, sólo cuando el ShippingId es G1.

Terminal window
https://api-clientes.vercel.app/v2/shipments/generate

URL utilizada para la generación de envíos con las paqueterías restantes.

Terminal window
https://prod.api-drenvio.com/v2/shipments/generate

API request

To generate the guide, send a POST request with a JSON body like this:

{
"origin": {
"city": "Monterrey",
"company": "SACR0 DESIGN",
"country": "MX",
"district": "MIRAVALLE",
"email": "sample_sample@localhost",
"int_number": "2",
"name": "SAMPLE FULL NAME",
"number": "282",
"phone": "8683457800",
"postal_code": "66250",
"reference": "SAMPLE DISTRICT",
"state": "NL",
"street": "ANTONIO VIVALDI"
},
"destination": {
"city": "Monterrey",
"company": "PARROQUIA DE NUESTRA SEÑORA DE LA PIEDAD",
"country": "MX",
"district": "Piedad Narvarte",
"email": "sample_sample@localhost",
"name": "SAMPLE FULL NAME",
"number": "320",
"phone": "8683457800",
"postal_code": "66260",
"reference": "SAMPLE DISTRICT",
"state": "NL",
"street": "Obrero Mundial "
},
"shipment": {
"carrier": "fedex",
"contentExplanation": "EXAMPEL CONTENT",
"contentQuantity": 1,
"ObjectId": "code",
"price": 133.4,
"service": "ground",
"ShippingId": "N4",
"satContent": "31181701"
},
"insurance": 0,
"packages": [
{
"content": "ORNAMENTOS O DECORACIONES",
"contentQuantity": 1,
"declared_value": 0,
"height": 10,
"weight": 1,
"width": 10,
"length": 10,
"type": "box",
"name": "Paquete enviado de pruebas",
"volumetric": 0.2,
"main_weight": 1
}
],
"service_id": "fedex_mx_D-C02_ground",
"carriers": ["fedex"]
}

Fields description

FieldDescriptionTypeRequired
originOrigin Address of shipmentObject AddressObjecttrue
destinationDestination address of the shipmentObject AddressObjecttrue
shipmentsShipment detailsObject ShipmentObjecttrue
packagesPackagesArray PackagesObjecttrue
service_idId of the service selectedstringtrue
insuranceThe insurance of shipment (MXN for national, USD for international)numbertrue
carriersSelected carrier(s) (Provided in the rate)Array of stringstrue

Address (Object)

El campo last_name solo se utiliza para envíos de 99Minutos que contengan el ShippingId en N11 y para todas las paqueterías que tengan el código A-P10 en el service_id.

Si se deja el campo como opcional, para los envíos con el código A-P10 se rellenará automáticamente con el campo company. Para todos los envíos que no cumplan con las condiciones mencionadas, el campo debe ser ignorado.

FieldDescriptionTypeRequired
nameName of the person making/receiving the shipment.stringtrue
last_nameLast Name of the person making/receiving the shipment.stringfalse
companyCompany of the person making/receiving the shipment, if not provided will be NA.stringtrue
emailEmail of the person making/receiving the shipment.stringtrue
phonePhone number of the person making/receiving the shipment.stringtrue
streetStreet of the person making/receiving the shipment.stringtrue
numberNumber of building of the address.stringtrue
int_numberInterior Number of building of the address.stringfalse
districtDistrict of the address.stringtrue
cityCity of the address.stringtrue
countryAlways MX until next major update.stringtrue
referenceA reference to help find the address, if not provided will be NA.stringtrue
state2 digit state code of the address, those can be found here.StateCode Enumtrue
postalCode5 digit postal code of the address.stringtrue

Package (Object)

FieldDescriptionTypeRequired
widthWidth of the package in CM.numbertrue
heightHeight of the package in CM.numbertrue
lengthLength of the package in CM.numbertrue
weightWeight of the package in KG.numbertrue
typeThe type of the package.Enum: box, envelope, pallettrue
nameContent of the package.stringtrue
contentContent of the package.stringtrue
declared_valueDeclared Value of the package.numbertrue
contentQuant ityAmount of packages.numbertrue

StateCode (Enum)

NameStateCode2Digit
AguascalientesAG
Baja CaliforniaBC
Baja California SurBS
CampecheCM
ChiapasCS
ChihuahuaCH
Ciudad de MéxicoCX
CoahuilaCO
ColimaCL
DurangoDG
GuanajuatoGT
GuerreroGR
HidalgoHG
JaliscoJA
Estado de MéxicoEM
MichoacánMI
MorelosMO
NayaritNA
Nuevo LeónNL
OaxacaOA
PueblaPU
QuerétaroQT
Quintana RooQR
San Luis PotosíSL
SinaloaSI
SonoraSO
TabascoTB
TamaulipasTM
TlaxcalaTL
VeracruzVE
YucatánYU
ZacatecasZA

Shipment (Object)

El campo satContent es un código identificador del tipo de producto requerido en México por el SAT, se obtiene con el servicio de Consulta de código de productos del SAT.

Si no se utiliza el servicio mencionado, se puede colocar el código de paquete genérico en sun lugar (ejemplo: satContent: ‘31181701’)

FieldDescriptionTypeRequired
carrierProvided in the ratestringtrue
ObjectIdProvided in the ratestringtrue
ShippingIdProvided in the ratestringtrue
serviceProvided in the ratestringtrue
priceProvided in the ratenumbertrue
contentExplanationAn explanation of the content of the shipment, must include fabrication materialsstringtrue
contentQuantityHow many items are in the boxnumbertrue
satContentProduct type identification code that you are sendingstringtrue

API response

{
"shipment_status": "Activa",
"pickups_status": "En espera",
"_id": "649f036f8b74c6f35e052902",
"user": "auth0|5f60f5e21e076c00797eee99",
"origin": {
"_id": "649f036e8b74c6f35e0528ff",
"name": "SAMPLE FULL NAME",
"company": "SACR0 DESIGN",
"email": "sample_sample@localhost",
"phone": "8683457800",
"street": "ANTONIO VIVALDI",
"number": "282",
"int_number": "2",
"district": "MIRAVALLE",
"city": "Monterrey",
"state": "NL",
"country": "MX",
"postal_code": "66250",
"reference": "SAMPLE DISTRICT",
"title": "SAMPLE FULL NAMEdireccion",
"user": "auth0|5f60f5e21e076c00797eee99"
},
"destination": {
"_id": "649f036e8b74c6f35e052900",
"name": "SAMPLE FULL NAME",
"company": "PARROQUIA DE NUESTRA SEÑORA DE LA PIEDAD",
"email": "sample_sample@localhost",
"phone": "8683457800",
"street": "Obrero Mundial ",
"number": "320",
"int_number": "0",
"district": "Piedad Narvarte",
"city": "Monterrey",
"state": "NL",
"country": "MX",
"postal_code": "66260",
"reference": "SAMPLE DISTRICT",
"title": "SAMPLE FULL NAMEdireccion",
"user": "auth0|5f60f5e21e076c00797eee99"
},
"packages": [
{
"_id": "649f036e8b74c6f35e052901",
"weight": 1,
"height": 10,
"width": 10,
"length": 10,
"declared_value": 0,
"volumetric": 0.2,
"type": "box",
"content": "ORNAMENTOS O DECORACIONES",
"name": "ORNAMENTOS O DECORACIONES",
"main_weight": 1,
"user": "auth0|5f60f5e21e076c00797eee99"
}
],
"label": "https://storage.googleapis.com/download/storage/v1/b/drenvio-8741f.appspot.com/o/fedex%2FUAT301007251337?
generation=1688142703394521&alt=media",
"shipping_id": "N4",
"carrier": "fedex",
"service": "ground",
"service_id": "fedex_mx_D-C02_ground",
"price": 133.4,
"insurance": 0,
"tracking": "UAT301007251337",
"metadata": {
"format": "PDF_4_6",
"extended_area": false,
},
"created_at": "2023-06-30T16:31:43.681Z"
}