Referencia de API

Se trata de una API basada en HTTP que las aplicaciones pueden usar de manera programática para consultar datos y llevar a cabo una amplia gama de tareas relacionadas con nuestra plataforma. Recibe una respuesta de tipo JSON para un mejor manejo y control de la información retornada.

En el panel lateral del lado derecho su muestra la configuración de la API en diversos lenguajes de programación como Curl Ruby Python PHP Java Node

Para pruebas hacer cuenta en test.envia.com
Para producción utilizar cuenta de envia.com

Image

API Endpoint - Producción
https://api.envia.com/
API Endpoint - Pruebas
https://api-test.envia.com/

Autenticación

Para poder utilizar el API de Envia.com primero necesitas registrarte en nuestro portal. Recuerda muy bien tu correo y contraseña, ya que estos serán los datos que necesitrás para poder autenticarte en nuestra API y poder utilizarla.

Lo primero que tendrás que hacer es encriptar en base64 tu correo electrónico y contraseña en este formato: "[email protected]:password123". (No olvides separar tu correo electrónico de tu contraseña utilizando dos puntos [:])

Encriptación: base64_encode('[email protected]:password123')

Cuenta en base64: dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=

Authorization
Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=
Content-type
application/json

POST Cotizar

https://api.envia.com/ship/rate/
Headers
Authorization
Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=
Content-type
application/json
Body (raw)
{ "origin": { "name": "Raymundo Salazar", "company": "Example Company", "email": "[email protected]", "phone": "81818181", "street": "Av Vasconcelos", "number": "1400", "district": "Palo Blanco", "city": "Monterrey", "state": "NL", "country": "MX", "postalCode": "66236" }, "destination": { "name": "Gina Colin", "company": "Example Company", "email": "[email protected]", "phone": "8181818181", "street": "Av Vasconcelos", "number": "1400", "district": "Palo Blanco", "city": "Monterrey", "state": "NL", "country": "MX", "postalCode": "66240" }, "package": { "content": "jewels", "amount": 1, "type": "box", "dimensions": { "length": 17, "width": 13, "height": 8 }, "weight": 3, "insurance": 0, "declaredValue": 0 }, "shipment": { "carrier": "estafeta" } }

Propiedades de Llamada

Atributo Tipo Descripción Opciones
origin array
origin name string Nombre de la Persona que envía.
origin company string Nombre de la Compañía de quién envía.
origin email string Correo Electrónico de la Persona que envía.
origin phone string Teléfono de la Persona que envía.
origin street string Dirección. Calle de quién envía.
origin number string Dirección. Número exterior de quién envía.
origin district string Dirección. Distrito de quién envía.
origin city string Dirección. Ciudad de quién envía.
origin state string Dirección. Estado de quién envía.
origin country string Dirección. Pais de quién envía.
origin postalCode string Dirección. Código Postal de quién envía.
destination array
destination name string Nombre de la Persona que recibe.
destination company string Nombre de la Compañía de quién recibe.
destination email string Correo Electrónico de la Persona que recibe.
destination phone string Teléfono de la Persona que recibe.
destination street string Dirección. Calle de quién recibe.
destination number string Dirección. Número exterior de quién recibe.
destination district string Dirección. Distrito de quién recibe.
destination city string Dirección. Ciudad de quién recibe.
destination state string Dirección. Estado de quién recibe.
destination country string Dirección. Pais de quién recibe.
destination postalCode string Dirección. Código Postal de quién recibe.
package array
package content string Descripción del contenido del paquete.
package amount integer Cantidad de guias a generar.
package type string Tipo del paquete a enviar. box
pallet
package dimensions array Dimensiones del paquete a enviar.
package dimensions length integer Largo.
package dimensions width integer Ancho.
package dimensions height integer Alto.
package weight integer Peso del paquete a enviar.
package insurance integer Monto del Seguro del Paquete.
package declaredValue integer Monto del valor agregado.
shipment array
shipment carrier string Paquetería a asignar. carssa
dhl
estafeta
fedex
ivoy
noventa9minutos
paquetexpress
quiken
redpack
sendex
ups
shipment customKey array Arreglo con las Llaves Personalizadas de la Paquetería. Revisar Documentación.

Propiedades de Respuesta

Atributo Tipo Descripción
meta string Acción realizada.
data array Arreglo con la información de los servicios aplicables a la cotización solicitada.
data carrier string Nombre de la paquetería seleccionada.
data service string Tipo de Servicio disponible por la paquetería.
data deliveryEstimate string Tiempo estimado de entrega.
data basePrice integer Valor base del envío del paquete.
data extendedFare integer Valor de la tarifa extendida. (Si aplica)
data insurance integer Valor del Seguro. (Si aplica)
data totalPrice integer Valor total por el envío del paquete.
data currency string Tipo de Cambio de Moneda actual.
Configuración cURL de Ejemplo
                                    
curl --request POST \
--url https://api.envia.com/ship/rate/ \
--header 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=' \
--header 'Content-Type: application/json' \
--data '{
    "origin": {
       "name": "Raymundo Salazar",
       "company": "Example Company",
       "email": "[email protected]",
       "phone": "81818181",
       "street": "Av Vasconcelos",
       "number": "1400",
       "district": "Palo Blanco",
       "city": "Monterrey",
       "state": "NL",
       "country": "MX",
       "postalCode": "66236"
    },
    "destination": {
       "name": "Gina Colin",
       "company": "Example Company",
       "email": "[email protected]",
       "phone": "8181818181",
       "street": "Av Vasconcelos",
       "number": "1400",
       "district": "Palo Blanco",
       "city": "Monterrey",
       "state": "NL",
       "country": "MX",
       "postalCode": "66240"
    },
    "package": {
       "content": "jewels",
       "amount": 1,
       "type": "box",
       "dimensions": {
          "length": 17,
          "width": 13,
          "height": 8
       },
       "weight": 3,
       "insurance": 0,
       "declaredValue": 0
    },
    "shipment": {
       "carrier": "estafeta"
    }
}'
                                    
                                 
Configuración Ruby de Ejemplo
                                       
require 'uri'
require 'net/http'

url = URI("https://api.envia.com/ship/rate/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM='
request["Content-Type"] = 'application/json'
request.body = "{\n
    \"origin\": {\n
       \"name\": \"Raymundo Salazar\",\n
       \"company\": \"Example Company\",\n
       \"email\": \"[email protected]\",\n
       \"phone\": \"81818181\",\n
       \"street\": \"Av Vasconcelos\",\n
       \"number\": \"1400\",\n
       \"district\": \"Palo Blanco\",\n
       \"city\": \"Monterrey\",\n
       \"state\": \"NL\",\n
       \"country\": \"MX\",\n
       \"postalCode\": \"66236\"\n
    },\n
    \"destination\": {\n
       \"name\": \"Gina Colin\",\n
       \"company\": \"Example Company\",\n
       \"email\": \"[email protected]\",\n
       \"phone\": \"8181818181\",\n
       \"street\": \"Av Vasconcelos\",\n
       \"number\": \"1400\",\n
       \"district\": \"Palo Blanco\",\n
       \"city\": \"Monterrey\",\n
       \"state\": \"NL\",\n
       \"country\": \"MX\",\n
       \"postalCode\": \"66240\"\n
    },\n
    \"package\": {\n
       \"content\": \"jewels\",\n
       \"amount\": 1,\n
       \"type\": \"box\",\n
       \"dimensions\": {\n
          \"length\": 17,\n
          \"width\": 13,\n
          \"height\": 8\n
       },\n
       \"weight\": 3,\n
       \"insurance\": 0,\n
       \"declaredValue\": 0\n
    },\n
    \"shipment\": {\n
       \"carrier\": \"estafeta\"\n
    }\n
}"

