Integration API

These services should be user to integrate external services with Treggo’s PaaS

Remember to use the server according to the country your account was created on:

For Argentina use https://api.ar.treggo.co or https://api.treggo.co

For Mexico use https://api.mx.treggo.co

For Uruguay use https://api.uy.treggo.co

Token

Token creation

To access the API you need to validate usong your client secret available on your profile on our plataform

Remember that you can “reset” this secret every time you feel your account is compromised so it will block any access done with the old secret

POST https://api.treggo.co/1/token
RequestsToken Creation
Body
{
  "email": "nicolas.a.torchio@gmail.com",
  "secret": "59a24e9d-b9b8-4278-9073-58b37f392eec",
  "mode": "production"
}
Responses200
Headers
Content-Type: application/json
Body
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjBkMGFmMTIwLTU0ZDEtNDJkZS1iNmNiLThjMDMxYWU3ZjZmNSIsIm1vZGUiOiJwcm9kdWN0aW9uIiwiaWF0IjoxNTg0NTQyOTQ2fQ.z3gcNIn4SjAleXgcYErxw4_DK9ADezhmQam9jI5S4dM"
}

Creates a new token
POST/1/token

Note on modes: The only mode available is “production”.

Take in consideration the token is has an expiration of 24 hours, the secret reset or our sole discretion, so always create a new one on each session


Shipment

Shipment pricing

POST https://api.treggo.co/1/pricing
RequestsBy Zip CodeBy Locality
Headers
authentication: Bearer {token}
Body
{
  "zip": "1424",
  "packages": 1,
  "size": {
    "weight": 100,
    "height": 100,
    "length": 100,
    "width": 100
  }
}
Responses200
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
{
  "price": 100
}
Headers
authentication: Bearer {token}
Body
{
  "locality": "CABA"
}
Responses200
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
{
  "price": 100
}

creates a quote for the shipping
POST/1/pricing

Gives a price for a given locality or postal code Be sure to send only ONE of the options

In case the locality its not recognized or its an area not covered by Treggo the response will be HTTP code 425

The list of localities for Argentina are:

  • CABA

  • Vicente López

  • San Fernando

  • San Isidro

  • San Martín

  • Tres de Febrero

  • La Matanza

  • Morón

  • Avellaneda

  • Lanús

  • Lomas de Zamora

  • Quilmes

  • Esteban Echeverría

  • La Matanza

  • Ezeiza

  • Merlo

  • Moreno

  • San Miguel

  • José C Paz

  • Malvinas Argentinas

  • Tigre

  • Berazategui

  • Florencio Varela

  • Hurlingham

  • Ituzaingó

  • Almirante Brown


Shipment creation

POST https://api.treggo.co/1/shipment
RequestsShipment creation
Headers
authentication: Bearer {token}
Body
{
  "origin": {
    "type": "API",
    "id": "R834532353"
  },
  "pickup": {
    "address": "Rivadavia 1234",
    "door": "1a",
    "locality": "CABA"
  },
  "delivery": {
    "address": "Corrientes 12345",
    "door": "1a",
    "locality": "CABA",
    "contact": "John Doe",
    "email": "user@domain.com",
    "phone": "Tel 1: 1234567890, Tel 2:0987654321",
    "sla": "1996-10-15T00:05:32.000Z"
  },
  "packages": 4,
  "status": "new"
}
Responses200
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
{
  "id": "daf1c062-488a-4ef5-8c8d-eea4f0b5dab8"
}

Creates a new shipment
POST/1/shipment

This service creates a shipping but doesn’t create a delivery order, meaning it wont create any charges, and wont make a vehicle go to the pick up address

The origin property is an identification of a unique shipment on the remote system, this will overwrite a previous imposition of a shipment with the same ID, this is used for example for updating a delivery address or a status so it can be up to date

Note on status: Once the delivery has started the update of this field WONT stop the delivery

Status can be any remote status desired, Treggo will override this state if there is a problem with the shipping

If a mail is provided a link will be sent to the recipient

