Integration API
API Endpoint
https://api.treggo.coThese 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
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
Body
{
"email": "nicolas.a.torchio@gmail.com",
"secret": "59a24e9d-b9b8-4278-9073-58b37f392eec",
"mode": "production"
}
Headers
Content-Type: application/json
Body
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjBkMGFmMTIwLTU0ZDEtNDJkZS1iNmNiLThjMDMxYWU3ZjZmNSIsIm1vZGUiOiJwcm9kdWN0aW9uIiwiaWF0IjoxNTg0NTQyOTQ2fQ.z3gcNIn4SjAleXgcYErxw4_DK9ADezhmQam9jI5S4dM"
}
Creates a new tokenPOST/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 ¶
Headers
authentication: Bearer {token}
Body
{
"pickup": {
"address": "Rivadavia 1234",
"locality": "CABA",
"zip": 1424
},
"delivery": {
"address": "Corrientes 12345",
"latitude": "-71.0833300",
"logintude": "-41.5500000",
"locality": "CABA",
"zip": 1424
},
"size": {
"weight": 100,
"height": 100,
"length": 100,
"width": 100
},
"method": "ondemand",
"type": "auto",
"packages": 4
}
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
[
{
"method": "OnDemand",
"price": 100
}
]
creates a quote for the shippingPOST/1/rates
Gives a price for a given locality or postal code Be sure to send only ONE of the options
The “method” option will be used for specific types of delivery Options are (If not defined simply do not add this option)
-
ondemand
-
onprint
-
semi
-
scan
-
colecta
-
pickup
-
crossdock
Shipment creation ¶
Headers
authentication: Bearer {token}
Body
{
"origin": {
"type": "API",
"id": "R834532353",
"store": "Mi tienda"
},
"pickup": {
"address": "Rivadavia 1234",
"door": "1a",
"contact": "Jane Doe",
"locality": "CABA",
"zip": 1424
},
"delivery": {
"address": "Corrientes 12345",
"door": "1a",
"locality": "CABA",
"zip": 1424,
"contact": "John Doe",
"email": "user@domain.com",
"phone": "Tel 1: 1234567890, Tel 2:0987654321",
"sla": "1996-10-15T00:05:32.000Z"
},
"size": {
"weight": 100,
"height": 100,
"length": 100,
"width": 100
},
"method": "OnDemand",
"type": "auto",
"packages": 4,
"status": "new"
}
Headers
authentication: Bearer {token}
Content-Type: application/json
Body
{
"id": "daf1c062-488a-4ef5-8c8d-eea4f0b5dab8"
}
Creates a new shipmentPOST/1/shipment
This service creates a shipping but doesn’t create a delivery order (except the shipment is method “ondemand”), 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
Warning!: If you impose this shipment with status canceled and you have an active order, this will be canceled as well
Shipment status ¶
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 shipmentGET/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 unseccesful status:
-
No entregado, zona peligrosa.
-
Visita fallida
-
Primera visita fallida
-
Rechazado por el comprador.
-
Domicilio no visitado.
-
Domicilio incorrecto o incompleto
-
No hay nadie en el domicilio.
-
Paquete vuelve a origen.
-
Otros.
Note: As statuses are added per client basis, some added statuses may be missing on the list
- id
string
(required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0eThe note ID
Shipment status by origin ¶
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 IDGET/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
- type
string
(required) Example: APIThe origin type
- id
string
(required) Example: R834532353The origin ID
PDF Shipment label ¶
Gets the printing label of a shipmentGET/1/shipment/{id}/label/pdf
Returns a single shipping label in PDF format
- id
string
(required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0eThe note ID
ZPL Shipment label ¶
Gets the printing label of a shipmentGET/1/shipment/{id}/label/zpl
Returns a single shipping label in ZPL format for fast printers
- id
string
(required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0eThe note ID
ZPL Shipment label by origin ¶
Gets the printing label of a shipment by originGET/1/shipment/origin/{type}/{id}/label/zpl
Returns a single shipping label in ZPL format for fast printers
- type
string
(required) Example: APIThe origin type
- id
string
(required) Example: R834532353The origin ID
QRCODE Shipment label content ¶
Gets the printing label of a shipmentGET/1/shipment/{id}/label/qrcode
Returns a single shipping label in QRCCODE content format (raw to be used to create a custom QRCODE)
- id
string
(required) Example: 9217017d-ad91-48dc-bd8a-bd4172698b0eThe note ID
QRCODE Shipment label content ¶
Gets the printing label of a shipment by originGET/1/shipment/{type}/{id}/label/qrcode
Returns a single shipping label in QRCCODE content format (raw to be used to create a custom QRCODE)
- type
string
(required) Example: APIThe origin type
- id
string
(required) Example: R834532353The origin ID
Set Webhooks ¶
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"
}
}
]
Set a Webhook preference for notificationsPOST/1/setwebhooks
To this endpoint we notice you shipment’s status
- webhook
string
(required) Example: https://api.treggo.co/status
Generated by aglio on 23 Jan 2021