response = http.request(request)
puts response.read_body
                                       
                                    
Configuración Python de Ejemplo
                                       
import requests

url = "https://api.envia.com/ship/rate/"

payload = "{\n
    \"origin\": {\n
       \"name\": \"Raymundo Salazar\",\n
       \"company\": \"Example Company\",\n
       \"email\": \"[email protected]\",\n
       \"phone\": \"81818181\",\n
       \"street\": \"Av Vasconcelos\",\n
       \"number\": \"1400\",\n
       \"district\": \"Palo Blanco\",\n
       \"city\": \"Monterrey\",\n
       \"state\": \"NL\",\n
       \"country\": \"MX\",\n
       \"postalCode\": \"66236\"\n
    },\n
    \"destination\": {\n
       \"name\": \"Gina Colin\",\n
       \"company\": \"Example Company\",\n
       \"email\": \"[email protected]\",\n
       \"phone\": \"8181818181\",\n
       \"street\": \"Av Vasconcelos\",\n
       \"number\": \"1400\",\n
       \"district\": \"Palo Blanco\",\n
       \"city\": \"Monterrey\",\n
       \"state\": \"NL\",\n
       \"country\": \"MX\",\n
       \"postalCode\": \"66240\"\n
    },\n
    \"package\": {\n
       \"content\": \"jewels\",\n
       \"amount\": 1,\n
       \"type\": \"box\",\n
       \"dimensions\": {\n
          \"length\": 17,\n
          \"width\": 13,\n
          \"height\": 8\n
       },\n
       \"weight\": 3,\n
       \"insurance\": 0,\n
       \"declaredValue\": 0\n
    },\n
    \"shipment\": {\n
       \"carrier\": \"estafeta\"\n
    }\n
}"

headers = {
   'Authorization': "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
   'Content-Type': "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
                                    
                                 
Configuración PHP de Ejemplo
                                       
public function rate(){
   $url = "https://api.envia.com/ship/rate/";
   $username = "[email protected]";
   $password = "123456";

   $data = [
       "origin" => array(
          "name" => "Raymundo Salazar",
          "company" => "Example Company",
          "email" => "[email protected]",
          "phone" => "81818181",
          "street" => "Av Vasconcelos",
          "number" => "1400",
          "district" => "Palo Blanco",
          "city" => "Monterrey",
          "state" => "NL",
          "country" => "MX",
          "postalCode" => "66236"
       ),
       "destination" => array(
          "name" => "Gina Colin",
          "company" => "Example Company",
          "email" => "[email protected]",
          "phone" => "8181818181",
          "street" => "Av Vasconcelos",
          "number" => "1400",
          "district" => "Palo Blanco",
          "city" => "Monterrey",
          "state" => "NL",
          "country" => "MX",
          "postalCode" => "66240"
       ),
       "package" => array(
          "content" => "jewels",
          "amount" => 1,
          "type" => "box",
          "dimensions" => array(
             "length" => 17,
             "width" => 13,
             "height" => 8
          ),
          "weight" => 3,
          "insurance" => 0,
          "declaredValue" => 0
       ),
       "shipment" => array(
          "carrier" => "fedex"
       )
   ];

   $options = array(
      'http' => array(
         'header' => [
            "Content-Type: application/json",
            "Authorization: Basic ".base64_encode("$username:$password")
         ],
         'method' => "POST",
         'content' => json_encode($data)
      ),
      "ssl" => array(
         "verify_peer" => false,
         "verify_peer_name" => false,
      )
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
}
                                    
                                 
Configuración Java de Ejemplo
No data
Configuración Node de Ejemplo
                                       
var http = require("http");
var options = {
   "method": "POST",
   "hostname": [
      "api.envia.com"
   ],
   "path": [
      "ship",
      "rate"
   ],
   "headers": {
      "Authorization": "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
      "Content-Type": "application/json"
   }
};

var req = http.request(options, function (res) {
   var chunks = [];

   res.on("data", function (chunk) {
      chunks.push(chunk);
   });

   res.on("end", function () {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
   });
});

req.write(JSON.stringify({
    origin: {
       name: "Raymundo Salazar",
       company: "Example Company",
       email: "[email protected]",
       phone: "81818181",
       street: "Av Vasconcelos",
       number: "1400",
       district: "Palo Blanco",
       city: "Monterrey",
       state: "NL",
       country: "MX",
       postalCode: "66236"
    },
    destination: {
       name: "Gina Colin",
       company: "Example Company",
       email: "[email protected]",
       phone: "8181818181",
       street: "Av Vasconcelos",
       number: "1400",
       district: "Palo Blanco",
       city: "Monterrey",
       state: "NL",
       country: "MX",
       postalCode: "66240"
    },
    package: {
       content: "jewels",
       amount: 1,
       type: "box",
       dimensions: {
          length: 17,
          width: 13,
          height: 8
       },
       weight: 3,
       insurance: 0,
       declaredValue: 0
    },
    shipment: {
       carrier: "estafeta"
    }
}));
req.end();
                                       
                                    
Configuración Go de Ejemplo
                                       
package main

import (
   "fmt"
   "strings"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://api.envia.com/ship/rate/"

   payload := strings.NewReader("{\n
       \"origin\": {\n
          \"name\": \"Raymundo Salazar\",\n
          \"company\": \"Example Company\",\n
          \"email\": \"[email protected]\",\n
          \"phone\": \"81818181\",\n
          \"street\": \"Av Vasconcelos\",\n
          \"number\": \"1400\",\n
          \"district\": \"Palo Blanco\",\n
          \"city\": \"Monterrey\",\n
          \"state\": \"NL\",\n
          \"country\": \"MX\",\n
          \"postalCode\": \"66236\"\n
       },\n
       \"destination\": {\n
          \"name\": \"Gina Colin\",\n
          \"company\": \"Example Company\",\n
          \"email\": \"[email protected]\",\n
          \"phone\": \"8181818181\",\n
          \"street\": \"Av Vasconcelos\",\n
          \"number\": \"1400\",\n
          \"district\": \"Palo Blanco\",\n
          \"city\": \"Monterrey\",\n
          \"state\": \"NL\",\n
          \"country\": \"MX\",\n
          \"postalCode\": \"66240\"\n
       },\n
       \"package\": {\n
          \"content\": \"jewels\",\n
          \"amount\": 1,\n
          \"type\": \"box\",\n
          \"dimensions\": {\n
             \"length\": 17,\n
             \"width\": 13,\n
             \"height\": 8\n
          },\n
          \"weight\": 3,\n
          \"insurance\": 0,\n
          \"declaredValue\": 0\n
       },\n
       \"shipment\": {\n
          \"carrier\": \"estafeta\"\n
       }\n
   }")

   req, _ := http.NewRequest("POST", url, payload)

   req.Header.Add("Authorization", "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=")
   req.Header.Add("Content-Type", "application/json")

   res, _ := http.DefaultClient.Do(req)

   defer res.Body.Close()
   body, _ := ioutil.ReadAll(res.Body)

   fmt.Println(res)
   fmt.Println(string(body))

}
                                       
                                    
JSON respuesta ejemplo:
                                    
