Power Automate, AI and workflow automation

Turn email, order or delivery data into a DeCA. Combine rules, AI analysis and API calls to match your workflow.

Set up Power Automate

DeCA API for ERP, TMS, invoicing and fleet management

DECA ERP lets external systems create a DeCA, provide a private link for the carrier to complete missing details, check its status and download the current PDF. The REST API supports ERP, TMS, invoicing and fleet management systems.

Integration features

Integrate DECA ERP into your existing workflow for delivery notes, shipments, trips or loads. Users do not need to enter the same details again on the website.

Authenticated REST API

The standard format uses api.php and the alternative NTS FORMAT uses api_nts.php. Both use the same X-Api-Key header for each company.

Downloadable demo project

Includes a VB.NET Framework 4.8 WinForms application with an Access database, a reusable API client and versions for 32-bit or 64-bit ACE. Supports the standard format or the alternative NTS FORMAT, with a JSON editor/importer, retries and document replacements.

Official Swagger UI

Documentation generated from OpenAPI, with schemas, examples, authentication and live requests using Try it out.

Excel macros

A downloadable example creates and updates DeCA documents from a transport order and returns the number, URLs and QR code. Existing workbooks can be adapted under a separate quote.

Important: Swagger and the console call the live environment. Use a test company and test API key when creating or modifying records.

alternative NTS FORMAT

DeCAs in this format can also be edited from the web list while preserving format-specific details, previous versions and the change log. The URL stays the same, and the ERP can retrieve the updated details.

Enabled by default for existing and new companies with valid API access. Send JSON containing the carrier, one or two drivers, vehicle combination, origins, destinations and goods to POST /api_nts.php.

No second API key is required. The standard format remains available: choose one format per operation and do not send the same transport to both endpoints. Administrators can disable NTS for a company.

Full guide and JSON example · Swagger for the alternative NTS FORMAT

If the assigned driver has email notifications enabled, they receive a notification when the DeCA is pending completion and another when it is complete, with access to the document and its QR code.

Getting started

Integrators can test the full connection without installing additional tools.

Request a key

DECA provides an X-Api-Key linked to the company. Store it as a configuration secret.

Test a read request

Open Swagger, select Authorize and call accion=listar. An HTTP 200 response confirms connectivity and permissions.

Test record creation

First create an undated trip with a test external reference. No PDF is generated until a date is assigned.

Store the link

Store idDeca, urlEdicion, origenRegistro and idExterno. Include the edit URL in the transport order immediately.

Recommended ERP workflow

Synchronize master data

Optionally maintain customers, carriers, vehicles and drivers from the ERP using accion=guardar. They then become available in the web selectors.

Create a pending trip

Before sending the order, the ERP calls accion=crear without a date or registrations and chooses permission mode operativo or carga.

Store the response

DECA returns idDeca, urlEdicion, the completion status and document URLs. The private link can be sent to the carrier.

Check and archive

The ERP checks until it receives estadoCumplimentacion=completado and downloads the current PDF from urlDescargaPdf.

Entities, vehicles and master data

The API synchronizes standard ERP master data. This is optional for creating a DeCA, but avoids duplicate maintenance and makes customers, carriers, registrations and drivers available in the web application.

Customers and carriers

/api_clientes.php creates, updates, retrieves, lists, activates and deactivates entities. The fields esCliente and esTransportista allow the same record to have either or both roles. It can also configure the driver and signature areas printed on new DeCAs.

Vehicles

/api_vehiculos.php maintains tractor units, trailers, rigid trucks and other vehicles. Active registrations appear in the web form.

Drivers

/api_conductores.php maintains name, telephone numbers, email addresses, notaDeca and mostrarNotaDeca. The note is a proposed value for new trips; each DeCA keeps its own copy. With notificarEmail=true, the driver receives automatic notifications.

Saved locations and farms

/api_lugares.php maintains farms, warehouses and saved points. Each record can be used as an origin, destination or both. Trips accept idLugarOrigen and idLugarDestino; DECA validates the company and retains a copy of the name and address.

Bulk import

Administrators can upload XLSX or CSV files. The customer template includes IncluirConductorPdf, FirmaExpedidorPdf, FirmaDestinatarioPdf and FirmaTransportistaPdf. The ERP can use /api_clientes_importar.php for batches of up to 1,000 entities.

