Desarrollador
Paquetes
CRUD de paquetes: listar, leer, crear, actualizar y borrar.
Un paquete es una pieza (P1, P2…). Sin receiptSerialNumber el alta abre un recibo WR nuevo y el paquete queda como P1. Para colgar P2 en un recibo ya creado, envía su receiptSerialNumber y receiptPackageIndex. packages.delete borra solo esa pieza.
Métodos
| Método | HTTP | Scope |
|---|---|---|
| packages.list() | GET /org-api/v1/packages | packages:read |
| packages.retrieve(id) | GET /org-api/v1/packages/:id | packages:read |
| packages.create(body) | POST /org-api/v1/packages | packages:write o organization:read |
| packages.update(id, body) | PATCH /org-api/v1/packages/:id | packages:write o organization:read |
| packages.delete(id) | DELETE /org-api/v1/packages/:id | packages:write o organization:read |
| packages.listFromMisiil() | GET /org-api/v1/marketplaces/misiil/packages | packages:read |
Listar
list() devuelve como máximo 500 paquetes, del más reciente al más antiguo. retrieve(id) devuelve uno, con la misma forma.
const packages = await traky.packages.list();
const one = await traky.packages.retrieve(packages.data[0].id);Envoltorio
| Atributo | Tipo | Descripción |
|---|---|---|
| data | Package[] | Paquetes exportados. |
| total | number | Cantidad de objetos en data. |
| exportedAt | string | Fecha ISO 8601 de la exportación. |
Atributos del paquete
| Atributo | Tipo | Descripción |
|---|---|---|
| id | string | UUID del paquete. |
| packageType | string | Prefijo interno del recibo. |
| serialNumber | number | null | Secuencia del recibo. |
| receiptPackageIndex | number | Índice dentro del recibo. 1 es P1. |
| receiptNumber | string | null | Código de recibo. Secuencia WR o warehouse de Misiil. |
| packageNumber | string | null | Código de paquete: recibo más P1, P2…. |
| trackingNumber | string | null | Número de rastreo. |
| trackingNormalized | string | null | Rastreo en mayúsculas y sin espacios. |
| weight | number | Peso. |
| weightUnit | string | null | kg o lb. |
| declaredValue | number | Valor declarado. |
| height | number | Alto. |
| width | number | Ancho. |
| length | number | Largo. |
| dimensionUnit | string | null | cm o in. |
| pieces | number | Cantidad de piezas. |
| volumetricWeight | number | Peso volumétrico. |
| chargeableWeight | number | Peso cobrable. |
| comments | string | null | Descripción de la mercancía. |
| warehouseComments | string | null | Comentario de bodega. |
| isConsolidated | boolean | True si está consolidado. |
| isGrouped | boolean | True si entró en un lote. |
| guideId | string | null | Guía ligada, si existe. |
| saleId | string | null | Venta ligada, si existe. |
| rackCode | string | null | Código del rack. |
| registrationDate | string | Fecha de registro, ISO 8601. |
| createdAt | string | Fecha de creación, ISO 8601. |
| updatedAt | string | Fecha de actualización, ISO 8601. |
| itemStatus | object | null | Estado. id y name. |
| customer | object | null | Destinatario. |
| shipper | object | null | Remitente. |
| location | object | null | Sucursal actual. |
| warehouse | object | null | Bodega asociada. |
JSON de retorno
{
"data": [
{
"id": "c3a1e8b2-6f40-4a11-9d22-1b0c7e5a44d8",
"packageType": "WR",
"serialNumber": 1204,
"receiptPackageIndex": 1,
"receiptNumber": "WR00001204",
"packageNumber": "WR00001204P1",
"trackingNumber": "1Z999AA10123456784",
"trackingNormalized": "1Z999AA10123456784",
"weight": 4.5,
"weightUnit": "lb",
"declaredValue": 80,
"height": 20,
"width": 15,
"length": 30,
"dimensionUnit": "cm",
"pieces": 1,
"volumetricWeight": 5.1,
"chargeableWeight": 5.1,
"comments": "Ropa",
"warehouseComments": null,
"isConsolidated": false,
"isGrouped": false,
"guideId": null,
"saleId": null,
"rackCode": null,
"registrationDate": "2026-10-20T15:04:00.000Z",
"createdAt": "2026-10-20T15:04:11.000Z",
"updatedAt": "2026-10-24T12:10:00.000Z",
"itemStatus": { "id": "st_recibido", "name": "Recibido" },
"customer": null,
"shipper": null,
"location": null,
"warehouse": null
}
],
"total": 1,
"exportedAt": "2026-10-24T17:15:00.000Z"
}Crear
El cuerpo es PackageCreate. Hacen falta registrationDate, trackingNumber, itemStatusId y locationId. itemStatusId sale de statuses.list({ category: "package" }) y locationId de offices.list(). El API asigna el tipo WR.
const created = await traky.packages.create({
registrationDate: new Date().toISOString(),
trackingNumber: "1Z999",
itemStatusId: "00000000-0000-4000-8000-000000000001",
locationId: "00000000-0000-4000-8000-000000000002",
weight: 2,
comments: "Ropa",
});await traky.packages.create({
registrationDate: new Date().toISOString(),
trackingNumber: "1Z222",
itemStatusId: "00000000-0000-4000-8000-000000000001",
locationId: "00000000-0000-4000-8000-000000000002",
receiptSerialNumber: 1204,
receiptPackageIndex: 2,
});Cuerpo de alta
| Atributo | Tipo | Descripción |
|---|---|---|
| registrationDate | string | Obligatorio. ISO 8601. |
| trackingNumber | string | Obligatorio en el SDK. |
| itemStatusId | string | Obligatorio. Estado de paquete. |
| locationId | string | Obligatorio. Sucursal. |
| weight | number | Peso. |
| declaredValue | number | Valor declarado. |
| height | number | Alto. |
| width | number | Ancho. |
| length | number | Largo. |
| pieces | number | Cantidad de piezas. Mínimo 1. |
| comments | string | Descripción de la mercancía. |
| warehouseComments | string | Nota de bodega. |
| customerId | string | Destinatario. |
| shipperId | string | Remitente. |
| warehouseId | string | Bodega. Sale de offices.list({ type: "warehouse" }). |
| externalReceiptCode | string | Warehouse del proveedor (WHR…). No consume la secuencia WR. |
| receiptSerialNumber | number | Serial de un recibo ya creado, para P2, P3…. |
| receiptPackageIndex | number | 1 es P1. Por defecto 1. |
Actualizar
update envía solo los campos que cambian. El cuerpo es PackageWrite. El id va en el primer argumento. propagatePartiesToReceiptSiblings en true copia remitente y destinatario al resto del recibo.
await traky.packages.update(created.id, {
warehouseComments: "Retener",
weight: 2.4,
});Borrar
delete elimina ese paquete. El resto del recibo se queda.
const removed = await traky.packages.delete(created.id);{
"id": "c3a1e8b2-6f40-4a11-9d22-1b0c7e5a44d8",
"deleted": true
}