{
   "meta":"rate",
   "data":[
      {
         "carrier":"estafeta",
         "service":"express",
         "deliveryEstimate":"Entrega d\u00eda siguiente",
         "basePrice":209,
         "extendedFare":0,
         "insurance":0,
         "totalPrice":209,
         "currency":"MXN"
      },
      {
         "carrier":"estafeta",
         "service":"ground",
         "deliveryEstimate":"Entrega 2-5 d\u00edas",
         "basePrice":129,
         "extendedFare":0,
         "insurance":0,
         "totalPrice":129,
         "currency":"MXN"
      }
   ]
}
                                    
                                 

POST Generar

https://api.envia.com/ship/generate/
Headers
Authorization
Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=
Content-type
application/json
Body (raw)
{ "origin": { "name": "Raymundo Salazar", "company": "Example Company", "email": "[email protected]", "phone": "81818181", "street": "Av Vasconcelos", "number": "1400", "district": "Palo Blanco", "city": "Monterrey", "state": "NL", "country": "MX", "postalCode": "66236" }, "destination": { "name": "Gina Colin", "company": "Example Company", "email": "[email protected]", "phone": "8181818181", "street": "Av Vasconcelos", "number": "1400", "district": "Palo Blanco", "city": "Monterrey", "state": "NL", "country": "MX", "postalCode": "66240" }, "package": { "content": "jewels", "amount": 1, "type": "box", "dimensions": { "length": 17, "width": 13, "height": 8 }, "weight": 3, "insurance": 0, "declaredValue": 0 }, "shipment": { "carrier": "estafeta", "service": "express" }, "settings": { "currency": "MXN", "labelFormat": "PDF", "labelSize": "PAPER_7X4.75" } }

Propiedades de Llamada

Atributo Tipo Descripción Opciones
origin array
origin name string Nombre de la Persona que envía.
origin company string Nombre de la Compañía de quién envía.
origin email string Correo Electrónico de la Persona que envía.
origin phone string Teléfono de la Persona que envía.
origin street string Dirección. Calle de quién envía.
origin number string Dirección. Número exterior de quién envía.
origin district string Dirección. Distrito de quién envía.
origin city string Dirección. Ciudad de quién envía.
origin state string Dirección. Estado de quién envía.
origin country string Dirección. Pais de quién envía.
origin postalCode string Dirección. Código Postal de quién envía.
destination array
destination name string Nombre de la Persona que recibe.
destination company string Nombre de la Compañía de quién recibe.
destination email string Correo Electrónico de la Persona que recibe.
destination phone string Teléfono de la Persona que recibe.
destination street string Dirección. Calle de quién recibe.
destination number string Dirección. Número exterior de quién recibe.
destination district string Dirección. Distrito de quién recibe.
destination city string Dirección. Ciudad de quién recibe.
destination state string Dirección. Estado de quién recibe.
destination country string Dirección. Pais de quién recibe.
destination postalCode string Dirección. Código Postal de quién recibe.
package array
package content string Descripción del contenido del paquete.
package amount integer Cantidad de guias a generar.
package type string Tipo del paquete a enviar. box
pallet
package dimensions array Dimensiones del paquete a enviar.
package dimensions length integer Largo.
package dimensions width integer Ancho.
package dimensions height integer Alto.
package weight integer Peso del paquete a enviar.
package insurance integer Monto del Seguro del Paquete.
package declaredValue integer Monto del valor agregado.
shipment array
shipment carrier string Paquetería a asignar. carssa
dhl
estafeta
fedex
ivoy
noventa9minutos
paquetexpress
quiken
redpack
sendex
ups
shipment service string Servicio a Seleccionar. CARSSA
- ground
DHL
- express
- ground
ESTAFETA
- express
- ground
FEDEX
- express
- ground
- guaranteed
IVOY
99 MINUTOS
- same_day_mini
- same_day_99
- same_day_bike
PAQUETE EXPRESS
- ground
QUICKEN
- next_day_bike
- next_day_car
- next_day_trailer
REDPACK
- express
- ground
SENDEX
- ground
UPS
- saver
shipment customKey array Arreglo con las Llaves Personalizadas de la Paquetería. Revisar Documentación.
settings array OPCIONAL
settings currency string Tipo de Cambio de Moneda.
settings labelFormat string Formato de Etiqueta. PDF
PNG
ZPLII
settings labelSize string Tamaño de Impresión. PDF => PAPER_7X4.75
PNG => PAPER_7X4.75
ZPLII => STOCK_4X6

Propiedades de Respuesta

Atributo Tipo Descripción
meta string Acción realizada.
data array Arreglo con la información de la guía creada.
data carrier string Nombre de la paquetería seleccionada.
data service string Tipo de Servicio seleccionado.
data trackingNumber string Número de Referencia del envío.
data label integer Etiqueta para impresión.
data currentBalance integer Valor actual total del envío.
data currency string Tipo de Cambio de Moneda.
Configuración cURL de Ejemplo
                                    
curl --request POST \
--url https://api.envia.com/ship/generate/ \
--header 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=' \
--header 'Content-Type: application/json' \
--data '{
    "origin": {
       "name": "Raymundo Salazar",
       "company": "Example Company",
       "email": "[email protected]",
       "phone": "81818181",
       "street": "Av Vasconcelos",
       "number": "1400",
       "district": "Palo Blanco",
       "city": "Monterrey",
       "state": "NL",
       "country": "MX",
       "postalCode": "66236"
    },
    "destination": {
       "name": "Gina Colin",
       "company": "Example Company",
       "email": "[email protected]",
       "phone": "8181818181",
       "street": "Av Vasconcelos",
       "number": "1400",
       "district": "Palo Blanco",
       "city": "Monterrey",
       "state": "NL",
       "country": "MX",
       "postalCode": "66240"
    },
    "package": {
       "content": "jewels",
       "amount": 1,
       "type": "box",
       "dimensions": {
          "length": 17,
          "width": 13,
          "height": 8
       },
       "weight": 3,
       "insurance": 0,
       "declaredValue": 0
    },
       "shipment": {
       "carrier": "fedex"
       "service": "express"
    },
    "settings": {
       "currency": "MXN",
       "labelFormat": "PDF",
       "labelSize": "PAPER_7X4.75"
    }
}'
                                    
                                 
Configuración Ruby de Ejemplo
                                       
require 'uri'
require 'net/http'