Avoid duplicates: use accion=guardar and always send origenRegistro + idExterno. The first request creates the master record; subsequent requests update it. Deactivate records with accion=desactivar while preserving the history.
When you send idCliente or idTransportista, DECA copies their details into the trip. This contractual snapshot is preserved even if the master record changes later. Details can also be supplied manually, without identifiers.
Driver in the PDF: creation accepts idConductor or a conductores list with up to two items. incluirConductorPdf decides whether they are shown; each item may specify notaDeca and mostrarNotaDeca. The PDF never adds an ID number, telephone or email. Later changes to the master record do not alter the document or its previous versions.
Signature areas: the firmaExpedidorPdf, firmaDestinatarioPdf and firmaTransportistaPdf preferences are configured on the customer and copied when the DeCA is created. Each document therefore retains its layout even if the customer record changes later.

Main endpoints

OperationMethodRoles
CreatePOSTaccion=crear. Creates a DeCA from ERP data.
UpdatePOSTaccion=actualizar. Updates details and generates a new version when applicable.
ViewGETaccion=consultar&id=123. Returns status, lines and current registrations (null until assigned).
Get edit linkGETaccion=enlace_edicion&id=123. Returns the same active link, or creates it if none exists.
SearchGETaccion=buscar&origen=ERP_CLIENTE&idExterno=12345. Finds the DeCA linked to the ERP record.
ListGETaccion=listar. Supports date and unscheduled-trip filters, limit and offset.
History / PDFGET/api_versiones.php?id=123 returns versions and changes; actual=1 downloads the current PDF and version=2 a specific version.
Bulk PDF downloadPOST / GET/api_descargas.php. Builds a ZIP in the background from a date filter or a list of IDs, reports progress and makes it downloadable when ready.
Multi-stop tripsGET / POST/api_repartos.php. Creates, updates, retrieves and lists DeCAs with multiple shipments, each with its own origin, destination and goods.
Save entityPOST/api_clientes.php with accion=guardar. Creates or updates customers and carriers by ERP reference.
Import entitiesPOST/api_clientes_importar.php. Validates or imports up to 1,000 customers and carriers in a single transaction.
Manage usersGET / POST/api_usuarios.php. Lists or imports up to 1,000 users and generates or revokes their personal API keys.
Save vehiclePOST/api_vehiculos.php with registration, type and ERP reference.
Save driverPOST/api_conductores.php with name, phone, one or more email addresses, notificarEmail and ERP reference.
Save locationPOST/api_lugares.php with code, name, address, use and ERP reference.
List master dataGETAll four endpoints support id, ERP reference, q, activo, limit and offset. Entities accept rol=cliente|transportista|ambos; locations accept uso=origen|destino|ambos.
Send the API key in the HTTP header: X-Api-Key: clave_de_la_empresa. Never include it in the URL.
Personal identification: to assign API-created DeCAs to a user, send only X-User-Api-Key. It identifies both company and user; do not send it together with X-Api-Key, and never include idEmpresa or idUsuario in JSON. The general key remains available for existing integrations and administrative operations.
Bulk setup: administrators can import users from CSV or Excel under Users > Import users, or through /api_usuarios.php. Export creates a separate personal credential for each user. The full key is delivered only once and must be distributed individually through a secure channel.
PDF batches: creating a batch returns HTTP 202 and an idLote. Poll its status until estado=disponible, then use urlDescarga. A batch may contain up to 10,000 documents or 512 MB. The temporary ZIP expires after 24 hours; the original PDFs are never removed.
Traceability: each generated PDF is retained as an immutable version. The operational history identifies changed fields, including description, quantity, unit and weight changes on every goods line, their source and the resulting version. Historical downloads require authentication; the public URL only shows the current version.

Identifying the ERP record

Company DeCA numbering

Each company has its own automatic, sequential and immutable numbering. The numeroEmpresa field is the visible DeCA number within that company; idDeca remains the global ID that the ERP must retain and use for queries, updates, history and URLs.

{ "ok": true, "idDeca": 125, "numeroEmpresa": 8 }

