DeCA2U

Referencia

Reference

La API que usa nuestra propia aplicación.

The API our own app runs on.

REST sobre JSON. Aquí abajo tienes la autenticación y un ejemplo de cómo se emite un documento - lo que hace falta para calcular cuánto lleva integrar. La referencia completa, ruta por ruta, está dentro de la plataforma una vez has entrado.

REST over JSON. Below is authentication and one worked example of issuing a document - enough to work out how long an integration takes. The full reference, route by route, lives inside the platform once you have signed in.

Autenticación

Authentication

Un sistema de despacho presenta su clave en x-api-key. La clave pertenece a un cliente y sólo puede actuar sobre él: el inquilino nunca viaja en el cuerpo ni en la URL, porque ambos los escribe quien llama.

A dispatch system presents its key in x-api-key. The key belongs to one customer and can only act on that customer: the tenant never travels in the body or the URL, because the caller writes both.

Una persona presenta un token de su propio directorio en Authorization: Bearer. Lo que puede hacer lo decide el rol que su administrador le asignó, nunca una reivindicación del token.

A person presents a token from their own directory in Authorization: Bearer. What they may do is decided by the role their administrator granted, never by a claim in the token.

Emitir un documento

Issue a document

La llamada que integra el 90 % de los casos. Devuelve el identificador, la URL pública y la huella del PDF publicado.

The one call that covers 90% of integrations. It returns the identifier, the public URL and the hash of the published PDF.

curl -X POST https://api.deca2u.com/v1/documents \
  -H "x-api-key: $DECA2U_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "siteId": "V204",
    "externalRef": "V204-40712",
    "data": {
      "contractualShipper": {
        "name": "Conservas Bahía Norte, S.L.",
        "taxId": "B36742180",
        "address": "Rúa do Porto 22, 36202 Vigo"
      },
      "effectiveCarrier": { "name": "Transportes Vega Hermanos, S.L.", "taxId": "B99001122" },
      "location": { "origin": "Centro logístico de Vigo", "destination": "Plataforma de Getafe" },
      "goods": { "description": "Conserva vegetal en lata", "quantity": 12400, "unit": "kg" },
      "transportDate": "2026-07-15",
      "vehicle": { "tractorPlate": "1234ABC", "articulated": false }
    }
  }'

Respuesta 201:

201 response:

{
  "id": "8h86UiouAH2eZwOrS4di1Q",
  "url": "https://doc.deca2u.com/yQRjIVKxGsA4SqJoZDn_hw/8h86UiouAH2eZwOrS4di1Q.pdf",
  "publishedAt": "2026-07-15T06:31:02.144Z",
  "publicUntil": "2026-07-22T23:59:59.000Z",
  "pdfHash": "9f2c…",
  "qr": "<svg xmlns=…>",          // only with ?qr=1
  "externalRef": "V204-40712"
}

Si la expedición ya tenía documento responde 200 con alreadyIssuedAs y la URL existente, en vez de emitir un segundo. Si falta alguna letra obligatoria responde 422 y enumera cuáles: un documento incompleto no es un DeCA y no se publica.

If the consignment already had a document it answers 200 with alreadyIssuedAs and the existing URL, rather than issuing a second one. If a required letter is missing it answers 422 and lists which: an incomplete document is not a DeCA, and it is not published.

El resto - corregir, reemitir, los catálogos del cliente, los bloques de identificadores para un sitio sin línea - está documentado ruta por ruta dentro de la plataforma, en Administración, para quien ya tiene una cuenta.

The rest - correcting, reissuing, the customer's own catalogues, identifier blocks for a site with no line - is documented route by route inside the platform, under Administration, for whoever already has an account.