url = URI("https://api.envia.com/ship/generate/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM='
request["Content-Type"] = 'application/json'
request.body = "{\n
    \"origin\": {\n
       \"name\": \"Raymundo Salazar\",\n
       \"company\": \"Example Company\",\n
       \"email\": \"[email protected]\",\n
       \"phone\": \"81818181\",\n
       \"street\": \"Av Vasconcelos\",\n
       \"number\": \"1400\",\n
       \"district\": \"Palo Blanco\",\n
       \"city\": \"Monterrey\",\n
       \"state\": \"NL\",\n
       \"country\": \"MX\",\n
       \"postalCode\": \"66236\"\n
    },\n
    \"destination\": {\n
       \"name\": \"Gina Colin\",\n
       \"company\": \"Example Company\",\n
       \"email\": \"[email protected]\",\n
       \"phone\": \"8181818181\",\n
       \"street\": \"Av Vasconcelos\",\n
       \"number\": \"1400\",\n
       \"district\": \"Palo Blanco\",\n
       \"city\": \"Monterrey\",\n
       \"state\": \"NL\",\n
       \"country\": \"MX\",\n
       \"postalCode\": \"66240\"\n
    },\n
    \"package\": {\n
       \"content\": \"jewels\",\n
       \"amount\": 1,\n
       \"type\": \"box\",\n
       \"dimensions\": {\n
          \"length\": 17,\n
          \"width\": 13,\n
          \"height\": 8\n
       },\n
       \"weight\": 3,\n
       \"insurance\": 0,\n
       \"declaredValue\": 0\n
    },\n
    \"shipment\": {\n
       \"carrier\": \"estafeta\"\n,
       \"service\": \"express\"\n
    },\n
    \"settings\": {\n
       \"currency\": \"MXN\"\n,
       \"labelFormat\": \"PDF\"\n,
       \"labelSize\": \"PAPER_7X4.75\"\n
    }\n
}"

response = http.request(request)
puts response.read_body
                                       
                                    
Configuración Python de Ejemplo
                                       
import requests

url = "https://api.envia.com/ship/generate/"

payload = "{\n
  \"origin\": {\n
     \"name\": \"Raymundo Salazar\",\n
     \"company\": \"Example Company\",\n
     \"email\": \"[email protected]\",\n
     \"phone\": \"81818181\",\n
     \"street\": \"Av Vasconcelos\",\n
     \"number\": \"1400\",\n
     \"district\": \"Palo Blanco\",\n
     \"city\": \"Monterrey\",\n
     \"state\": \"NL\",\n
     \"country\": \"MX\",\n
     \"postalCode\": \"66236\"\n
  },\n
  \"destination\": {\n
     \"name\": \"Gina Colin\",\n
     \"company\": \"Example Company\",\n
     \"email\": \"[email protected]\",\n
     \"phone\": \"8181818181\",\n
     \"street\": \"Av Vasconcelos\",\n
     \"number\": \"1400\",\n
     \"district\": \"Palo Blanco\",\n
     \"city\": \"Monterrey\",\n
     \"state\": \"NL\",\n
     \"country\": \"MX\",\n
     \"postalCode\": \"66240\"\n
  },\n
  \"package\": {\n
     \"content\": \"jewels\",\n
     \"amount\": 1,\n
     \"type\": \"box\",\n
     \"dimensions\": {\n
        \"length\": 17,\n
        \"width\": 13,\n
        \"height\": 8\n
     },\n
     \"weight\": 3,\n
     \"insurance\": 0,\n
     \"declaredValue\": 0\n
  },\n
  \"shipment\": {\n
     \"carrier\": \"estafeta\"\n,
     \"service\": \"express\"\n
  },\n
  \"settings\": {\n
     \"currency\": \"MXN\"\n,
     \"labelFormat\": \"PDF\"\n,
     \"labelSize\": \"PAPER_7X4.75\"\n
  }\n
}"

headers = {
   'Authorization': "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
   'Content-Type': "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
                                    
                                 
Configuración PHP de Ejemplo
                                       
public function generate(){
   $url = "https://api.envia.com/ship/generate/";
   $username = "[email protected]";
   $password = "123456";

   $data = [
    "origin": array(
       "name": "Agnes Salazar",
       "company": "Testing CO",
       "email": "[email protected]",
       "phone": "8111111111",
       "street": "av vasconcelos",
       "number": "1400",
       "district": "palo blanco",
       "city": "Monterrey",
       "state": NL",
       "country": "MX",
       "postalCode": "66236"
    ),
    "destination": array(
       "name": "tester",
       "company": "Testing CO",
       "email": "[email protected]",
       "phone": "8111111111",
       "street": "av vasconcelos",
       "number": "1400",
       "district": "palo blanco",
       "city": "Monterrey",
       "state": "NL",
       "country": "MX",
       "postalCode": "66240"
    ),
    "package": array(
       "content": "jewels",
       "amount": 1,
       "type": "box",
       "dimensions": array(
          "length": 17,
          "width": 13,
          "height": 8
       ),
       "weight": 3,
       "insurance": 0,
       "declaredValue": 0
    ),
    "shipment": array(
       "carrier": "estafeta",
       "service": "express"
    ),
    "settings": array(
       "currency": "MXN",
       "labelFormat": "PDF",
       "labelSize": "PAPER_7X4.75"
    )
   ];

   $options = array(
      'http' => array(
         'header' => [
            "Content-Type: application/json",
            "Authorization: Basic ".base64_encode("$username:$password")
         ],
         'method' => "POST",
         'content' => json_encode($data)
      ),
      "ssl" => array(
         "verify_peer" => false,
         "verify_peer_name" => false,
      )
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
}
                                    
                                 
Configuración Java de Ejemplo
No data
Configuración Node de Ejemplo
                                       
var http = require("http");
var options = {
   "method": "POST",
   "hostname": [
      "api.envia.com"
   ],
   "path": [
      "ship",
      "generate"
   ],
   "headers": {
      "Authorization": "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
      "Content-Type": "application/json"
   }
};

var req = http.request(options, function (res) {
   var chunks = [];

   res.on("data", function (chunk) {
      chunks.push(chunk);
   });

   res.on("end", function () {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
   });
});

req.write(JSON.stringify({
   origin: {
      name: "Raymundo Salazar",
      company: "Example Company",
      email: "[email protected]",
      phone: "81818181",
      street: "Av Vasconcelos",
      number: "1400",
      district: "Palo Blanco",
      city: "Monterrey",
      state: "NL",
      country: "MX",
      postalCode: "66236"
   },
   destination: {
      name: "Gina Colin",
      company: "Example Company",
      email: "[email protected]",
      phone: "8181818181",
      street: "Av Vasconcelos",
      number: "1400",
      district: "Palo Blanco",
      city: "Monterrey",
      state: "NL",
      country: "MX",
      postalCode: "66240"
   },
   package: {
      content: "jewels",
      amount: 1,
      type: "box",
      dimensions: {
         length: 17,
         width: 13,
         height: 8
      },
      weight: 3,
      insurance: 0,
      declaredValue: 0
   },
   shipment: {
      carrier: "estafeta",
      service: "express"
   },
   settings: {
      currency: "MXN",
      labelFormat: "PDF",
      labelSize: "PAPER_7X4.75"
   }
}));
req.end();
                                       
                                    
Configuración Go de Ejemplo
                                       
package main

import (
   "fmt"
   "strings"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://api.envia.com/ship/generate/"

   payload := strings.NewReader("{\n
      \"origin\": {\n
         \"name\": \"Raymundo Salazar\",\n
         \"company\": \"Example Company\",\n
         \"email\": \"[email protected]\",\n
         \"phone\": \"81818181\",\n
         \"street\": \"Av Vasconcelos\",\n
         \"number\": \"1400\",\n
         \"district\": \"Palo Blanco\",\n
         \"city\": \"Monterrey\",\n
         \"state\": \"NL\",\n
         \"country\": \"MX\",\n
         \"postalCode\": \"66236\"\n
      },\n
      \"destination\": {\n
         \"name\": \"Gina Colin\",\n
         \"company\": \"Example Company\",\n
         \"email\": \"[email protected]\",\n
         \"phone\": \"8181818181\",\n
         \"street\": \"Av Vasconcelos\",\n
         \"number\": \"1400\",\n
         \"district\": \"Palo Blanco\",\n
         \"city\": \"Monterrey\",\n
         \"state\": \"NL\",\n
         \"country\": \"MX\",\n
         \"postalCode\": \"66240\"\n
      },\n
      \"package\": {\n
         \"content\": \"jewels\",\n
         \"amount\": 1,\n
         \"type\": \"box\",\n
         \"dimensions\": {\n
            \"length\": 17,\n
            \"width\": 13,\n
            \"height\": 8\n
         },\n
         \"weight\": 3,\n
         \"insurance\": 0,\n
         \"declaredValue\": 0\n
      },\n
      \"shipment\": {\n
         \"carrier\": \"estafeta\"\n,
         \"service\": \"express\"\n
      },\n
      \"settings\": {\n
         \"currency\": \"MXN\"\n,
         \"labelFormat\": \"PDF\"\n,
         \"labelSize\": \"PAPER_7X4.75\"\n
      }\n
   }")

   req, _ := http.NewRequest("POST", url, payload)

   req.Header.Add("Authorization", "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=")
   req.Header.Add("Content-Type", "application/json")

   res, _ := http.DefaultClient.Do(req)

   defer res.Body.Close()
   body, _ := ioutil.ReadAll(res.Body)

   fmt.Println(res)
   fmt.Println(string(body))

}
                                       
                                    
JSON respuesta ejemplo:
                                    