numeroEmpresa is read-only and must not be sent when creating or updating a document. It does not change when a document is edited, cancelled or completed. Duplicating a DeCA generates a new ID and number. Numbering does not reset each year and may contain gaps if documents are deleted.

Existing documents retain their IDs, URLs and historical PDFs. New PDFs show the company number and global ID. In NTS, numeroEmpresa is separate from numeroDocumento, the ERP reference; a replacement retains that reference but creates a new DeCA with another ID and number.

For traceability, always send these two fields:

origenRegistro

Identifies the source system, for example ERP_CLIENTE, FACTUNET or APP_FLOTA.

idExterno

Identifies the record within the ERP: shipment number, delivery note, dispatch or internal key.

This pair lets the ERP find the document later without relying on a user manually storing the idDeca.

Integration rules

Avoiding duplicates

The pair origenRegistro + idExterno is unique within each company. Reusing it in a creation request returns HTTP 409; update the existing document instead.

Partial updates

accion=actualizar preserves fields that are not sent. In api_repartos.php, sending enviosreplaces the entire collection of shipments and lines.

Date and PDF

Without fechaTransporte the trip remains unscheduled. Assigning a date makes DECA validate the required details and generate a PDF version.

URLs with different purposes

urlEdicion is the private carrier link. urlDocumento opens the current DeCA once a PDF exists. urlDescargaPdf requires the API key and allows archiving in the ERP.

Carrier permissions

operativo allows date and registration changes. carga also allows the description, quantity or packages, unit and weight. The permission is stored on the server and never allows changing companies, tax IDs, routes or administrative statuses.

Common ERP examples

Create or update a customer

POST https://deca.netsistemas.com/api_clientes.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "guardar",
  "nombre": "Harinas Leonesas SL",
  "nif": "B24010101",
  "domicilio": "Pol. Ind. Leon Oeste 12, Leon",
  "esCliente": true,
  "esTransportista": false,
  "origenRegistro": "ERP_EMPRESA",
  "idExterno": "CLI-00428"
}

Create or update a carrier

POST https://deca.netsistemas.com/api_clientes.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "guardar",
  "nombre": "Transportes del Norte SL",
  "nif": "B00000001",
  "domicilio": "Calle del Transporte 8, Leon",
  "esCliente": false,
  "esTransportista": true,
  "origenRegistro": "ERP_EMPRESA",
  "idExterno": "TRA-00017"
}

Validate and batch-import customers

POST https://deca.netsistemas.com/api_clientes_importar.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "validar",
  "modoDuplicados": "actualizar",
  "registros": [
    {
      "origenRegistro": "ERP_EMPRESA",
      "idExterno": "CLI-00428",
      "nombre": "Harinas Leonesas SL",
      "nif": "B24010101",
      "domicilio": "Pol. Ind. Leon Oeste 12, Leon",
      "esCliente": true,
      "esTransportista": false,
      "activo": true
    }
  ]
}

The response previews how many records would be created, updated, skipped or rejected. After reviewing it, repeat the same batch with accion=importar. The operation is atomic: if an error occurs, no rows are saved.

Company isolation: the endpoint does not accept idEmpresa. The company is determined exclusively from X-Api-Key, as in the rest of the API.

Create or update a vehicle

POST https://deca.netsistemas.com/api_vehiculos.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "guardar",
  "matricula": "1234 KLM",
  "tipo": "tractora",
  "marca": "Volvo",
  "modelo": "FH 460",
  "origenRegistro": "ERP_EMPRESA",
  "idExterno": "VEH-00117"
}

Create or update a driver

POST https://deca.netsistemas.com/api_conductores.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "guardar",
  "nombre": "Carlos Martin Gomez",
  "telefono": "34600111222",
  "email": "carlos@transportes.test; trafico@transportes.test",
  "notificarEmail": true,
  "origenRegistro": "ERP_EMPRESA",
  "idExterno": "CON-00032"
}

Retrieve master data

GET /api_clientes.php?activo=1&rol=cliente&q=Harinas&limit=50
GET /api_clientes.php?activo=1&rol=transportista&limit=50
GET /api_vehiculos.php?origen=ERP_EMPRESA&idExterno=VEH-00117
GET /api_conductores.php?id=32
GET /api_lugares.php?activo=1&uso=origen&q=Farm
X-Api-Key: clave_de_la_empresa

