### Get Communes List (JavaScript)
Source: https://developers.shipit.cl/reference/communes
Demonstrates how to fetch commune data from the Shipit API using JavaScript. This example shows setting up the request with headers for authentication and specifying the desired content type. The fetched data is typically processed further in a web application.
```javascript
// JavaScript code example for fetching communes would go here.
// This would typically involve using fetch or XMLHttpRequest
// and setting the appropriate headers as shown in other examples.
```
--------------------------------
### Shipment Creation Example (Ruby)
Source: https://developers.shipit.cl/reference/crear-una-orden
An example of how to create a shipment using the Shipit API in Ruby. This snippet demonstrates the structure of the request payload, including order details, item information, and destination addresses. It assumes the necessary API client and authentication are already set up.
```ruby
# This is a placeholder for the actual Ruby code sample.
# The original content only indicated the language and did not provide code.
# Example structure:
# require 'shipit_api'
#
# client = ShipitApi::Client.new(api_key: 'YOUR_API_KEY')
#
# shipment_data = {
# "order": {
# "company_id": 111111111111,
# "items": 2,
# "reference": "#333",
# "service": "labelling",
# "destiny": {
# "street": "apoquindo",
# "number": 55555,
# "commune_id": 308,
# "full_name": "Roberto",
# "email": "roberto@gmail.com",
# "phone": "1111111111",
# "kind": "home_delivery"
# },
# "origin": {
# "street": "Foo",
# "number": 89384,
# "commune_id": 56,
# "full_name": "predeterminado",
# "email": "esteban@gmail.com",
# "phone": 932479823
# },
# "products": [
# {
# "sku_id": 11111,
# "amount": 2,
# "warehouse_id": 1
# }
# ]
# }
# }
#
# response = client.create_shipment(shipment_data)
# puts response.body
```
--------------------------------
### Get Origins - Ruby
Source: https://developers.shipit.cl/reference/direcci%C3%B3n-de-origen
This Ruby code snippet shows how to make a GET request to the Shipit API to retrieve origin information. It utilizes the Net::HTTP library to construct the request, including setting necessary headers for authentication and content negotiation.
```ruby
require "uri"
require "net/http"
url = URI("https://api.shipit.cl/v/origins")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/vnd.shipit.v4"
request["X-Shipit-Email"] = "ACCOUNT_EMAIL"
request["X-Shipit-Access-Token"] = "ACCOUNT_TOKEN"
response = http.request(request)
puts response.read_body
```
--------------------------------
### Get Open Help Tickets (API)
Source: https://developers.shipit.cl/reference/historial-de-tickets
This snippet demonstrates how to retrieve open help tickets from the Shipit API. It requires authentication headers and specifies the desired API version. The response includes details about the tickets, such as their ID, name, message content, and timestamps. An example of a 'bad_request' error response is also provided.
```curl
curl --location --request GET 'https://api.shipit.cl/v/helps?status=open' \
--header 'Content-Type: application/json' \
--header 'Accept: application/vnd.shipit.v4' \
--header 'X-Shipit-Email: ACCOUNT_EMAIL' \
--header 'X-Shipit-Access-Token: ACCOUNT_TOKEN'
```
```ruby
require "uri"
require "net/http"
url = URI("https://api.shipit.cl/v/helps?status=open")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/vnd.shipit.v4"
request["X-Shipit-Email"] = "ACCOUNT_EMAIL"
request["X-Shipit-Access-Token"] = "ACCOUNT_TOKEN"
response = http.request(request)
puts response.read_body
```
```javascript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/vnd.shipit.v4");
myHeaders.append("X-Shipit-Email", "ACCOUNT_EMAIL");
myHeaders.append("X-Shipit-Access-Token", "ACCOUNT_TOKEN");
var raw = "";
var requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipit.cl/v/helps?status=open", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
```
```php
```
--------------------------------
### GET /v/downloads
Source: https://developers.shipit.cl/reference/consultar
Consultar las descargas disponibles con varios filtros y paginación.
```APIDOC
## GET /v/downloads
### Description
Consultar las descargas disponibles con la posibilidad de filtrar por estado y tipo, además de paginación.
### Method
GET
### Endpoint
https://api.shipit.cl/v/downloads
### Parameters
#### Header Parameters
- **Content-Type** (string) - Required - application/json
- **Accept** (string) - Required - application/vnd.shipit.v4
- **X-Shipit-Email** (string) - Required - Correo de tu cuenta
- **X-Shipit-Access-Token** (string) - Required - Token de tu cuenta
#### Query Parameters
- **status** (integer) - Required - Estado de la descarga: 0. pending, 1, init, 2. downloading, 3. success, 4. failed.
- **kind** (integer) - Required - Especifica el tipo de descarga: 0. label, 1. xlsx, 2. image, 3. docx, 4. orders, 5. manifest, 6. pdf
- **per** (integer) - Optional - Cantidad de resultado por pagina (default: 50)
- **page** (integer) - Optional - Numero de pagina que deseas consultar (default: 1)
### Response
#### Success Response (200)
- **id** (integer) - The unique identifier for the download.
- **company_id** (integer) - The identifier for the company associated with the download.
- **status** (string) - The current status of the download (e.g., "success", "pending").
- **link** (string) - The URL to access the downloaded file.
- **downloaded** (boolean) - Indicates if the file has been successfully downloaded.
- **kind** (string) - The type of the download (e.g., "label", "xlsx").
- **created_at** (string) - The timestamp when the download was created.
- **updated_at** (string) - The timestamp when the download was last updated.
#### Response Example
```json
[
{
"id": 88572,
"company_id": 1,
"status": "success",
"link": "https://shipit-avery-tickets.s3-us-west-2.amazonaws.com/client-avery/2020/6/17/Shipit.pdf",
"downloaded": true,
"kind": "label",
"created_at": "2020-06-17T12:25:35.049-04:00",
"updated_at": "2020-06-17T12:25:35.781-04:00"
}
]
```
```
--------------------------------
### Consult SKU by Name - OpenAPI Definition
Source: https://developers.shipit.cl/reference/consultar-sku-por-nombre
This OpenAPI 3.1.0 definition describes the endpoint for consulting SKUs by name. It specifies the HTTP method (GET), parameters (name, Content-Type, Accept, X-Shipit-Email, X-Shipit-Access-Token), and the structure of the successful response (200 OK) including an example JSON payload.
```json
{
"openapi": "3.1.0",
"info": {
"title": "API V4",
"version": "4"
},
"servers": [
{
"url": "https://api.shipit.cl"
}
],
"components": {
"securitySchemes": {
"sec0": {
"type": "apiKey",
"in": "header",
"name": "X-Shipit-Email"
},
"sec1": {
"type": "apiKey",
"in": "header",
"name": "X-Shipit-Access-Token"
}
}
},
"security": [
{
"sec0": [],
"sec1": []
}
],
"paths": {
"/v/fulfillment/skus/by_name?name={name}": {
"get": {
"summary": "Consultar SKU por Nombre",
"description": "",
"operationId": "consultar-sku-por-nombre",
"parameters": [
{
"name": "name",
"in": "query",
"description": "Nombre del SKU a consultar",
"schema": {
"type": "string"
}
},
{
"name": "Content-Type",
"in": "header",
"description": "application/json",
"schema": {
"type": "string"
}
},
{
"name": "Accept",
"in": "header",
"description": "application/vnd.shipit.v4",
"schema": {
"type": "string"
}
},
{
"name": "X-Shipit-Email",
"in": "header",
"description": "Correo de tu cuenta",
"schema": {
"type": "string"
}
},
{
"name": "X-Shipit-Access-Token",
"in": "header",
"description": "Token de tu cuenta",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "200",
"content": {
"application/json": {
"examples": {
"Result": {
"value": "{\n \"id\": 9265,\n \"name\": \"BOB1\",\n \"company_id\": 1,\n \"position\": null,\n \"description\": \"SKU de prueba\",\n \"created_at\": \"2018-03-15T11:01:37.739-03:00\",\n \"updated_at\": \"2018-03-15T11:01:37.739-03:00\",\n \"warehouse_id\": 1,\n \"width\": 10,\n \"length\": 10,\n \"height\": 30,\n \"weight\": 1,\n \"ws_amount\": 0,\n \"ws_updated_at\": null,\n \"amount\": 36,\n \"min_amount\": 1,\n \"stock\": {\n \"id\": 1832,\n \"received\": 0,\n \"commited\": 0,\n \"waste\": 0,\n \"canceled\": 0,\n \"available\": 36,\n \"created_at\": \"2018-05-11T19:54:36.060-03:00\",\n \"updated_at\": \"2018-05-11T19:54:36.060-03:00\",\n \"sku_id\": 9265,\n \"min_available\": 1\n }\n}"
}
},
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 9265,
"default": 0
},
"name": {
"type": "string",
"example": "BOB1"
},
"company_id": {
"type": "integer",
"example": 1,
"default": 0
},
"position": {},
"description": {
"type": "string",
"example": "SKU de prueba"
},
"created_at": {
"type": "string",
"example": "2018-03-15T11:01:37.739-03:00"
},
"updated_at": {
"type": "string",
"example": "2018-03-15T11:01:37.739-03:00"
},
"warehouse_id": {
"type": "integer",
"example": 1,
"default": 0
},
"width": {
"type": "integer",
"example": 10,
"default": 0
},
"length": {
"type": "integer",
"example": 10,
"default": 0
},
"height": {
"type": "integer",
"example": 30,
"default": 0
},
"weight": {
"type": "integer",
"example": 1,
"default": 0
},
"ws_amount": {
"type": "integer",
"example": 0,
"default": 0
},
"ws_updated_at": {},
"amount": {
"type": "integer",
"example": 36,
"default": 0
},
"min_amount": {
"type": "integer",
"example": 1,
"default": 0
},
"stock": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1832,
"default": 0
},
"received": {
"type": "integer",
"example": 0,
"default": 0
},
"commited": {
"type": "integer",
"example": 0,
"default": 0
},
"waste": {
"type": "integer",
"example": 0,
"default": 0
},
"canceled": {
"type": "integer",
"example": 0,
"default": 0
},
"available": {
"type": "integer",
"example": 36,
"default": 0
},
"created_at": {
"type": "string",
"example": "2018-05-11T19:54:36.060-03:00"
},
"updated_at": {
"type": "string",
"example": "2018-05-11T19:54:36.060-03:00"
},
"sku_id": {
"type": "integer",
"example": 9265,
"default": 0
},
"min_available": {
"type": "integer",
"example": 1,
"default": 0
}
}
}
}
}
}
}
}
}
}
}
}
}
```
--------------------------------
### GET /websites/developers_shipit_cl
Source: https://developers.shipit.cl/reference/buscar-courier-por-id
Fetches all available couriers and packages from Shipit. This endpoint is useful for displaying a list of shipping options or for internal system synchronization.
```APIDOC
## GET /websites/developers_shipit_cl
### Description
Retorna todos los courier/paquetería disponibles en Shipit.
### Method
GET
### Endpoint
/websites/developers_shipit_cl
### Parameters
#### Query Parameters
- **id** (string) - Optional - The ID of the courier or package to search for.
### Request Example
```json
{
"example": "GET /websites/developers_shipit_cl?id=12345"
}
```
### Response
#### Success Response (200)
- **couriers** (array) - A list of courier objects.
- **id** (string) - The unique identifier for the courier.
- **name** (string) - The name of the courier.
- **packages** (array) - A list of package objects.
- **id** (string) - The unique identifier for the package.
- **name** (string) - The name of the package type.
#### Response Example
```json
{
"example": {
"couriers": [
{
"id": "fedex",
"name": "FedEx"
},
{
"id": "ups",
"name": "UPS"
}
],
"packages": [
{
"id": "box_small",
"name": "Small Box"
},
{
"id": "envelope",
"name": "Envelope"
}
]
}
}
```
```
--------------------------------
### GET /v/helps
Source: https://developers.shipit.cl/reference/historial-de-tickets
Retrieves a list of help tickets or support requests. Supports filtering by status.
```APIDOC
## GET /v/helps
### Description
Retrieves a list of help tickets or support requests. Supports filtering by status.
### Method
GET
### Endpoint
/v/helps
### Query Parameters
- **status** (string) - Optional - Filters the help tickets by their status (e.g., 'open').
### Request Example
```json
{
"example": "Not applicable for GET request"
}
```
### Response
#### Success Response (200)
- **id** (integer) - The unique identifier for the help ticket.
- **name** (string) - The name of the sender or creator of the ticket.
- **message** (string) - The content of the help message, potentially in HTML format.
- **author_id** (integer) - The ID of the author of the message.
- **created_at** (string) - The timestamp when the ticket was created.
- **organization_id** (integer) - The ID of the organization associated with the ticket.
- **via** (object) - Information about how the ticket was submitted.
- **type** (string) - The type of submission (e.g., "Formulario web").
- **other_subject** (string) - Additional subject information.
- **account_id** (integer) - The account ID associated with the ticket.
- **updated_at** (string) - The timestamp when the ticket was last updated.
- **last_response_name** (string) - The name of the last responder.
- **last_response_date** (string) - The date of the last response.
- **messages** (array) - An array of message objects within the ticket.
- **id** (integer) - The ID of the message.
- **name** (string) - The name of the message author.
- **message** (string) - The content of the message.
- **author_id** (integer) - The ID of the message author.
- **created_at** (string) - The timestamp when the message was created.
- **organization_id** (integer) - The ID of the organization associated with the message.
#### Response Example
```json
{
"example": "{\n \"id\": 111111111,\n \"name\": \"Customer Name\",\n \"message\": \"
\",\n \"author_id\": 12345678,\n \"created_at\": \"2020-06-18T17:10:12Z\",\n \"organization_id\": 111111111,\n \"via\": {\n \"type\": \"Formulario web\"\n },\n \"other_subject\": \"\",\n \"account_id\": 1,\n \"created_at\": \"2020-06-19T16:06:01.575-04:00\",\n \"updated_at\": \"2020-06-19T16:06:01.575-04:00\",\n \"last_response_name\": \"Agente Shipit\",\n \"last_response_date\": \"2020-06-18T13:10:12.000-04:00\",\n \"messages\": [\n {\n \"id\": 111111111,\n \"name\": \"Agente Shipit\",\n \"message\": \"\",\n \"author_id\": 11111111,\n \"created_at\": \"2020-06-18T17:10:12Z\",\n \"organization_id\": 111111111\n }\n ]\n}"
}
```
#### Error Response (400)
- **message** (string) - Description of the error (e.g., 'No tienes tickets disponibles').
- **error** (string) - Error code (e.g., 'bad_request').
#### Error Response Example
```json
{
"message": "No tienes tickets disponibles",
"error": "bad_request"
}
```
```
--------------------------------
### GET /websites/developers_shipit_cl/couriers
Source: https://developers.shipit.cl/reference/testinput
Retrieves a list of all available couriers and shipping providers in Shipit.
```APIDOC
## GET /websites/developers_shipit_cl/couriers
### Description
Returns all available couriers/shipping providers in Shipit.
### Method
GET
### Endpoint
/websites/developers_shipit_cl/couriers
### Parameters
#### Query Parameters
None
#### Request Body
None
### Response
#### Success Response (200)
- **couriers** (array) - A list of courier objects.
- **id** (integer) - The unique identifier for the courier.
- **name** (string) - The name of the courier.
- **logo_url** (string) - The URL of the courier's logo.
#### Response Example
```json
{
"couriers": [
{
"id": 1,
"name": "Chilexpress",
"logo_url": "https://example.com/logos/chilexpress.png"
},
{
"id": 2,
"name": "Starken",
"logo_url": "https://example.com/logos/starken.png"
}
]
}
```
```
--------------------------------
### GET /v/origins
Source: https://developers.shipit.cl/reference/direcci%C3%B3n-de-origen
Retrieve information about your Shipit-connected store addresses.
```APIDOC
## GET /v/origins
### Description
Obten la información de tu tienda conectada a Shipit.
### Method
GET
### Endpoint
https://api.shipit.cl/v/origins
### Parameters
#### Header Parameters
- **Content-Type** (string) - Required - application/json
- **Accept** (string) - Required - application/vnd.shipit.v4
- **X-Shipit-Email** (string) - Required - Email asociado a la cuenta
- **X-Shipit-Access-Token** (string) - Required - Token asociado a la cuenta
### Response
#### Success Response (200)
- **id** (integer) - The unique identifier for the origin.
- **name** (string) - The name of the origin.
- **address_book** (object) - Contains detailed address information.
- **full_name** (string) - The full name of the contact person.
- **phone** (string) - The phone number.
- **email** (string) - The email address.
- **default** (boolean) - Indicates if this is the default address.
- **addressable_type** (string) - The type of addressable entity (e.g., "Origin").
- **addressable_id** (integer) - The ID of the addressable entity.
- **address** (object) - The address details.
- **street** (string) - The street name.
- **number** (string) - The street number.
- **complement** (string) - Any complement to the address.
- **commune_id** (integer) - The ID of the commune.
- **commune_name** (string) - The name of the commune.
#### Response Example
```json
[
{
"id": 4065,
"name": "shipit",
"address_book": {
"full_name": "nombre encargado operaciones",
"phone": "99999999",
"email": "correo@operaciones_cliente.cl",
"default": true,
"addressable_type": "Origin",
"addressable_id": 4065,
"address": {
"street": "apoquindo",
"number": "4499",
"complement": "",
"commune_id": 308,
"commune_name": "LAS CONDES"
}
}
}
]
```
```
--------------------------------
### Historial de Últimas Actualizaciones de Envíos
Source: https://developers.shipit.cl/reference/historial-%C3%BAltimas-actualizaciones-de-env%C3%ADos
Obtiene una lista de envíos con sus últimas actualizaciones, filtrada por fecha y otros parámetros de búsqueda.
```APIDOC
## GET /websites/developers_shipit_cl/historial_actualizaciones
### Description
Retorna los envíos buscados por fecha de actualización y los parámetros ingresados.
### Method
GET
### Endpoint
/websites/developers_shipit_cl/historial_actualizaciones
### Parameters
#### Query Parameters
- **fecha_actualizacion_desde** (string) - Required - Fecha de inicio para filtrar las actualizaciones.
- **fecha_actualizacion_hasta** (string) - Optional - Fecha de fin para filtrar las actualizaciones.
- **estado** (string) - Optional - Filtra los envíos por su estado.
- **numero_tracking** (string) - Optional - Filtra los envíos por su número de tracking.
### Response
#### Success Response (200)
- **envios** (array) - Lista de envíos con sus últimas actualizaciones.
- **id** (integer) - Identificador único del envío.
- **numero_tracking** (string) - Número de tracking del envío.
- **estado** (string) - Estado actual del envío.
- **ultima_actualizacion** (string) - Fecha y hora de la última actualización.
#### Response Example
```json
{
"envios": [
{
"id": 123,
"numero_tracking": "TRK123456789",
"estado": "En tránsito",
"ultima_actualizacion": "2023-10-27T10:00:00Z"
},
{
"id": 456,
"numero_tracking": "TRK987654321",
"estado": "Entregado",
"ultima_actualizacion": "2023-10-26T15:30:00Z"
}
]
}
```
```
--------------------------------
### Consultar un envío por ID
Source: https://developers.shipit.cl/reference/packagesid
Este endpoint permite obtener la información detallada de un envío específico proporcionando su ID.
```APIDOC
## GET /websites/developers_shipit_cl/shipments/{id}
### Description
Retorna la información de un envío específico utilizando su ID.
### Method
GET
### Endpoint
/websites/developers_shipit_cl/shipments/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - El identificador único del envío a consultar.
### Response
#### Success Response (200)
- **tracking_code** (string) - El código de seguimiento del envío.
- **status** (string) - El estado actual del envío.
- **origin** (object) - Información del origen del envío.
- **city** (string) - Ciudad de origen.
- **country** (string) - País de origen.
- **destination** (object) - Información del destino del envío.
- **city** (string) - Ciudad de destino.
- **country** (string) - País de destino.
#### Response Example
```json
{
"tracking_code": "SHP123456789",
"status": "En tránsito",
"origin": {
"city": "Santiago",
"country": "Chile"
},
"destination": {
"city": "Buenos Aires",
"country": "Argentina"
}
}
```
```
--------------------------------
### Get Communes List (Ruby)
Source: https://developers.shipit.cl/reference/communes
Retrieves a list of communes using the Shipit API with Ruby. This script demonstrates how to make a GET request with necessary headers for authentication and content negotiation. The response body is printed to the console.
```ruby
require "uri"
require "net/http"
url = URI("https://api.shipit.cl/v/communes")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/vnd.shipit.v4"
request["X-Shipit-Email"] = "ACCOUNT_EMAIL"
request["X-Shipit-Access-Token"] = "ACCOUNT_TOKEN"
response = https.request(request)
puts response.read_body
```
--------------------------------
### Cobertura API
Source: https://developers.shipit.cl/reference
Get a list of localities to which Shipit delivers.
```APIDOC
## Cobertura API
### Description
Localities to which we ship.
### Method
GET
### Endpoint
/api/v1/coverage
### Parameters
#### Query Parameters
- **country** (string) - Optional - Filter coverage by country.
### Response
#### Success Response (200)
- **locality** (string) - The name of the locality.
- **country** (string) - The country of the locality.
#### Response Example
```json
[
{
"locality": "Santiago",
"country": "Chile"
},
{
"locality": "Buenos Aires",
"country": "Argentina"
}
]
```
```
--------------------------------
### Integraciones API
Source: https://developers.shipit.cl/reference
View the configuration of your integrations.
```APIDOC
## Integraciones API
### Description
Consult the configuration of your integrations.
### Method
GET
### Endpoint
/api/v1/integrations
### Response
#### Success Response (200)
- **integration_id** (string) - The unique identifier for the integration.
- **type** (string) - The type of integration (e.g., 'ecommerce', 'erp').
- **status** (string) - The current status of the integration.
- **settings** (object) - Configuration settings for the integration.
#### Response Example
```json
[
{
"integration_id": "INT98765",
"type": "ecommerce",
"status": "active",
"settings": {
"api_key": "sk_live_..."
}
}
]
```
```
--------------------------------
### POST /v/rates
Source: https://developers.shipit.cl/reference/consultar-precio-version-estable
Consultar precio: Obtiene todos los precios de referencia de los Couriers.
```APIDOC
## POST /v/rates
### Description
Obtiene todos los precios de referencia de los Couriers.
### Method
POST
### Endpoint
https://api.shipit.cl/v/rates
### Parameters
#### Header Parameters
- **Content-Type** (string) - Required - application/json
- **Accept** (string) - Required - application/vnd.shipit.v4
- **X-Shipit-Email** (string) - Required - Email asociado a la cuenta
- **X-Shipit-Access-Token** (string) - Required - Token asociado a la cuenta
#### Request Body
- **parcel** (object) - Required - Objeto base para procesar los datos de la cotización
- **length** (number) - Optional - Largo (cm) del envío (default: 10)
- **height** (number) - Optional - Alto (cm) del envío (default: 10)
- **width** (number) - Optional - Ancho (cm) del envío (default: 10)
- **weight** (number) - Optional - Peso (kg) del envío (default: 1)
- **origin_id** (integer) - Required - Comuna de origen, debe ser de tipo entero y un ID valido de nuestras comunas disponibles de origen ver API Comunas. (default: 308)
- **destiny_id** (integer) - Required - Comuna de destino, debe ser de tipo entero y un ID valido de nuestras comunas disponibles para despacho ver API Comunas.
- **type_of_destiny** (string) - Optional - Tipo de destino, ejemplo (Domicilio, Sucursal) (default: "domicilio")
- **courier_for_client** (string) - Optional - Nombre del courier seleccionado (Ver API couriers para obtener nombre)
- **algorithm** (integer) - Optional - Indica el algoritmo para realizar el envío: 1 mas rápido mas económico, 2 mas barato a X días (default: 1)
- **algorithm_days** (integer) - Optional - Días para el algoritmo 2
### Request Example
```json
{
"parcel": {
"length": 20,
"height": 15,
"width": 10,
"weight": 2,
"origin_id": 308,
"destiny_id": 79,
"type_of_destiny": "domicilio",
"courier_for_client": "chilexpress",
"algorithm": 1
}
}
```
### Response
#### Success Response (200)
- **courier_name** (string) - Nombre del courier.
- **service_name** (string) - Nombre del servicio.
- **price** (number) - Precio del envío.
- **max_delivery_date** (string) - Fecha máxima de entrega.
- **min_delivery_date** (string) - Fecha mínima de entrega.
- **shipping_company** (string) - Nombre de la empresa de transporte.
- **tracking_url** (string) - URL de seguimiento.
- **estimated_delivery_time** (string) - Tiempo estimado de entrega.
- **service_code** (string) - Código del servicio.
- **service_type** (string) - Tipo de servicio.
- **price_without_taxes** (number) - Precio sin impuestos.
- **taxes** (number) - Impuestos.
- **currency** (string) - Moneda.
- **courier_code** (string) - Código del courier.
#### Response Example
```json
[
{
"courier_name": "chilexpress",
"service_name": "Express",
"price": 5000,
"max_delivery_date": "2023-10-27T00:00:00.000Z",
"min_delivery_date": "2023-10-26T00:00:00.000Z",
"shipping_company": "chilexpress",
"tracking_url": "https://www.chilexpress.cl/tracking?id=12345",
"estimated_delivery_time": "1-2 dias habiles",
"service_code": "express",
"service_type": "express",
"price_without_taxes": 4200,
"taxes": 800,
"currency": "CLP",
"courier_code": "1"
}
]
```
```
--------------------------------
### Couriers API
Source: https://developers.shipit.cl/reference
Get information about transport companies, their branches, and available destinations.
```APIDOC
## Couriers API
### Description
Consult about transport companies, their branches, and available destinations.
### Method
GET
### Endpoint
/api/v1/couriers
### Parameters
#### Query Parameters
- **country** (string) - Optional - Filter couriers by country.
### Response
#### Success Response (200)
- **courier_id** (string) - The unique identifier for the courier.
- **name** (string) - The name of the courier company.
- **branches** (array) - List of branches for the courier.
- **available_destinations** (array) - List of destinations served by the courier.
#### Response Example
```json
[
{
"courier_id": "COU987654321",
"name": "FastShip Logistics",
"branches": ["Branch A", "Branch B"],
"available_destinations": ["City X", "City Y"]
}
]
```
```
--------------------------------
### GET /v/shipments/filter
Source: https://developers.shipit.cl/reference/historial-%C3%BAltimas-actualizaciones-de-env%C3%ADos
Retrieves a history of shipments with the latest updates based on specified filters.
```APIDOC
## GET /v/shipments/filter
### Description
Retrieves a history of shipments with the latest updates based on specified filters.
### Method
GET
### Endpoint
https://api.shipit.cl/v/shipments/filter
### Parameters
#### Query Parameters
- **from_date** (string) - Required - Start date for the search.
- **to_date** (string) - Required - End date for the search.
- **courier** (string) - Optional - Filter by courier (e.g., 'chilexpress'). Defaults to 'all'.
- **status** (string) - Optional - Filter by shipment status(es), comma-separated (e.g., 'created,in_preparation,in_route,delivered,failed,by_retired,returned,at_shipit'). Defaults to 'all'.
- **page** (integer) - Optional - Current page of the query. 1 to n. Defaults to 1.
- **per** (integer) - Optional - Number of shipments per page. Defaults to 50, maximum 250.
- **sorter** (string) - Optional - Parameter for sorting the response. Defaults to 'id'.
- **sorter_by** (string) - Optional - Defines the sort order: 'asc' (ascending) or 'desc' (descending). Defaults to 'desc'.
#### Header Parameters
- **Content-Type** (string) - Required - Must be 'application/json'.
- **Accept** (string) - Required - Must be 'application/vnd.shipit.v4'.
- **X-Shipit-Email** (string) - Required - Email of your Shipit account.
- **X-Shipit-Access-Token** (string) - Required - Token associated with your account.
### Response
#### Success Response (200)
- **shipments** (array) - An array of shipment objects.
- **id** (integer) - The unique identifier for the shipment.
- **status** (string) - The current status of the shipment.
- **created_at** (string) - The timestamp when the shipment was created.
- **updated_at** (string) - The timestamp when the shipment was last updated.
- **courier_id** (integer) - The identifier for the courier.
- **tracking_number** (string) - The tracking number for the shipment.
- **customer_name** (string) - The name of the customer.
- **customer_address** (string) - The delivery address for the shipment.
- **customer_email** (string) - The email address of the customer.
- **customer_phone** (string) - The phone number of the customer.
- **shipping_price** (number) - The shipping cost.
- **is_return** (boolean) - Indicates if the shipment is a return.
- **return_tracking_number** (string) - The tracking number for a return shipment, if applicable.
- **return_reason** (string) - The reason for the return, if applicable.
- **return_status** (string) - The status of the return shipment, if applicable.
- **return_created_at** (string) - The timestamp when the return shipment was created, if applicable.
- **return_updated_at** (string) - The timestamp when the return shipment was last updated, if applicable.
- **return_courier_id** (integer) - The identifier for the courier used for the return, if applicable.
- **return_shipping_price** (number) - The shipping cost for the return, if applicable.
- **return_customer_name** (string) - The name of the customer for the return shipment, if applicable.
- **return_customer_address** (string) - The delivery address for the return shipment, if applicable.
- **return_customer_email** (string) - The email address of the customer for the return shipment, if applicable.
- **return_customer_phone** (string) - The phone number of the customer for the return shipment, if applicable.
#### Response Example
```json
{
"shipments": [
{
"id": 12345,
"status": "delivered",
"created_at": "2023-10-27T10:00:00Z",
"updated_at": "2023-10-27T15:30:00Z",
"courier_id": 1,
"tracking_number": "ABC123XYZ",
"customer_name": "John Doe",
"customer_address": "123 Main St, Anytown, CA 91234",
"customer_email": "john.doe@example.com",
"customer_phone": "555-123-4567",
"shipping_price": 10.50,
"is_return": false
}
]
}
```
```
--------------------------------
### Configurar Encriptación de Webhook
Source: https://developers.shipit.cl/reference/actualizaci%C3%B3n
Permite encriptar el cuerpo del webhook activando la opción 'sign_body' y proporcionando un token. Utiliza codificación SHA1 para la encriptación.
```json
"sign_body": { "required": true, "token": "token" }
```
--------------------------------
### Cotizador API
Source: https://developers.shipit.cl/reference
Get shipping quotes based on dimensions and destination. This allows you to estimate shipping costs before creating a shipment.
```APIDOC
## Cotizador API
### Description
Consult shipping prices based on dimensions and destination.
### Method
GET
### Endpoint
/api/v1/quotes
### Parameters
#### Query Parameters
- **origin_postal_code** (string) - Required - The postal code of the origin.
- **destination_postal_code** (string) - Required - The postal code of the destination.
- **weight** (number) - Required - The weight of the package in kilograms.
- **dimensions** (object) - Required - The dimensions of the package.
- **length** (number) - Required - Length in centimeters.
- **width** (number) - Required - Width in centimeters.
- **height** (number) - Required - Height in centimeters.
### Response
#### Success Response (200)
- **courier_id** (string) - The ID of the courier.
- **service_type** (string) - The type of service offered.
- **price** (number) - The estimated price for the shipment.
#### Response Example
```json
[
{
"courier_id": "COU987654321",
"service_type": "standard",
"price": 15.75
},
{
"courier_id": "COU112233445",
"service_type": "express",
"price": 25.50
}
]
```
```