{
   "meta":"generate",
   "data":[
      {
         "carrier":"estafeta",
         "service":"ground",
         "trackingNumber":"9050000000130700416191",
         "label":"https://s3.us-east-2.amazonaws.com/envia-staging/uploads/estafeta/9050000000130700416191_estafeta.pdf",
         "currentBalance":1443.1364692500001,
         "currency":"MXN"
      }
   ]
}
                                    
                                 

POST Cancelar

https://api.envia.com/ship/cancel/
Headers
Authorization
Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=
Content-type
application/json
Body (raw)
{ "carrier": "estafeta", "trackingNumber": "9050000000130700416191" }

Propiedades de Llamada

Atributo Tipo Descripción Opciones
carrier array Paquetería a asignar. carssa
dhl
estafeta
fedex
ivoy
noventa9minutos
paquetexpress
quiken
redpack
sendex
ups
trackingNumber string Número de Referencia del envío.
shipment array
shipment customKey array Arreglo con las Llaves Personalizadas de la Paquetería. Revisar Documentación.

Propiedades de Respuesta

Atributo Tipo Descripción
meta string Array
data array Array
data carrier string Array
data service string Array
data trackingNumber string Array
Configuración cURL de Ejemplo
                                    
curl --request POST \
--url https://api.envia.com/ship/cancel/ \
--header 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=' \
--header 'Content-Type: application/json' \
--data '{
   "carrier": "estafeta",
   "trackingNumber": "9050000000130700416191",
}'
                                    
                                 
Configuración Ruby de Ejemplo
                                       
require 'uri'
require 'net/http'

url = URI("https://api.envia.com/ship/cancel/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM='
request["Content-Type"] = 'application/json'
request.body = "{\n
   \"carrier\": \"estafeta\",\n
   \"trackingNumber\": \"9050000000130700416191\",\n
}"

response = http.request(request)
puts response.read_body
                                       
                                    
Configuración Python de Ejemplo
                                       
import requests

url = "https://api.envia.com/ship/cancel/"

payload = "{\n
   \"carrier\": \"estafeta\",\n
   \"trackingNumber\": \"9050000000130700416191\",\n
}"