Create or update a farm or saved location

POST https://deca.netsistemas.com/api_lugares.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "guardar",
  "codigo": "GR-018",
  "nombre": "Example Farm",
  "domicilio": "4 Rural Road, Segovia",
  "esOrigen": true,
  "esDestino": false,
  "activo": true,
  "origenRegistro": "ERP_COMPANY",
  "idExterno": "FARM-018"
}

Create a DeCA with a customer and vehicle

POST https://deca.netsistemas.com/api.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "crear",
  "idCliente": 42,
  "idTransportista": 57,
  "cargadorNombre": "Harinas Leonesas SL",
  "cargadorNif": "B24010101",
  "cargadorDomicilio": "Pol. Ind. León Oeste 12, León",
  "idLugarOrigen": 18,
  "destino": "Valladolid",
  "fechaTransporte": "2026-10-06",
  "matriculaTractora": "1234-KLM",
  "origenRegistro": "ERP_CLIENTE",
  "idExterno": "ALB-2026-00158",
  "lineas": [
    { "descripcion": "Harina de trigo", "cantidad": 40, "unidad": "sacos", "pesoKg": 1000 }
  ]
}

Create an unscheduled trip without a date

{
  "accion": "crear",
  "cargadorNombre": "Ceramicas Levante SA",
  "cargadorNif": "A46020202",
  "origen": "Valencia",
  "destino": "Burgos",
  "matriculaTractora": "1198-MNC",
  "origenRegistro": "ERP_CLIENTE",
  "idExterno": "PRE-2026-0042",
  "lineas": [
    { "descripcion": "Azulejo ceramico paletizado", "cantidad": 18, "unidad": "palets", "pesoKg": 12600 }
  ]
}

Update a vehicle or assign a date

{
  "accion": "actualizar",
  "id": 125,
  "fechaTransporte": "2026-08-21",
  "matriculaTractora": "7350-LPD",
  "matriculaRemolque": "R-8841-LHG"
}
{
  "ok": true,
  "idDeca": 125,
  "numeroEmpresa": 8,
  "token": "7f4e...",
  "url": "https://deca.netsistemas.com/deca.php?t=7f4e...",
  "numVersion": 1,
  "pdf": true
}

Create a multi-stop trip

Use the dedicated endpoint when the same contractual consignor and actual carrier handle several shipments in one trip. Provide shared details once; each element in envios identifies its route and goods.

POST https://deca.netsistemas.com/api_repartos.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "crear",
  "cargadorNombre": "Distribuciones Centro SL",
  "cargadorNif": "B28030303",
  "cargadorDomicilio": "Calle Comercio 15, Madrid",
  "transportistaNombre": "Transportes del Norte SL",
  "transportistaNif": "B00000001",
  "fechaTransporte": "2026-08-24",
  "matriculaTractora": "1234 KLM",
  "origenRegistro": "ERP_CLIENTE",
  "idExterno": "RUTA-2026-0087",
  "envios": [
    {
      "referencia": "PED-4501",
      "idLugarOrigen": 18,
      "destino": "Toledo",
      "lineas": [
        { "descripcion": "Conservas en cajas", "cantidad": 40, "unidad": "cajas", "pesoKg": 520 }
      ]
    },
    {
      "referencia": "PED-4502",
      "origen": "Toledo",
      "destino": "Ciudad Real",
      "lineas": [
        { "descripcion": "Bebidas paletizadas", "cantidad": 8, "unidad": "palets", "pesoKg": 4300 }
      ]
    }
  ]
}

The original API /api.php remains unchanged for single-shipment trips. It can also update dates, registrations and statuses for a multi-stop trip; to change routes or goods, use /api_repartos.php.

Incomplete creation and carrier completion

Use this workflow when the transport order is created in the ERP before the date, vehicle or all goods details are known.

POST https://deca.netsistemas.com/api.php
X-Api-Key: clave_de_la_empresa
Content-Type: application/json

