{
    "openapi": "3.0.3",
    "info": {
        "title": "DECA ERP - Alternative NTS FORMAT",
        "version": "1.3.1",
        "description": "Available by default to current and new companies with active API access. It uses the same company key as the standard format. Administrators can disable it per company. It does not send notifications automatically. Maximum 2 MB per request and 5 MB per PDF. Test operations create real documents.",
        "contact": {
            "name": "NetSistemas",
            "email": "soporte@decaerp.com"
        }
    },
    "servers": [
        {
            "url": "https://decaerp.com"
        },
        {
            "url": "https://deca.netsistemas.com"
        }
    ],
    "externalDocs": {
        "description": "Alternative NTS FORMAT guide",
        "url": "https://decaerp.com/api-nts.html"
    },
    "security": [
        {
            "ApiKeyAuth": []
        },
        {
            "BearerAuth": []
        },
        {
            "UserApiKeyAuth": []
        }
    ],
    "paths": {
        "/api_nts.php": {
            "post": {
                "operationId": "crearDocumentoNts",
                "summary": "Create, update, replace or process an NTS batch",
                "description": "Omitting accion preserves the original create behaviour. accion=actualizar retains ID, GUID, number, URL and QR, records history and generates a PDF version when there are changes and a trip date. Without a date it saves as pending. documentoOrigenId still creates a replacement with a new GUID and URL. Personal keys respect user access scope.",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                        },
                        "description": "New key per operation; retry with the same key and JSON. Reusing it with other data returns 409. Update retries return the original receipt without reapplying changes, even after later edits. Without a header, updates compare with current data; creation retains JSON deduplication. Batch keys append :INDEX."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/OperacionNts"
                                    },
                                    {
                                        "$ref": "#/components/schemas/Lote"
                                    }
                                ]
                            },
                            "examples": {
                                "documento": {
                                    "summary": "Create using fictional data",
                                    "value": {
                                        "numeroDocumento": "EJEMPLO-2026-001",
                                        "transportista": {
                                            "nif": "DEMO-TRANSPORTISTA",
                                            "razonSocial": "Transportes de ejemplo",
                                            "domicilio": "Calle de ejemplo 10, Madrid",
                                            "email": "transportista@example.com"
                                        },
                                        "vehiculo": {
                                            "matriculaTractora": "1234BCD",
                                            "matriculaRemolque": "R5678BCD",
                                            "tipo": "Frigorifico"
                                        },
                                        "canalNotificacion": "EMAIL",
                                        "incluirConductorPdf": true,
                                        "conductores": [
                                            {
                                                "dni": "DEMO-CONDUCTOR-01",
                                                "nombre": "Conductor de ejemplo",
                                                "numeroTarjeta": "TARJETA-EJEMPLO",
                                                "notaDeca": "Mercancia refrigerada. Acceso por muelle 2.",
                                                "mostrarNotaDeca": true,
                                                "contactos": [
                                                    {
                                                        "tipoCanal": "EMAIL",
                                                        "valor": "conductor@example.com"
                                                    }
                                                ]
                                            }
                                        ],
                                        "grupos": [
                                            {
                                                "esOrigenCargadorContractual": true,
                                                "destinos": [
                                                    {
                                                        "razonSocial": "Destino de ejemplo",
                                                        "domicilio": "Calle de ejemplo 20, Barcelona",
                                                        "lineasMercancia": [
                                                            {
                                                                "descripcion": "Mercancia de ejemplo",
                                                                "peso": 1200,
                                                                "unidadMedida": "KG",
                                                                "bultos": 24,
                                                                "palets": 2
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ],
                                        "observaciones": "Datos ficticios para una empresa de pruebas."
                                    }
                                },
                                "lote": {
                                    "summary": "Document batch",
                                    "value": {
                                        "documentos": [
                                            {
                                                "numeroDocumento": "EJEMPLO-2026-001",
                                                "transportista": {
                                                    "nif": "DEMO-TRANSPORTISTA",
                                                    "razonSocial": "Transportes de ejemplo",
                                                    "domicilio": "Calle de ejemplo 10, Madrid",
                                                    "email": "transportista@example.com"
                                                },
                                                "vehiculo": {
                                                    "matriculaTractora": "1234BCD",
                                                    "matriculaRemolque": "R5678BCD",
                                                    "tipo": "Frigorifico"
                                                },
                                                "canalNotificacion": "EMAIL",
                                                "incluirConductorPdf": true,
                                                "conductores": [
                                                    {
                                                        "dni": "DEMO-CONDUCTOR-01",
                                                        "nombre": "Conductor de ejemplo",
                                                        "numeroTarjeta": "TARJETA-EJEMPLO",
                                                        "notaDeca": "Mercancia refrigerada. Acceso por muelle 2.",
                                                        "mostrarNotaDeca": true,
                                                        "contactos": [
                                                            {
                                                                "tipoCanal": "EMAIL",
                                                                "valor": "conductor@example.com"
                                                            }
                                                        ]
                                                    }
                                                ],
                                                "grupos": [
                                                    {
                                                        "esOrigenCargadorContractual": true,
                                                        "destinos": [
                                                            {
                                                                "razonSocial": "Destino de ejemplo",
                                                                "domicilio": "Calle de ejemplo 20, Barcelona",
                                                                "lineasMercancia": [
                                                                    {
                                                                        "descripcion": "Mercancia de ejemplo",
                                                                        "peso": 1200,
                                                                        "unidadMedida": "KG",
                                                                        "bultos": 24,
                                                                        "palets": 2
                                                                    }
                                                                ]
                                                            }
                                                        ]
                                                    }
                                                ],
                                                "observaciones": "Datos ficticios para una empresa de pruebas."
                                            }
                                        ]
                                    }
                                },
                                "actualizar": {
                                    "summary": "Update registration and notes while retaining the DeCA",
                                    "value": {
                                        "accion": "actualizar",
                                        "doc_Id": "00000000-0000-4000-8000-000000000001",
                                        "versionEsperada": 1,
                                        "vehiculo": {
                                            "matriculaTractora": "9876XYZ",
                                            "matriculaRemolque": "R5678BCD"
                                        },
                                        "observaciones": "Data corrected from ERP"
                                    }
                                },
                                "actualizarMercancias": {
                                    "summary": "Replace all groups and goods lines",
                                    "value": {
                                        "accion": "actualizar",
                                        "doc_Id": "00000000-0000-4000-8000-000000000001",
                                        "grupos": [
                                            {
                                                "esOrigenCargadorContractual": true,
                                                "destinos": [
                                                    {
                                                        "razonSocial": "Destino de ejemplo",
                                                        "domicilio": "Calle de ejemplo 20, Barcelona",
                                                        "lineasMercancia": [
                                                            {
                                                                "descripcion": "Mercancia de ejemplo",
                                                                "peso": 1200,
                                                                "unidadMedida": "KG",
                                                                "bultos": 24,
                                                                "palets": 2
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful update, unchanged data or recognized retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Exito"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Document created or replaced.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Exito"
                                }
                            }
                        }
                    },
                    "207": {
                        "description": "Batch processed. Check http and resultado for each item; there is no global rollback.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ResultadoLote"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid key or inactive company.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Expired subscription or disabled format.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Source document inaccessible.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Use POST.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Version, replacement, number or idempotency conflict.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "Maximum 2 MB.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "415": {
                        "description": "Use application/json.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid JSON or fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal error. Retry with the same key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "ApiKeyAuth": {
                "type": "apiKey",
                "in": "header",
                "name": "X-Api-Key"
            },
            "BearerAuth": {
                "type": "http",
                "scheme": "bearer"
            },
            "UserApiKeyAuth": {
                "type": "apiKey",
                "in": "header",
                "name": "X-User-Api-Key",
                "description": "Use alone. User access permissions apply."
            }
        },
        "schemas": {
            "Tercero": {
                "type": "object",
                "required": [
                    "razonSocial",
                    "domicilio"
                ],
                "properties": {
                    "razonSocial": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                    },
                    "domicilio": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                    },
                    "nif": {
                        "type": "string",
                        "maxLength": 20,
                        "nullable": true
                    },
                    "contacto": {
                        "type": "string",
                        "maxLength": 150,
                        "nullable": true
                    },
                    "telefono": {
                        "type": "string",
                        "maxLength": 30,
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "maxLength": 150,
                        "nullable": true,
                        "format": "email"
                    }
                }
            },
            "Transportista": {
                "type": "object",
                "required": [
                    "razonSocial",
                    "domicilio",
                    "nif"
                ],
                "properties": {
                    "razonSocial": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                    },
                    "domicilio": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                    },
                    "nif": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                    },
                    "contacto": {
                        "type": "string",
                        "maxLength": 150,
                        "nullable": true
                    },
                    "telefono": {
                        "type": "string",
                        "maxLength": 30,
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "maxLength": 150,
                        "nullable": true,
                        "format": "email"
                    }
                }
            },
            "Vehiculo": {
                "type": "object",
                "required": [
                    "matriculaTractora"
                ],
                "properties": {
                    "matriculaTractora": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 30,
                        "description": "After normalizing spaces and hyphens: 2 to 15 letters or digits."
                    },
                    "matriculaRemolque": {
                        "type": "string",
                        "maxLength": 30,
                        "nullable": true
                    },
                    "tipo": {
                        "type": "string",
                        "maxLength": 80,
                        "nullable": true
                    }
                }
            },
            "Contacto": {
                "type": "object",
                "required": [
                    "tipoCanal",
                    "valor"
                ],
                "properties": {
                    "tipoCanal": {
                        "type": "string",
                        "enum": [
                            "EMAIL",
                            "WHATSAPP",
                            "TELEGRAM",
                            "SMS"
                        ]
                    },
                    "valor": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                    }
                }
            },
            "Conductor": {
                "type": "object",
                "required": [
                    "dni",
                    "nombre"
                ],
                "properties": {
                    "dni": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                    },
                    "nombre": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                    },
                    "numeroTarjeta": {
                        "type": "string",
                        "maxLength": 40,
                        "nullable": true
                    },
                    "notaDeca": {
                        "type": "string",
                        "maxLength": 300,
                        "nullable": true,
                        "description": "Operational note copied to the document. Do not include an ID number, telephone, email or unnecessary private data."
                    },
                    "mostrarNotaDeca": {
                        "type": "boolean",
                        "default": false,
                        "description": "Shows notaDeca next to the name if the document includes drivers in the PDF."
                    },
                    "contactos": {
                        "type": "array",
                        "minItems": 0,
                        "maxItems": 4,
                        "items": {
                            "$ref": "#/components/schemas/Contacto"
                        },
                        "description": "One contact per channel. EMAIL addresses and SMS/WHATSAPP phone numbers are validated."
                    }
                }
            },
            "Mercancia": {
                "type": "object",
                "required": [
                    "descripcion",
                    "peso",
                    "unidadMedida"
                ],
                "properties": {
                    "descripcion": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                    },
                    "peso": {
                        "type": "number",
                        "minimum": 0,
                        "exclusiveMinimum": true,
                        "maximum": 9999999999.99,
                        "multipleOf": 0.01
                    },
                    "unidadMedida": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 30,
                        "description": "KG and T are initially available. By default, other units require company configuration. The company administrator can disable this validation: any code up to 30 characters is accepted and, without a configured factor, PesoKg is not calculated."
                    },
                    "bultos": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 2147483647,
                        "nullable": true
                    },
                    "palets": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 9999999999.99,
                        "multipleOf": 0.01,
                        "nullable": true
                    }
                }
            },
            "Destino": {
                "type": "object",
                "required": [
                    "razonSocial",
                    "domicilio",
                    "lineasMercancia"
                ],
                "properties": {
                    "razonSocial": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 150
                    },
                    "domicilio": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                    },
                    "nif": {
                        "type": "string",
                        "maxLength": 20,
                        "nullable": true
                    },
                    "contacto": {
                        "type": "string",
                        "maxLength": 150,
                        "nullable": true
                    },
                    "telefono": {
                        "type": "string",
                        "maxLength": 30,
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "maxLength": 150,
                        "nullable": true,
                        "format": "email"
                    },
                    "observaciones": {
                        "type": "string",
                        "maxLength": 300,
                        "nullable": true
                    },
                    "lineasMercancia": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 1000,
                        "items": {
                            "$ref": "#/components/schemas/Mercancia"
                        }
                    }
                }
            },
            "Grupo": {
                "oneOf": [
                    {
                        "type": "object",
                        "required": [
                            "esOrigenCargadorContractual",
                            "destinos"
                        ],
                        "properties": {
                            "esOrigenCargadorContractual": {
                                "type": "boolean",
                                "enum": [
                                    true
                                ]
                            },
                            "destinos": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 200,
                                "items": {
                                    "$ref": "#/components/schemas/Destino"
                                }
                            }
                        }
                    },
                    {
                        "type": "object",
                        "required": [
                            "esOrigenCargadorContractual",
                            "origen",
                            "destinos"
                        ],
                        "properties": {
                            "esOrigenCargadorContractual": {
                                "type": "boolean",
                                "enum": [
                                    false
                                ]
                            },
                            "origen": {
                                "$ref": "#/components/schemas/Tercero"
                            },
                            "destinos": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 200,
                                "items": {
                                    "$ref": "#/components/schemas/Destino"
                                }
                            }
                        }
                    }
                ]
            },
            "Documento": {
                "type": "object",
                "required": [
                    "transportista",
                    "vehiculo",
                    "conductores",
                    "grupos",
                    "canalNotificacion"
                ],
                "properties": {
                    "documentoOrigenId": {
                        "type": "string",
                        "maxLength": 36,
                        "nullable": true,
                        "format": "uuid",
                        "description": "GUID of the current NTS document in the same company to replace."
                    },
                    "numeroDocumento": {
                        "type": "string",
                        "maxLength": 40,
                        "nullable": true,
                        "description": "Unique current number per company. Assigned if omitted; retained on replacement."
                    },
                    "fechaTransporte": {
                        "type": "string",
                        "maxLength": 10,
                        "nullable": true,
                        "format": "date",
                        "description": "If omitted, the issue date in Europe/Madrid."
                    },
                    "observaciones": {
                        "type": "string",
                        "maxLength": 500,
                        "nullable": true
                    },
                    "canalNotificacion": {
                        "type": "string",
                        "enum": [
                            "EMAIL",
                            "WHATSAPP",
                            "TELEGRAM",
                            "SMS"
                        ],
                        "description": "The requested channel is recorded; messages are not sent automatically."
                    },
                    "incluirConductorPdf": {
                        "type": "boolean",
                        "default": true,
                        "description": "Includes driver names and authorised notes in the PDF. It never includes an ID number, telephone or email."
                    },
                    "transportista": {
                        "$ref": "#/components/schemas/Transportista"
                    },
                    "vehiculo": {
                        "$ref": "#/components/schemas/Vehiculo"
                    },
                    "conductores": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 2,
                        "items": {
                            "$ref": "#/components/schemas/Conductor"
                        },
                        "description": "Distinct driver IDs."
                    },
                    "grupos": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 100,
                        "items": {
                            "$ref": "#/components/schemas/Grupo"
                        },
                        "description": "Maximum per document: 200 destinations and 1,000 lines."
                    },
                    "cargador": {
                        "$ref": "#/components/schemas/Cargador"
                    },
                    "accion": {
                        "type": "string",
                        "enum": [
                            "crear"
                        ],
                        "default": "crear"
                    }
                }
            },
            "Lote": {
                "type": "object",
                "required": [
                    "documentos"
                ],
                "properties": {
                    "documentos": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 20,
                        "items": {
                            "$ref": "#/components/schemas/OperacionNts"
                        }
                    }
                }
            },
            "Exito": {
                "type": "object",
                "required": [
                    "resultado",
                    "doc_Id",
                    "numeroDocumento",
                    "urlAcceso",
                    "repetido",
                    "incluirConductorPdf",
                    "notificacion",
                    "avisos",
                    "idDeca"
                ],
                "properties": {
                    "resultado": {
                        "type": "string",
                        "enum": [
                            "OK"
                        ]
                    },
                    "doc_Id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "numeroDocumento": {
                        "type": "string"
                    },
                    "urlAcceso": {
                        "type": "string",
                        "format": "uri"
                    },
                    "repetido": {
                        "type": "boolean"
                    },
                    "incluirConductorPdf": {
                        "type": "boolean"
                    },
                    "notificacion": {
                        "type": "object",
                        "required": [
                            "canal",
                            "estado"
                        ],
                        "properties": {
                            "canal": {
                                "type": "string",
                                "enum": [
                                    "EMAIL",
                                    "WHATSAPP",
                                    "TELEGRAM",
                                    "SMS"
                                ]
                            },
                            "estado": {
                                "type": "string",
                                "enum": [
                                    "NO_CONFIGURADO"
                                ]
                            }
                        }
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "numeroEmpresa": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 1,
                        "readOnly": true,
                        "description": "Sequential and immutable DeCA number within a company. Read-only. It does not replace the global ID used in requests and URLs."
                    },
                    "idDeca": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 1,
                        "readOnly": true,
                        "description": "Global DeCA ID, included in every successful response: creations, retries, replacements and updates. It is not numeroEmpresa."
                    },
                    "numVersion": {
                        "type": "integer",
                        "nullable": true,
                        "description": "Current PDF version after updating; null for a trip without a date."
                    },
                    "cambiado": {
                        "type": "boolean",
                        "description": "Whether the update operation saved changes."
                    },
                    "pdfDisponible": {
                        "type": "boolean"
                    }
                }
            },
            "Error": {
                "type": "object",
                "required": [
                    "resultado",
                    "errores"
                ],
                "properties": {
                    "http": {
                        "type": "integer"
                    },
                    "resultado": {
                        "type": "string"
                    },
                    "errores": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "campo",
                                "mensaje"
                            ],
                            "properties": {
                                "campo": {
                                    "type": "string"
                                },
                                "mensaje": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "ResultadoLote": {
                "type": "object",
                "required": [
                    "resultado",
                    "documentos"
                ],
                "properties": {
                    "resultado": {
                        "type": "string",
                        "enum": [
                            "LOTE_PROCESADO"
                        ]
                    },
                    "documentos": {
                        "type": "array",
                        "items": {
                            "allOf": [
                                {
                                    "type": "object",
                                    "required": [
                                        "indice",
                                        "http"
                                    ],
                                    "properties": {
                                        "indice": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "http": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/Exito"
                                        },
                                        {
                                            "$ref": "#/components/schemas/Error"
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                }
            },
            "Cargador": {
                "oneOf": [
                    {
                        "type": "object",
                        "required": [
                            "idCliente"
                        ],
                        "properties": {
                            "idCliente": {
                                "type": "integer",
                                "minimum": 1,
                                "description": "Active entity in the same company with the customer/consignor role."
                            }
                        }
                    },
                    {
                        "type": "object",
                        "required": [
                            "razonSocial",
                            "domicilio",
                            "nif"
                        ],
                        "properties": {
                            "razonSocial": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 150
                            },
                            "domicilio": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                            },
                            "nif": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 20
                            },
                            "contacto": {
                                "type": "string",
                                "maxLength": 150,
                                "nullable": true
                            },
                            "telefono": {
                                "type": "string",
                                "maxLength": 30,
                                "nullable": true
                            },
                            "email": {
                                "type": "string",
                                "maxLength": 150,
                                "nullable": true,
                                "format": "email"
                            }
                        }
                    }
                ],
                "description": "Optional. Use either idCliente or full details. When omitted, backwards-compatible behaviour is retained and the account company acts as the contractual consignor."
            },
            "Actualizacion": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "accion"
                ],
                "anyOf": [
                    {
                        "required": [
                            "doc_Id"
                        ]
                    },
                    {
                        "required": [
                            "id"
                        ]
                    }
                ],
                "properties": {
                    "numeroDocumento": {
                        "type": "string",
                        "maxLength": 40,
                        "nullable": true,
                        "description": "When supplied it must match the original. Updates retain this number."
                    },
                    "fechaTransporte": {
                        "type": "string",
                        "maxLength": 10,
                        "nullable": true,
                        "format": "date",
                        "description": "Omit to retain the date. null makes the trip pending and generates no PDF; earlier versions remain stored."
                    },
                    "observaciones": {
                        "type": "string",
                        "maxLength": 500,
                        "nullable": true
                    },
                    "canalNotificacion": {
                        "type": "string",
                        "enum": [
                            "EMAIL",
                            "WHATSAPP",
                            "TELEGRAM",
                            "SMS"
                        ],
                        "description": "The requested channel is recorded; messages are not sent automatically."
                    },
                    "incluirConductorPdf": {
                        "type": "boolean",
                        "default": true,
                        "description": "Includes driver names and authorised notes in the PDF. It never includes an ID number, telephone or email."
                    },
                    "transportista": {
                        "$ref": "#/components/schemas/Transportista"
                    },
                    "vehiculo": {
                        "type": "object",
                        "properties": {
                            "matriculaTractora": {
                                "type": "string",
                                "maxLength": 30,
                                "nullable": true
                            },
                            "matriculaRemolque": {
                                "type": "string",
                                "maxLength": 30,
                                "nullable": true
                            },
                            "tipo": {
                                "type": "string",
                                "maxLength": 80,
                                "nullable": true
                            }
                        },
                        "description": "Only supplied fields change. null clears a registration."
                    },
                    "conductores": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 2,
                        "items": {
                            "$ref": "#/components/schemas/Conductor"
                        },
                        "description": "Distinct driver IDs."
                    },
                    "grupos": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 100,
                        "items": {
                            "$ref": "#/components/schemas/Grupo"
                        },
                        "description": "Maximum per document: 200 destinations and 1,000 lines."
                    },
                    "cargador": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Cargador"
                            },
                            {
                                "type": "object",
                                "nullable": true,
                                "enum": [
                                    null
                                ]
                            }
                        ],
                        "description": "Full details, idCliente or null to use the account holder again. Omit to retain the consignor."
                    },
                    "accion": {
                        "type": "string",
                        "enum": [
                            "actualizar"
                        ]
                    },
                    "doc_Id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "GUID of the current document. Alternative to id."
                    },
                    "id": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647,
                        "description": "Global DeCA ID, not numeroEmpresa. Alternative to doc_Id; when both are supplied they must match."
                    },
                    "versionEsperada": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Optional. Returns 409 if it does not match the latest stored PDF version."
                    }
                },
                "description": "Omitted fields remain unchanged. grupos and conductores replace their complete lists; cargador and transportista are complete objects. Do not send documentoOrigenId. Unchanged data does not create a version."
            },
            "OperacionNts": {
                "oneOf": [
                    {
                        "$ref": "#/components/schemas/Documento"
                    },
                    {
                        "$ref": "#/components/schemas/Actualizacion"
                    }
                ]
            }
        }
    }
}