headers = {
   'Authorization': "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
   'Content-Type': "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
                                    
                                 
Configuración PHP de Ejemplo
                                       
public function cancel(){
   $url = "https://api.envia.com/ship/cancel/";
   $username = "[email protected]";
   $password = "123456";

   $data = [
      "carrier": "estafeta",
      "trackingNumber": "9050000000130700416191"
   ];

   $options = array(
      'http' => array(
         'header' => [
            "Content-Type: application/json",
            "Authorization: Basic ".base64_encode("$username:$password")
         ],
         'method' => "POST",
         'content' => json_encode($data)
      ),
      "ssl" => array(
         "verify_peer" => false,
         "verify_peer_name" => false,
      )
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
}
                                    
                                 
Configuración Java de Ejemplo
No data
Configuración Node de Ejemplo
                                       
var http = require("http");
var options = {
   "method": "POST",
   "hostname": [
      "api.envia.com"
   ],
   "path": [
      "ship",
      "cancel"
   ],
   "headers": {
      "Authorization": "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
      "Content-Type": "application/json"
   }
};

var req = http.request(options, function (res) {
   var chunks = [];

   res.on("data", function (chunk) {
      chunks.push(chunk);
   });

   res.on("end", function () {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
   });
});

req.write(JSON.stringify({
   carrier: "estafeta",
   trackingNumber: "9050000000130700416191"
}));
req.end();
                                       
                                    
Configuración Go de Ejemplo
                                       
package main

import (
   "fmt"
   "strings"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://api.envia.com/ship/cancel/"

   payload := strings.NewReader("{\n
      \"carrier\": \"estafeta\",\n
      \"trackingNumber\": \"9050000000130700416191\",\n
   }")

   req, _ := http.NewRequest("POST", url, payload)

   req.Header.Add("Authorization", "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=")
   req.Header.Add("Content-Type", "application/json")

   res, _ := http.DefaultClient.Do(req)

   defer res.Body.Close()
   body, _ := ioutil.ReadAll(res.Body)

   fmt.Println(res)
   fmt.Println(string(body))

}
                                       
                                    
JSON respuesta ejemplo:
                                    
{
   "meta":"cancel",
   "data":[
      {
         "carrier":"estafeta",
         "service":"ground",
         "trackingNumber":"9050000000130700416191"
      }
   ]
}
                                    
                                 

POST Recolectar

https://api.envia.com/ship/pickup/
Headers
Authorization
Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=
Content-type
application/json
Body (raw)
{ "origin":{ "name":"Raymundo Salazar", "company":"Example Company", "email":"[email protected]", "phone":"81818181", "street": "Av Vasconcelos", "number": "1400", "district": "Palo Blanco", "city": "Monterrey", "state": "NL", "country": "MX", "postalCode": "66236" }, "package":{ "content":"jewels", "amount":2, "type":"box", "dimensions":{ "length":1, "width":1, "height":1 }, "weight":2, "insurance":0, "declaredValue":0 }, "shipment":{ "carrier":"estafeta", "pickup":{ "timeFrom":12, "timeTo":15, "date":"2018-08-21", "instructions":"Hola", "totalPackages":"2", "totalWeight":"2" }, "settings":{ "currency":"MXN", "labelFormat":"pdf" } } }

Propiedades de Llamada

Atributo Tipo Descripción Opciones
origin array
origin name string Nombre de la Persona que envía.
origin company string Nombre de la Compañía de quién envía.
origin email string Correo Electrónico de la Persona que envía.
origin phone string Teléfono de la Persona que envía.
origin street string Dirección. Calle de quién envía.
origin number string Dirección. Número exterior de quién envía.
origin district string Dirección. Distrito de quién envía.
origin city string Dirección. Ciudad de quién envía.
origin state string Dirección. Estado de quién envía.
origin country string Dirección. Pais de quién envía.
origin postalCode string Dirección. Código Postal de quién envía.
package array
package content string Descripción del contenido del paquete.
package amount integer Cantidad de guias a generar.
package type string Tipo del paquete a enviar. box
pallet
package dimensions array Dimensiones del paquete a enviar.
dimensions length integer Largo.
dimensions width integer Ancho.
dimensions height integer Alto.
package weight integer Peso del paquete a enviar.
package insurance integer Monto del Seguro del Paquete.
package declaredValue integer Monto del valor agregado.
shipment array
shipment carrier string Paquetería a asignar. carssa
dhl
estafeta
fedex
ivoy
noventa9minutos
paquetexpress
quiken
redpack
sendex
ups
shipment pickup array Información sobre la recolección.
pickup timeFrom integer Información sobre la recolección.
pickup timeTo integer Información sobre la recolección.
pickup date string Fecha de la recolección.
pickup instructions string Instrucciones para la recolección.
pickup totalPackages string Cantidad de Paquetes.
pickup totalWeight string Total de Peso.
shipment customKey array Arreglo con las Llaves Personalizadas de la Paquetería. Revisar Documentación.
shipment settings array OPCIONAL
settings currency string Tipo de Cambio de Moneda.
settings labelFormat string Formato de Etiqueta.

Propiedades de Respuesta

Atributo Tipo Descripción
meta string Acción realizada.
data array Arreglo con la información de la guía creada.
data carrier string Nombre de la paquetería seleccionada.
data service string Tipo de Servicio seleccionado.
data trackingNumber string Número de Referencia del envío.
Configuración cURL de Ejemplo
                                    
curl --request POST \
--url https://api.envia.com/ship/pickup/ \
--header 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=' \
--header 'Content-Type: application/json' \
--data '{
   "origin":{
      "name":"Raymundo Salazar",
      "company":"Example Company",
      "email":"[email protected]",
      "phone":"81818181",
      "street": "Av Vasconcelos",
      "number": "1400",
      "district": "Palo Blanco",
      "city": "Monterrey",
      "state": "NL",
      "country": "MX",
      "postalCode": "66236"
   },
   "package":{
      "content":"jewels",
      "amount":2,
      "type":"box",
      "dimensions":{
         "length":1,
         "width":1,
         "height":1
      },
      "weight":2,
      "insurance":0,
      "declaredValue":0
   },
   "shipment":{
      "carrier":"estafeta",
      "pickup":{
         "timeFrom":12,
         "timeTo":15,
         "date":"2018-08-21",
         "instructions":"Hola",
         "totalPackages":"2",
         "totalWeight":"2"
      },
      "settings":{
         "currency":"MXN",
         "labelFormat":"pdf"
      }
   }
}'
                                    
                                 
Configuración Ruby de Ejemplo
                                       
require 'uri'
require 'net/http'

url = URI("https://api.envia.com/ship/pickup/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM='
request["Content-Type"] = 'application/json'
request.body = "{\n
   \"origin\":{\n
      \"name\":\"Raymundo Salazar\",\n
      \"company\":\"Example Company\",\n
      \"email\":\"[email protected]\",\n
      \"phone\":\"81818181\",\n
      \"street\": \"Av Vasconcelos\",\n
      \"number\": \"1400\",\n
      \"district\": \"Palo Blanco\",\n
      \"city\": \"Monterrey\",\n
      \"state\": \"NL\",\n
      \"country\": \"MX\",\n
      \"postalCode\": \"66236\"\n
   },\n
   \"package\":{\n
      \"content\":\"jewels\",\n
      \"amount\":2,\n
      \"type\":\"box\",\n
      \"dimensions\":{\n
         \"length\":1,\n
         \"width\":1,\n
         \"height\":1\n
      },\n
      \"weight\":2,\n
      \"insurance\":0,\n
      \"declaredValue\":0\n
   },\n
   \"shipment\":{\n
      \"carrier\":\"estafeta\",\n
      \"pickup\":{\n
         \"timeFrom\":12,\n
         \"timeTo\":15,\n
         \"date\":\"2018-08-21\",\n
         \"instructions\":\"Hola\",\n
         \"totalPackages\":\"2\",\n
         \"totalWeight\":\"2\"\n
      },\n
      \"settings\":{\n
         \"currency\":\"MXN\",\n
         \"labelFormat\":\"pdf\"\n
      }\n
   }\n
}"

response = http.request(request)
puts response.read_body
                                       
                                    
Configuración Python de Ejemplo
                                       
import requests

url = "https://api.envia.com/ship/pickup/"

payload = "{\n
   \"origin\":{\n
      \"name\":\"Raymundo Salazar\",\n
      \"company\":\"Example Company\",\n
      \"email\":\"[email protected]\",\n
      \"phone\":\"81818181\",\n
      \"street\": \"Av Vasconcelos\",\n
      \"number\": \"1400\",\n
      \"district\": \"Palo Blanco\",\n
      \"city\": \"Monterrey\",\n
      \"state\": \"NL\",\n
      \"country\": \"MX\",\n
      \"postalCode\": \"66236\"\n
   },\n
   \"package\":{\n
      \"content\":\"jewels\",\n
      \"amount\":2,\n
      \"type\":\"box\",\n
      \"dimensions\":{\n
         \"length\":1,\n
         \"width\":1,\n
         \"height\":1\n
      },\n
      \"weight\":2,\n
      \"insurance\":0,\n
      \"declaredValue\":0\n
   },\n
   \"shipment\":{\n
      \"carrier\":\"estafeta\",\n
      \"pickup\":{\n
         \"timeFrom\":12,\n
         \"timeTo\":15,\n
         \"date\":\"2018-08-21\",\n
         \"instructions\":\"Hola\",\n
         \"totalPackages\":\"2\",\n
         \"totalWeight\":\"2\"\n
      },\n
      \"settings\":{\n
         \"currency\":\"MXN\",\n
         \"labelFormat\":\"pdf\"\n
      }\n
   }\n
}"