{
  "accion": "crear",
  "cargadorNombre": "Empresa cargadora SL",
  "cargadorNif": "B12345678",
  "cargadorDomicilio": "Calle Ejemplo 10, Madrid",
  "transportistaNombre": "Transportes El Rapido SL",
  "transportistaNif": "B87654321",
  "origen": "Madrid",
  "destino": "Valencia",
  "origenRegistro": "ERP_CLIENTE",
  "idExterno": "OT-2026-0042",
  "modoEdicionTransportista": "carga",
  "diasValidezEnlace": 30,
  "lineas": [
    {"descripcion": "Mercancia pendiente de confirmar"}
  ]
}
{
  "ok": true,
  "idDeca": 126,
  "numeroEmpresa": 9,
  "urlEdicion": "https://deca.netsistemas.com/completar_matriculas.php?t=...",
  "modoEdicionTransportista": "carga",
  "estadoCumplimentacion": "no_iniciado",
  "urlDocumento": null,
  "urlDescargaPdf": null,
  "pdfDisponible": false
}

no_iniciado

The link exists, but the carrier has not saved any details yet.

pendiente

At least one draft has been saved, but the carrier has not submitted completion.

completado

The carrier has submitted completion. The query returns the completion date and the document and PDF URLs.

To retrieve the link without duplicating it: GET /api.php?accion=enlace_edicion&id=126. To check the status: GET /api.php?accion=consultar&id=126. To download the current PDF: GET /api_versiones.php?id=126&actual=1, always with X-Api-Key.

Security: do not add permissions as parameters to urlEdicion. The value modoEdicionTransportista is set by the authenticated ERP request and stored on the server.

Trips without a transport date

The API supports creating unscheduled records without fechaTransporte. The document remains a draft and no PDF is generated until a date is assigned.

Early creation

The ERP can create the record before the exact trip date is known.

Later update

When the user assigns the transport date, call actualizar and DECA generates the PDF.

Filtered lists

accion=listar&noPlanificados=1 returns only documents without a transport date. Narrow the results using creation, modification or record dates.

GET /api.php?accion=listar&noPlanificados=1&fechaCampo=creacion&fechaDesde=2026-08-01&limit=100
X-Api-Key: clave_de_la_empresa
From and to dates are optional and independent. fechaHasta is inclusive. Do not combine unscheduled trips with fechaCampo=transporte, because those records have no trip date.

Responses, errors and retries

CodeMeaningRecommended action
200Operation successful.Validate ok and store the returned identifiers.
201Master record created successfully.Store the returned internal identifier and retain the ERP reference.
400Invalid JSON, date or required details.Display or log the errorfield; correct the request before retrying.
401Missing or invalid key.Check the X-Api-Key header and the environment configuration.
403API unavailable for the company, or subscription expired.Contact support or the account administrator.
404The idDeca does not exist for that company.Check the identifier or search by external reference.
409The supplied external reference already exists.Find the record and update it.
500Temporary error while completing the operation.Log the response and retry in a controlled manner; contact support if the error persists.
Do not record the API key in logs, URLs or screenshots. In production, use HTTPS, reasonable timeouts and retries only for temporary errors.

Production checklist

  • The API key is stored outside the source code and never sent in the URL.
  • Each ERP shipment uses a stable, unique external reference.
  • Customer, carrier, vehicle and driver synchronization uses accion=guardar and has been tested twice with the same reference.
  • Entities have at least one of the roles esCliente or esTransportista.
  • Master record deactivation is sent as accion=desactivar; no history deletion is attempted.
  • The ERP retains idDeca, urlEdicion, origenRegistro and idExterno after creation.
  • Updates use accion=actualizar and the correct identifier.
  • Codes 400, 401, 403, 404, 409 and 500 are handled explicitly.
  • Incomplete creation, draft saving, carrier completion, status queries and current PDF download have been tested.
  • Paginated queries continue while offset + items.length is less than total.

Developer resources

VB.NET + Access demo

Visual Studio sample project with an API client, models, forms and an Access database. Download the version matching the ACE/OLE DB installed on your computer.

Excel integration demo

An .xlsm workbook with fictional data, built-in macros, creation and update of the same DeCA, URLs and QR code.

Interactive Swagger

Official Swagger UI generated from the OpenAPI definition, with authentication, schemas and Try it out.

Open Swagger

Guided console

A simple form with ready-made examples for creating, updating, retrieving and listing records.

Open console

OpenAPI JSON

Technical definition for importing into Postman or generating clients and internal documentation.

View OpenAPI