Pickup is the address from where the shipment will be obtained

Delivery is the address to where the shipment will be taken

Inside delivery you can inform the quantity of packages and the maximun time of delivery


Shipment status

GET https://api.treggo.co/1/shipment/9217017d-ad91-48dc-bd8a-bd4172698b0e
Responses200
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
{
  "id": "daf1c062-488a-4ef5-8c8d-eea4f0b5dab8",
  "status": {
    "description": "new",
    "processed": false,
    "active": false,
    "delivered": false,
    "handled": false,
    "cancelled": false
  },
  "price": 250,
  "origin": {
    "type": "API",
    "id": "R834532353"
  }
}

Gets the status of a shipment
GET/1/shipment/{id}

If a partner is not assigned to the shipment the property “partner” wont be returned

If the delivery is not yet active the state can be overwritten with a new imposition of the same origin

Some posible active status:

  • En camino

  • En proceso de entrega

Some closed status:

  • Firmado

Some problem status:

  • Domicilio incorrecto o incompleto

Note: As statuses are added per client, some added statuses may be missing on the list

URI Parameters
HideShow
id
string (required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0e

The note ID


Shipment status by origin

GET https://api.treggo.co/1/shipment/origin/API/R834532353
Responses200
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
[
  {
    "id": "daf1c062-488a-4ef5-8c8d-eea4f0b5dab8",
    "status": {
      "description": "new",
      "processed": false,
      "active": false,
      "delivered": false,
      "handled": false,
      "cancelled": false
    },
    "price": 250,
    "origin": {
      "type": "API",
      "id": "R834532353"
    }
  }
]

Gets the status of a shipment by remote ID
GET/1/shipment/origin/{type}/{id}

This endpoint returns the same infomration as the status of a single ID but searching by the remote ID

Note: as a difference, this endpoint returns an array of status, one per each visit

Some pre defined integrations types are:

  • Magento

  • PrestaShop

  • TiendaNube

  • WooCommerce

URI Parameters
HideShow
type
string (required) Example: API

The origin type

id
string (required) Example: R834532353

The origin ID


PDF Shipment label

GET https://api.treggo.co/1/shipment/9217017d-ad91-48dc-bd8a-bd4172698b0e/label/pdf

Gets the printing label of a shipment
GET/1/shipment/{id}/label/pdf

Returns a single shipping label in PDF format

URI Parameters
HideShow
id
string (required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0e

The note ID


ZPL Shipment label

GET https://api.treggo.co/1/shipment/9217017d-ad91-48dc-bd8a-bd4172698b0e/label/zpl

Gets the printing label of a shipment
GET/1/shipment/{id}/label/zpl

Returns a single shipping label in ZPL format for fast printers

URI Parameters
HideShow
id
string (required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0e

The note ID


ZPL Shipment label by origin

GET https://api.treggo.co/1/shipment/origin/API/R834532353/label/zpl

Gets the printing label of a shipment by origin
GET/1/shipment/origin/{type}/{id}/label/zpl

Returns a single shipping label in ZPL format for fast printers

URI Parameters
HideShow
type
string (required) Example: API

The origin type

id
string (required) Example: R834532353

The origin ID


QRCODE Shipment label content

GET https://api.treggo.co/1/shipment/9217017d-ad91-48dc-bd8a-bd4172698b0e/label/qrcode

Gets the printing label of a shipment
GET/1/shipment/{id}/label/qrcode

Returns a single shipping label in QRCCODE content format (raw to be used to create a custom QRCODE)

URI Parameters
HideShow
id
string (required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0e

The note ID


QRCODE Shipment label content

GET https://api.treggo.co/1/shipment/API/R834532353/label/qrcode

Gets the printing label of a shipment by origin
GET/1/shipment/{type}/{id}/label/qrcode

Returns a single shipping label in QRCCODE content format (raw to be used to create a custom QRCODE)

URI Parameters
HideShow
type
string (required) Example: API

The origin type

id
string (required) Example: R834532353

The origin ID


Generated by aglio on 24 Sep 2020