headers = {
   'Authorization': "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
   'Content-Type': "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
                                    
                                 
Configuración PHP de Ejemplo
                                       
public function pickup(){
   $url = "https://api.envia.com/ship/pickup/";
   $username = "[email protected]";
   $password = "123456";

   $data = [
      "origin"=>array(
         "name" => "Raymundo Salazar",
         "company" => "Example Company",
         "email" => "[email protected]",
         "phone" => "81818181",
         "street" =>  "Av Vasconcelos",
         "number" =>  "1400",
         "district" =>  "Palo Blanco",
         "city" =>  "Monterrey",
         "state" =>  "NL",
         "country" =>  "MX",
         "postalCode" =>  "66236"
      ),
      "package" => array(
         "content" => "jewels",
         "amount" => 2,
         "type" => "box",
         "dimensions"=>array(
            "length" => 1,
            "width" => 1,
            "height" => 1
         ),
         "weight" => 2,
         "insurance" => 0,
         "declaredValue" => 0
      ),
      "shipment" => array(
         "carrier" => "estafeta",
         "pickup" => array(
            "timeFrom" => 12,
            "timeTo" => 15,
            "date" => "2018-08-21",
            "instructions" => "Hola",
            "totalPackages" => "2",
            "totalWeight" => "2"
         ),
         "settings" => array(
            "currency" => "MXN",
            "labelFormat" => "pdf"
         )
      )
   ];

   $options = array(
      'http' => array(
         'header' => [
            "Content-Type: application/json",
            "Authorization: Basic ".base64_encode("$username:$password")
         ],
         'method' => "POST",
         'content' => json_encode($data)
      ),
      "ssl" => array(
         "verify_peer" => false,
         "verify_peer_name" => false,
      )
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
}
                                    
                                 
Configuración Java de Ejemplo
No data
Configuración Node de Ejemplo
                                       
var http = require("http");
var options = {
   "method": "POST",
   "hostname": [
      "api.envia.com"
   ],
   "path": [
      "ship",
      "pickup"
   ],
   "headers": {
      "Authorization": "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
      "Content-Type": "application/json"
   }
};

var req = http.request(options, function (res) {
   var chunks = [];

   res.on("data", function (chunk) {
      chunks.push(chunk);
   });

   res.on("end", function () {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
   });
});

req.write(JSON.stringify({
   origin:{
      name:"Raymundo Salazar",
      company:"Example Company",
      email:"[email protected]",
      phone:"81818181",
      street: "Av Vasconcelos",
      number: "1400",
      district: "Palo Blanco",
      city: "Monterrey",
      state: "NL",
      country: "MX",
      postalCode: "66236"
   },
   package:{
      content:"jewels",
      amount:2,
      type:"box",
      dimensions:{
         length:1,
         width:1,
         height:1
      },
      weight:2,
      insurance:0,
      declaredValue:0
   },
   shipment:{
      carrier:"estafeta",
      pickup:{
         timeFrom:12,
         timeTo:15,
         date:"2018-08-21",
         instructions:"Hola",
         totalPackages:"2",
         totalWeight:"2"
      },
      settings:{
         currency:"MXN",
         labelFormat:"pdf"
      }
   }
}));
req.end();
                                       
                                    
Configuración Go de Ejemplo
                                       
package main

import (
   "fmt"
   "strings"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://api.envia.com/ship/pickup/"

   payload := strings.NewReader("{\n
      \"origin\":{\n
         \"name\":\"Raymundo Salazar\",\n
         \"company\":\"Example Company\",\n
         \"email\":\"[email protected]\",\n
         \"phone\":\"81818181\",\n
         \"street\": \"Av Vasconcelos\",\n
         \"number\": \"1400\",\n
         \"district\": \"Palo Blanco\",\n
         \"city\": \"Monterrey\",\n
         \"state\": \"NL\",\n
         \"country\": \"MX\",\n
         \"postalCode\": \"66236\"\n
      },\n
      \"package\":{\n
         \"content\":\"jewels\",\n
         \"amount\":2,\n
         \"type\":\"box\",\n
         \"dimensions\":{\n
            \"length\":1,\n
            \"width\":1,\n
            \"height\":1\n
         },\n
         \"weight\":2,\n
         \"insurance\":0,\n
         \"declaredValue\":0\n
      },\n
      \"shipment\":{\n
         \"carrier\":\"estafeta\",\n
         \"pickup\":{\n
            \"timeFrom\":12,\n
            \"timeTo\":15,\n
            \"date\":\"2018-08-21\",\n
            \"instructions\":\"Hola\",\n
            \"totalPackages\":\"2\",\n
            \"totalWeight\":\"2\"\n
         },\n
         \"settings\":{\n
            \"currency\":\"MXN\",\n
            \"labelFormat\":\"pdf\"\n
         }\n
      }\n
   }")

   req, _ := http.NewRequest("POST", url, payload)

   req.Header.Add("Authorization", "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=")
   req.Header.Add("Content-Type", "application/json")

   res, _ := http.DefaultClient.Do(req)

   defer res.Body.Close()
   body, _ := ioutil.ReadAll(res.Body)

   fmt.Println(res)
   fmt.Println(string(body))

}
                                       
                                    
JSON respuesta ejemplo:
                                    
{
    "meta": "pickup",
    "data": [
        {
            "carrier": "fedex",
            "origin": {
                "name": "Raymundo Salazar",
                "company": "Example Company",
                "email": "[email protected]",
                "phone": "[email protected]",
                "street": "Av vasconcelos",
                "number": "1400",
                "district": "Palo blanco",
                "city": "San Pedro Garza Garcia",
                "state": "NL",
                "country": "MX",
                "postalCode": "66240"
            },
            "pickupNumber": "484",
            "pickupDate": "2018-08-21",
            "pickupTimeFrom": "12",
            "pickupTimeTo": "15"
        }
    ]
}
                                    
                                 

POST Rastreo General

https://api.envia.com/ship/generaltrack/
Headers
Authorization
Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=
Content-type
application/json
Body (raw)
{ "trackingNumbers":["438471", "1538417633", "MEXMTY18105030371P", "0050000000130700419175", "4212088425"] }

Propiedades de Llamada

Atributo Tipo Descripción Opciones
trackingNumbers array Lista de Números de Referencia.

Propiedades de Respuesta

Atributo Tipo Descripción
meta string Acción realizada.
data array Arreglo con la información de la guía creada.
data carrier string Nombre de la paquetería seleccionada.
data service string Tipo de Servicio seleccionado.
data country string Codigo del país de la paqueteria.
data trackingNumber string Número de Referencia del envío.
data trackUrl string Url de rastreo del envío.
data status string Estatus de la guía de rastreo.
Configuración cURL de Ejemplo
                                    
                                       curl --request POST \
                                       --url https://api.envia.com/ship/pickup/ \
                                       --header 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=' \
                                       --header 'Content-Type: application/json' \
                                       --data '{
                                          "trackingNumbers":[
                                             "438471",
                                             "1538417633",
                                             "MEXMTY18105030371P",
                                             "0050000000130700419175",
                                             "4212088425"
                                          ]
                                       }'
                                    
                                 
Configuración Ruby de Ejemplo
                                       
                                          require 'uri'
                                          require 'net/http'

                                          url = URI("https://api.envia.com/ship/pickup/")

                                          http = Net::HTTP.new(url.host, url.port)

                                          request = Net::HTTP::Post.new(url)
                                          request["Authorization"] = 'Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM='
                                          request["Content-Type"] = 'application/json'
                                          request.body = "{\n
                                             \"trackingNumbers\":[\n
                                                \"438471\",\n
                                                \"1538417633\",\n
                                                \"MEXMTY18105030371P\",\n
                                                \"0050000000130700419175\",\n
                                                \"4212088425\"\n
                                             ],\n
                                          }"

                                          response = http.request(request)
                                          puts response.read_body
                                       
                                    
Configuración Python de Ejemplo
                                       
                                          import requests

                                          url = "https://api.envia.com/ship/pickup/"

                                          payload = "{\n
                                             \"trackingNumbers\":[\n
                                                \"438471\",\n
                                                \"1538417633\",\n
                                                \"MEXMTY18105030371P\",\n
                                                \"0050000000130700419175\",\n
                                                \"4212088425\"\n
                                             ],\n
                                          }"

                                          headers = {
                                             'Authorization': "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
                                             'Content-Type': "application/json"
                                          }

                                          response = requests.request("POST", url, data=payload, headers=headers)

                                          print(response.text)
                                    
                                 
Configuración PHP de Ejemplo
                                       
                                          public function pickup(){
                                             $url = "https://api.envia.com/ship/pickup/";
                                             $username = "[email protected]";
                                             $password = "123456";

                                             $data = [
                                                "trackingNumbers"=>array(
                                                   "438471",
                                                   "1538417633",
                                                   "MEXMTY18105030371P",
                                                   "0050000000130700419175",
                                                   "4212088425"
                                                )
                                             ];

                                             $options = array(
                                                'http' => array(
                                                   'header' => [
                                                      "Content-Type: application/json",
                                                      "Authorization: Basic ".base64_encode("$username:$password")
                                                   ],
                                                   'method' => "POST",
                                                   'content' => json_encode($data)
                                                ),
                                                "ssl" => array(
                                                   "verify_peer" => false,
                                                   "verify_peer_name" => false,
                                                )
                                             );
                                             $context  = stream_context_create($options);
                                             $response = json_decode(file_get_contents($url, false, $context));
                                          }
                                    
                                 
Configuración Java de Ejemplo
No data
Configuración Node de Ejemplo
                                       
                                          var http = require("http");
                                          var options = {
                                             "method": "POST",
                                             "hostname": [
                                                "api.envia.com"
                                             ],
                                             "path": [
                                                "ship",
                                                "pickup"
                                             ],
                                             "headers": {
                                                "Authorization": "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=",
                                                "Content-Type": "application/json"
                                             }
                                          };

                                          var req = http.request(options, function (res) {
                                             var chunks = [];

                                             res.on("data", function (chunk) {
                                                chunks.push(chunk);
                                             });

                                             res.on("end", function () {
                                                var body = Buffer.concat(chunks);
                                                console.log(body.toString());
                                             });
                                          });

                                          req.write(JSON.stringify({
                                             trackingNumbers:[
                                                "438471",
                                                "1538417633",
                                                "MEXMTY18105030371P",
                                                "0050000000130700419175",
                                                "4212088425"
                                             ]
                                          }));
                                          req.end();
                                       
                                    
Configuración Go de Ejemplo
                                       
                                          package main

                                          import (
                                             "fmt"
                                             "strings"
                                             "net/http"
                                             "io/ioutil"
                                          )

                                          func main() {

                                             url := "https://api.envia.com/ship/pickup/"

                                             payload := strings.NewReader("{\n
                                                \"trackingNumbers\":[\n
                                                  \"438471\",\n
                                                  \"1538417633\",\n
                                                  \"MEXMTY18105030371P\",\n
                                                  \"0050000000130700419175\",\n
                                                  \"4212088425\"\n
                                                ],\n
                                             }")

                                             req, _ := http.NewRequest("POST", url, payload)

                                             req.Header.Add("Authorization", "Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQxMjM=")
                                             req.Header.Add("Content-Type", "application/json")

                                             res, _ := http.DefaultClient.Do(req)

                                             defer res.Body.Close()
                                             body, _ := ioutil.ReadAll(res.Body)

                                             fmt.Println(res)
                                             fmt.Println(string(body))

                                          }
                                       
                                    
JSON respuesta ejemplo:
                                    
                                       {
                                           "meta": "generaltrack",
                                           "data": [
                                               {
                                                   "carrier": "noventa9Minutos",
                                                   "service": "same_day_bike",
                                                   "country": "MX",
                                                   "trackingNumber": "438471",
                                                   "trackUrl": "http://99minutos.com/rastreo.html",
                                                   "status": "Created"
                                               },
                                               {
                                                   "carrier": "quiken",
                                                   "service": "next_day_bike",
                                                   "country": "MX",
                                                   "trackingNumber": "1538417633",
                                                   "trackUrl": null,
                                                   "status": "Created"
                                               },
                                               {
                                                   "carrier": "carssa",
                                                   "service": "ground",
                                                   "country": "MX",
                                                   "trackingNumber": "MEXMTY18105030371P",
                                                   "trackUrl": "http://www.carssa.net/php/sysguiasrastreostatusnewar.php",
                                                   "status": "Created"
                                               },
                                               {
                                                   "carrier": "estafeta",
                                                   "service": "express",
                                                   "country": "MX",
                                                   "trackingNumber": "0050000000130700419175",
                                                   "trackUrl": "http://www.estafeta.com/Rastreo/",
                                                   "status": "Created"
                                               },
                                               {
                                                   "carrier": "dhl",
                                                   "service": "ground",
                                                   "country": "MX",
                                                   "trackingNumber": "4212088425",
                                                   "trackUrl": "http://www.dhl.com/en/express/tracking.html?AWB=",
                                                   "status": "Created"
                                               }
                                           ]
                                       }
                                    
                                 

Condiciones de Paqueterías

Esta es una lista de las diferentes condiciones disponibles en nuestra API que debes tomar en cuenta a la hora programar la recolección de tu paquete.

Tipo paqueteria Descripción
pickup Fedex
  • Mismo Día: Solo esta disponible si se agenda la recoleccion antes de las 12pm y solo se puede agendar recolección de 12 a 18hr con una ventana de 3hrs.
  • Siguiente Día Solo esta disponible si se agenda un dia hábil siguiente y Solo se puede agendar recolección de 9 a 20hr con una ventana de 3hrs.
pickup Dhl
  • Mismo Día: Solo esta disponible si se agenda la recoleccion antes de las 12pm y Solo se puede agendar recolección de 12 a 18hr con una ventana de 3hrs.
  • Siguiente Día Solo esta disponible si se agenda un dia hábil siguiente y Solo se puede agendar recolección de 9 a 20hr con una ventana de 3hrs.
pickup Sendex
  • Mismo Día: Solo esta disponible si se agenda la recoleccion antes de las 12pm y Solo se puede agendar recolección de 12 a 18hr.
  • Siguiente Día Solo esta disponible si se agenda un dia hábil siguiente y Solo se puede agendar recolección de 11 a 20hr.
pickup Redpack
UPS
Carssa
Estafeta
Paquetexpress
  • Mismo Día: Solo esta disponible si se agenda la recoleccion antes de las 12pm y Solo se puede agendar recolección de 12 a 18hr.
  • Siguiente Día Solo esta disponible si se agenda un dia hábil siguiente y Solo se puede agendar recolección de 9 a 18hr.
pickup Quiken
99 Minutos
IVOY
  • Mismo Día: Solo esta disponible si se agenda la recoleccion hasta las 11am.
  • Siguiente Día Solo esta disponible si se agenda para el día hábil siguiente.
-->