{"openapi":"3.1.0","info":{"title":"API de DeCarretera","version":"1.0.0","description":"Crea, emite, modifica y consulta documentos de control (DeCA) y, para empresas de autobuses, hojas de ruta. Guía completa: https://decarretera.es/desarrolladores/api"},"servers":[{"url":"https://decarretera.es/api/v1"}],"security":[{"apiKey":[]}],"tags":[{"name":"Cuenta"},{"name":"Servicios"},{"name":"Hojas de ruta"},{"name":"Documento"},{"name":"Firmas"},{"name":"Fotos","description":"Fotos adjuntas al servicio por el conductor desde su enlace o por la oficina al rellenar el DeCA (prueba de carga y descarga, documentos del puerto…). Hasta 5 por servicio, en JPEG."},{"name":"Avisos"},{"name":"Directorio"},{"name":"Webhooks"}],"paths":{"/me":{"get":{"tags":["Cuenta"],"summary":"Empresa, plan y permisos de la clave","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Me"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services":{"get":{"tags":["Servicios"],"summary":"Listar servicios","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["draft","pending_delivery","ready","updated_unnotified","finished","exempt","cancelled"]}},{"name":"reference","in":"query","schema":{"type":"string"}},{"name":"date_from","in":"query","schema":{"type":"string","format":"date"}},{"name":"date_to","in":"query","schema":{"type":"string","format":"date"}},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ServiceSummary"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Servicios"],"summary":"Crear un servicio (y emitir el DeCA con intent=issue)","parameters":[{"$ref":"#/components/parameters/idempotency"},{"$ref":"#/components/parameters/include"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceCreate"}}}},"responses":{"201":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}":{"get":{"tags":["Servicios"],"summary":"Ver un servicio","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/include"}],"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Servicios"],"summary":"Cambiar un borrador (solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/service"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ServiceInput"},{"type":"object","properties":{"intent":{"type":"string","enum":["draft","issue"]}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Servicios"],"summary":"Borrar un borrador","parameters":[{"$ref":"#/components/parameters/service"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/issue":{"post":{"tags":["Servicios"],"summary":"Emitir el documento de un borrador","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/revisions":{"post":{"tags":["Servicios"],"summary":"Modificar un documento emitido","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ServiceInput"},{"type":"object","required":["reason_code"],"properties":{"mode":{"type":"string","enum":["correct","reissue"],"default":"correct"},"reason_code":{"type":"string","enum":["vehicle_change","shipper_data_correction","destination_change","weight_or_goods_change","other"]},"reason_text":{"type":"string","maxLength":500,"description":"Obligatorio con reason_code=other."}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/deliveries":{"post":{"tags":["Servicios"],"summary":"Registrar la entrega al conductor (no envía nada)","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel"],"properties":{"channel":{"type":"string","enum":["whatsapp","email","link","printed"]},"confirmed":{"type":"boolean","description":"El conductor ya tiene el documento."}}}}}},"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/finish":{"post":{"tags":["Servicios"],"summary":"Finalizar","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/cancel":{"post":{"tags":["Servicios"],"summary":"Anular","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/exempt":{"post":{"tags":["Servicios"],"summary":"Marcar un borrador como exento","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["exemption_reason"],"properties":{"exemption_reason":{"type":"string","enum":["international","private_complementary","no_license_required","removals","damaged_vehicles","parcels"]},"exemption_notes":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/document.pdf":{"get":{"tags":["Documento"],"summary":"PDF vigente (o ?version=N)","parameters":[{"$ref":"#/components/parameters/service"},{"name":"version","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/qr.png":{"get":{"tags":["Documento"],"summary":"QR en PNG","parameters":[{"$ref":"#/components/parameters/service"},{"name":"size","in":"query","schema":{"type":"integer","minimum":128,"maximum":2048,"default":1024}}],"responses":{"200":{"description":"PNG","content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/dossier.zip":{"get":{"tags":["Documento"],"summary":"Expediente completo (ZIP)","parameters":[{"$ref":"#/components/parameters/service"}],"responses":{"200":{"description":"ZIP","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/photos":{"get":{"tags":["Fotos"],"summary":"Listar las fotos del servicio","parameters":[{"$ref":"#/components/parameters/service"}],"responses":{"200":{"description":"Fotos, de la más antigua a la más reciente","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ServicePhoto"}},"zip_url":{"type":"string"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/photos/{photo}":{"get":{"tags":["Fotos"],"summary":"Descargar una foto (JPEG)","parameters":[{"$ref":"#/components/parameters/service"},{"name":"photo","in":"path","required":true,"schema":{"type":"integer"},"description":"id de la foto en el listado."}],"responses":{"200":{"description":"JPEG","content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/photos.zip":{"get":{"tags":["Fotos"],"summary":"Descargar todas las fotos (ZIP)","parameters":[{"$ref":"#/components/parameters/service"}],"responses":{"200":{"description":"ZIP","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/signatures":{"post":{"tags":["Firmas"],"summary":"Añadir una firma","parameters":[{"$ref":"#/components/parameters/service"},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["party","signer_name","signature"],"properties":{"party":{"type":"string","enum":["shipper","carrier","contractual","additional"]},"signer_name":{"type":"string","maxLength":120},"signer_nif":{"type":"string","maxLength":20},"signer_company":{"type":"string","maxLength":160,"description":"Obligatorio en la firma adicional (additional): empresa por la que firma."},"signature":{"type":"string","description":"PNG en base64 o data:image/png;base64,…"}}}}}},"responses":{"201":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/services/{service}/signatures/{party}":{"delete":{"tags":["Firmas"],"summary":"Borrar una firma","parameters":[{"$ref":"#/components/parameters/service"},{"name":"party","in":"path","required":true,"schema":{"type":"string","enum":["shipper","carrier","contractual","additional"]}}],"responses":{"200":{"$ref":"#/components/responses/Service"},"default":{"$ref":"#/components/responses/Error"}}}},"/notices":{"get":{"tags":["Avisos"],"summary":"Avisos del conductor","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["open","resolved","all"],"default":"open"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Notice"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/notices/{notice}/resolve":{"post":{"tags":["Avisos"],"summary":"Resolver un aviso","parameters":[{"name":"notice","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Notice"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/webhook-events":{"get":{"tags":["Webhooks"],"summary":"Eventos disponibles","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string","enum":["service.created","service.issued","service.corrected","service.reissued","service.delivery_sent","service.delivery_confirmed","service.finished","service.cancelled","service.exempted","notice.received","notice.resolved","signature.created","signature.removed","photos.added"]},"description":{"type":"string"}}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets":{"get":{"tags":["Hojas de ruta"],"summary":"Listar hojas de ruta","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["draft","pending_delivery","ready","updated_unnotified","finished","exempt","cancelled"]}},{"name":"reference","in":"query","schema":{"type":"string"}},{"name":"date_from","in":"query","schema":{"type":"string","format":"date"}},{"name":"date_to","in":"query","schema":{"type":"string","format":"date"}},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RouteSheetSummary"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Hojas de ruta"],"summary":"Crear una hoja de ruta (y emitirla con intent=issue)","parameters":[{"$ref":"#/components/parameters/idempotency"},{"$ref":"#/components/parameters/include"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/RouteSheetInput"},{"type":"object","properties":{"intent":{"type":"string","enum":["draft","issue","exempt"],"default":"draft"},"exemption_reason":{"type":"string","enum":["regular_general_use","regular_special_use"]},"exemption_notes":{"type":"string"}}}]}}}},"responses":{"201":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}":{"get":{"tags":["Hojas de ruta"],"summary":"Ver una hoja de ruta","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/include"}],"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Hojas de ruta"],"summary":"Cambiar un borrador (solo lo que cambia)","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteSheetInput"}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Hojas de ruta"],"summary":"Borrar un borrador","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/issue":{"post":{"tags":["Hojas de ruta"],"summary":"Emitir un borrador","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/revisions":{"post":{"tags":["Hojas de ruta"],"summary":"Modificar una hoja emitida","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/RouteSheetInput"},{"type":"object","required":["reason_code"],"properties":{"mode":{"type":"string","enum":["correct","reissue"],"default":"correct"},"reason_code":{"type":"string","enum":["vehicle_change","driver_change","contractor_data_correction","route_or_date_change","other"]},"reason_text":{"type":"string","maxLength":500}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/stops":{"post":{"tags":["Hojas de ruta"],"summary":"Anotar paradas intermedias realizadas","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["stops"],"properties":{"stops":{"type":"array","maxItems":20,"items":{"type":"object","required":["trip_id","place","stopped_at"],"properties":{"trip_id":{"type":"integer","description":"id del servicio dentro de la hoja (trips[].id)."},"place":{"type":"string"},"stopped_at":{"type":"string","format":"date-time","description":"Hora de la parada. No puede ser futura."}}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/stops/{stop}/void":{"post":{"tags":["Hojas de ruta"],"summary":"Anular una parada anotada por error","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"name":"stop","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/deliveries":{"post":{"tags":["Hojas de ruta"],"summary":"Registrar la entrega al conductor (no envía nada)","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel"],"properties":{"channel":{"type":"string","enum":["whatsapp","email","link","printed"]},"confirmed":{"type":"boolean"}}}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/finish":{"post":{"tags":["Hojas de ruta"],"summary":"Finalizar","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/cancel":{"post":{"tags":["Hojas de ruta"],"summary":"Anular","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/exempt":{"post":{"tags":["Hojas de ruta"],"summary":"Marcar un borrador como exento","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["exemption_reason"],"properties":{"exemption_reason":{"type":"string","enum":["regular_general_use","regular_special_use"]},"exemption_notes":{"type":"string"}}}}}},"responses":{"200":{"$ref":"#/components/responses/RouteSheet"},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/document.pdf":{"get":{"tags":["Hojas de ruta"],"summary":"PDF vigente (o ?version=N)","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/qr.png":{"get":{"tags":["Hojas de ruta"],"summary":"QR en PNG","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}}],"responses":{"200":{"description":"PNG","content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/route-sheets/{service}/dossier.zip":{"get":{"tags":["Hojas de ruta"],"summary":"Expediente completo (ZIP)","parameters":[{"name":"service","in":"path","required":true,"description":"id de la hoja de ruta","schema":{"type":"string"}}],"responses":{"200":{"description":"ZIP","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/shippers":{"get":{"tags":["Directorio"],"summary":"Listar (shippers)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Shipper"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (shippers)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShipperInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Shipper"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/shippers/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (shippers)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Shipper"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (shippers, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShipperInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Shipper"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (shippers)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/carriers":{"get":{"tags":["Directorio"],"summary":"Listar (carriers)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Carrier"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (carriers)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CarrierInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Carrier"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/carriers/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (carriers)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Carrier"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (carriers, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CarrierInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Carrier"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (carriers)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/vehicles":{"get":{"tags":["Directorio"],"summary":"Listar (vehicles)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Vehicle"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (vehicles)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VehicleInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Vehicle"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/vehicles/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (vehicles)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Vehicle"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (vehicles, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VehicleInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Vehicle"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (vehicles)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/drivers":{"get":{"tags":["Directorio"],"summary":"Listar (drivers)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Driver"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (drivers)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriverInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Driver"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/drivers/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (drivers)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Driver"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (drivers, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriverInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Driver"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (drivers)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/places":{"get":{"tags":["Directorio"],"summary":"Listar (places)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Place"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (places)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Place"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/places/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (places)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Place"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (places, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Place"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (places)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/saved-routes":{"get":{"tags":["Directorio"],"summary":"Listar (saved-routes)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SavedRoute"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (saved-routes)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedRouteInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SavedRoute"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/saved-routes/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (saved-routes)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SavedRoute"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (saved-routes, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedRouteInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SavedRoute"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (saved-routes)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}},"/contracting-parties":{"get":{"tags":["Directorio"],"summary":"Listar (contracting-parties)","parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Lista paginada","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ContractingParty"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Directorio"],"summary":"Crear (contracting-parties)","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractingPartyInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractingParty"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/contracting-parties/{id}":{"get":{"tags":["Directorio"],"summary":"Ver (contracting-parties)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractingParty"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Directorio"],"summary":"Cambiar (contracting-parties, solo lo que cambia)","parameters":[{"$ref":"#/components/parameters/id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractingPartyInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContractingParty"}}}}}},"default":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Directorio"],"summary":"Borrar (contracting-parties)","parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Clave API de Desarrolladores › Claves API (empieza por deca_)."}},"parameters":{"id":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"service":{"name":"service","in":"path","required":true,"description":"id del servicio","schema":{"type":"string"}},"page":{"name":"page","in":"query","schema":{"type":"integer","minimum":1}},"per_page":{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},"idempotency":{"name":"Idempotency-Key","in":"header","description":"Hace seguro reintentar: misma clave y mismos datos devuelven la misma respuesta durante 24 h.","schema":{"type":"string","maxLength":255}},"include":{"name":"include","in":"query","description":"«qr» añade document.qr_png_base64.","schema":{"type":"string","enum":["qr"]}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Service":{"description":"El servicio","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Service"}}}}}},"RouteSheet":{"description":"La hoja de ruta","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RouteSheet"}}}}}},"NoContent":{"description":"Hecho, sin contenido"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}},"Me":{"type":"object","properties":{"company":{"type":"object","properties":{"name":{"type":"string"},"nif":{"type":["string","null"]},"plan":{"type":"string"},"plan_name":{"type":"string"},"included_documents":{"type":"integer"}}},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"access":{"type":"string","enum":["read","write"]}}}}},"ServiceSummary":{"type":"object","properties":{"id":{"type":"string"},"reference":{"type":"string"},"status":{"type":"string","enum":["draft","pending_delivery","ready","updated_unnotified","finished","exempt","cancelled"]},"status_label":{"type":"string"},"transport_date":{"type":["string","null"]},"departure_time":{"type":["string","null"]},"shipper_name":{"type":["string","null"]},"carrier_name":{"type":["string","null"]},"origin":{"type":["string","null"]},"destination":{"type":["string","null"]},"tractor_plate":{"type":["string","null"]},"trailer_plate":{"type":["string","null"]},"driver_name":{"type":["string","null"]},"issued_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"document":{"type":["object","null"],"properties":{"public_url":{"type":"string","description":"Enlace del QR: descarga el PDF vigente sin clave."},"version":{"type":"integer"},"signed":{"type":"boolean"},"pdf_url":{"type":"string"},"qr_png_url":{"type":"string"},"sha256":{"type":"string"},"generated_at":{"type":"string"},"signed_at":{"type":["string","null"]},"dossier_url":{"type":"string"},"qr_png_base64":{"type":["string","null"],"description":"Solo con ?include=qr."}}}}},"Service":{"type":"object","properties":{"id":{"type":"string"},"reference":{"type":"string"},"status":{"type":"string","enum":["draft","pending_delivery","ready","updated_unnotified","finished","exempt","cancelled"]},"status_label":{"type":"string"},"transport_date":{"type":["string","null"]},"departure_time":{"type":["string","null"]},"shipper_name":{"type":["string","null"]},"carrier_name":{"type":["string","null"]},"origin":{"type":["string","null"]},"destination":{"type":["string","null"]},"tractor_plate":{"type":["string","null"]},"trailer_plate":{"type":["string","null"]},"driver_name":{"type":["string","null"]},"issued_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"document":{"type":["object","null"],"properties":{"public_url":{"type":"string","description":"Enlace del QR: descarga el PDF vigente sin clave."},"version":{"type":"integer"},"signed":{"type":"boolean"},"pdf_url":{"type":"string"},"qr_png_url":{"type":"string"},"sha256":{"type":"string"},"generated_at":{"type":"string"},"signed_at":{"type":["string","null"]},"dossier_url":{"type":"string"},"qr_png_base64":{"type":["string","null"],"description":"Solo con ?include=qr."}}},"issuer_role":{"type":"string","enum":["effective_carrier","contractual_shipper"]},"shipper":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]},"nif":{"type":["string","null"]},"address":{"type":["string","null"]}}},"consignee":{"type":"object","properties":{"differs":{"type":"boolean"},"id":{"type":["string","null"]},"name":{"type":["string","null"]},"nif":{"type":["string","null"]},"address":{"type":["string","null"]}}},"carrier":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]},"nif":{"type":["string","null"]},"address":{"type":["string","null"]}}},"vehicle":{"type":"object","properties":{"tractor_plate":{"type":["string","null"]},"kind":{"type":["string","null"]},"kind_label":{"type":["string","null"]},"is_articulated":{"type":"boolean"},"trailer_plate":{"type":["string","null"]}}},"driver":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"portal_url":{"type":["string","null"]}}},"package_count":{"type":["integer","null"]},"finish_time":{"type":["string","null"]},"distance_km":{"type":["integer","null"]},"special_permit":{"type":["string","null"]},"observations":{"type":["string","null"]},"shipments":{"type":"array","items":{"type":"object","properties":{"origin":{"type":"string"},"destination":{"type":"string"},"origin_place_id":{"type":["string","null"],"description":"Id público de una dirección del directorio. La línea impresa se copia en origin."},"destination_place_id":{"type":["string","null"],"description":"Id público de una dirección del directorio. La línea impresa se copia en destination."},"goods_description":{"type":"string"},"weight_value":{"type":["number","null"]},"weight_unit":{"type":"string","enum":["kg","t","pallets","packages","m3","containers","units"]},"vehicles":{"type":["array","null"],"maxItems":20,"description":"Portacoches: los coches que forman la carga. Opcional; el peso sigue siendo obligatorio.","items":{"type":"object","required":["plate"],"properties":{"plate":{"type":"string"},"vin":{"type":["string","null"]},"model":{"type":["string","null"]}}}},"notes":{"type":["string","null"]}}}},"missing":{"type":"object","additionalProperties":{"type":"string"},"description":"En borradores, lo que falta para emitir."},"exemption":{"type":["object","null"]},"cancellation":{"type":["object","null"]},"issued_late":{"type":"boolean"},"finished_at":{"type":["string","null"]},"delivery":{"type":["object","null"],"properties":{"driver_has_document":{"type":"boolean"},"confirmed_at":{"type":["string","null"]},"message":{"type":"string"},"whatsapp_url":{"type":["string","null"]}}},"signatures":{"type":"object","properties":{"shipper":{"type":"object","properties":{"signed":{"type":"boolean"},"signer_name":{"type":["string","null"]},"signer_nif":{"type":["string","null"]},"signer_company":{"type":["string","null"]},"signed_at":{"type":["string","null"]},"signing_url":{"type":["string","null"],"description":"Enlace para que esa parte firme desde su móvil."}}},"carrier":{"type":"object","properties":{"signed":{"type":"boolean"},"signer_name":{"type":["string","null"]},"signer_nif":{"type":["string","null"]},"signer_company":{"type":["string","null"]},"signed_at":{"type":["string","null"]},"signing_url":{"type":["string","null"],"description":"Enlace para que esa parte firme desde su móvil."}}},"contractual":{"type":"object","properties":{"signed":{"type":"boolean"},"signer_name":{"type":["string","null"]},"signer_nif":{"type":["string","null"]},"signer_company":{"type":["string","null"]},"signed_at":{"type":["string","null"]},"signing_url":{"type":["string","null"],"description":"Enlace para que esa parte firme desde su móvil."}}},"additional":{"type":"object","properties":{"signed":{"type":"boolean"},"signer_name":{"type":["string","null"]},"signer_nif":{"type":["string","null"]},"signer_company":{"type":["string","null"]},"signed_at":{"type":["string","null"]},"signing_url":{"type":["string","null"],"description":"Enlace para que esa parte firme desde su móvil."}}}}},"open_notices":{"type":"integer"},"photos":{"type":"object","properties":{"count":{"type":"integer"},"zip_url":{"type":["string","null"]},"items":{"type":"array","items":{"$ref":"#/components/schemas/ServicePhoto"}}}}}},"ServicePhoto":{"type":"object","properties":{"id":{"type":"integer"},"file_name":{"type":"string"},"taken_at":{"type":"string","format":"date-time","description":"Cuándo se subió."},"uploaded_by":{"type":["string","null"],"description":"Quién la subió: el conductor o la persona de la oficina."},"width":{"type":"integer"},"height":{"type":"integer"},"size_bytes":{"type":"integer"},"content_type":{"type":"string","enum":["image/jpeg"]},"download_url":{"type":"string"}}},"ServiceInput":{"type":"object","properties":{"issuer_role":{"type":"string","enum":["effective_carrier","contractual_shipper"]},"shipper_id":{"type":"string","description":"id de un cargador del directorio."},"shipper_name":{"type":"string"},"shipper_nif":{"type":"string"},"shipper_address":{"type":"string"},"shipper_email":{"type":"string","format":"email"},"save_shipper":{"type":"boolean"},"consignee_differs":{"type":"boolean","description":"El destinatario es otra persona que el cargador contractual. Cada dato es opcional."},"signatory":{"type":"string","enum":["consignee","shipper","chosen"],"description":"Quién firma como destinatario: el destinatario del envío, el cargador contractual u otro destinatario del directorio."},"signatory_consignee_id":{"type":"string","description":"id de un destinatario del directorio, cuando signatory es chosen."},"signatory_name":{"type":"string"},"signatory_nif":{"type":"string"},"signatory_email":{"type":"string","format":"email","description":"Correo de quien firma. Si está, el PDF se envía solo al emitir."},"consignee_id":{"type":"string","description":"id de un destinatario del directorio."},"consignee_name":{"type":"string"},"consignee_nif":{"type":"string"},"consignee_address":{"type":"string"},"consignee_email":{"type":"string","format":"email"},"save_consignee":{"type":"boolean"},"carrier_id":{"type":"string"},"carrier_name":{"type":"string"},"carrier_nif":{"type":"string"},"carrier_address":{"type":"string"},"carrier_email":{"type":"string","format":"email"},"save_carrier":{"type":"boolean"},"transport_date":{"type":"string","format":"date"},"departure_time":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"package_count":{"type":"integer","minimum":1,"description":"Número de bultos. Opcional; si se indica, sale en el PDF."},"finish_time":{"type":"string","pattern":"^\\d{2}:\\d{2}$","description":"Hora de finalización, HH:MM. Opcional."},"distance_km":{"type":"integer","minimum":1,"description":"Kilómetros a realizar. Opcional."},"tractor_plate":{"type":"string"},"vehicle_kind":{"type":"string","enum":["rigid","box_truck","refrigerated","tanker","car_carrier","articulated","tractor","van","car","industrial_car","other"],"description":"Tipo de vehículo. Si no se indica, el del directorio o, si no está, tractora o camión rígido según haya remolque."},"vehicle_kind_other":{"type":"string","maxLength":60,"description":"Obligatorio con vehicle_kind = other: qué tipo es."},"is_articulated":{"type":"boolean"},"trailer_plate":{"type":"string"},"save_vehicles":{"type":"boolean"},"driver_id":{"type":"string","description":"id de un conductor del directorio."},"driver_name":{"type":"string"},"driver_phone":{"type":"string","description":"Opcional, recomendado. WhatsApp del conductor."},"driver_email":{"type":"string","format":"email"},"special_permit":{"type":"string"},"observations":{"type":"string"},"shipments":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"origin":{"type":"string"},"destination":{"type":"string"},"origin_place_id":{"type":["string","null"],"description":"Id público de una dirección del directorio. La línea impresa se copia en origin."},"destination_place_id":{"type":["string","null"],"description":"Id público de una dirección del directorio. La línea impresa se copia en destination."},"goods_description":{"type":"string"},"weight_value":{"type":["number","null"]},"weight_unit":{"type":"string","enum":["kg","t","pallets","packages","m3","containers","units"]},"vehicles":{"type":["array","null"],"maxItems":20,"description":"Portacoches: los coches que forman la carga. Opcional; el peso sigue siendo obligatorio.","items":{"type":"object","required":["plate"],"properties":{"plate":{"type":"string"},"vin":{"type":["string","null"]},"model":{"type":["string","null"]}}}},"notes":{"type":["string","null"]}}}}}},"ServiceCreate":{"allOf":[{"type":"object","properties":{"issuer_role":{"type":"string","enum":["effective_carrier","contractual_shipper"]},"shipper_id":{"type":"string","description":"id de un cargador del directorio."},"shipper_name":{"type":"string"},"shipper_nif":{"type":"string"},"shipper_address":{"type":"string"},"shipper_email":{"type":"string","format":"email"},"save_shipper":{"type":"boolean"},"consignee_differs":{"type":"boolean","description":"El destinatario es otra persona que el cargador contractual. Cada dato es opcional."},"signatory":{"type":"string","enum":["consignee","shipper","chosen"],"description":"Quién firma como destinatario: el destinatario del envío, el cargador contractual u otro destinatario del directorio."},"signatory_consignee_id":{"type":"string","description":"id de un destinatario del directorio, cuando signatory es chosen."},"signatory_name":{"type":"string"},"signatory_nif":{"type":"string"},"signatory_email":{"type":"string","format":"email","description":"Correo de quien firma. Si está, el PDF se envía solo al emitir."},"consignee_id":{"type":"string","description":"id de un destinatario del directorio."},"consignee_name":{"type":"string"},"consignee_nif":{"type":"string"},"consignee_address":{"type":"string"},"consignee_email":{"type":"string","format":"email"},"save_consignee":{"type":"boolean"},"carrier_id":{"type":"string"},"carrier_name":{"type":"string"},"carrier_nif":{"type":"string"},"carrier_address":{"type":"string"},"carrier_email":{"type":"string","format":"email"},"save_carrier":{"type":"boolean"},"transport_date":{"type":"string","format":"date"},"departure_time":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"package_count":{"type":"integer","minimum":1,"description":"Número de bultos. Opcional; si se indica, sale en el PDF."},"finish_time":{"type":"string","pattern":"^\\d{2}:\\d{2}$","description":"Hora de finalización, HH:MM. Opcional."},"distance_km":{"type":"integer","minimum":1,"description":"Kilómetros a realizar. Opcional."},"tractor_plate":{"type":"string"},"vehicle_kind":{"type":"string","enum":["rigid","box_truck","refrigerated","tanker","car_carrier","articulated","tractor","van","car","industrial_car","other"],"description":"Tipo de vehículo. Si no se indica, el del directorio o, si no está, tractora o camión rígido según haya remolque."},"vehicle_kind_other":{"type":"string","maxLength":60,"description":"Obligatorio con vehicle_kind = other: qué tipo es."},"is_articulated":{"type":"boolean"},"trailer_plate":{"type":"string"},"save_vehicles":{"type":"boolean"},"driver_id":{"type":"string","description":"id de un conductor del directorio."},"driver_name":{"type":"string"},"driver_phone":{"type":"string","description":"Opcional, recomendado. WhatsApp del conductor."},"driver_email":{"type":"string","format":"email"},"special_permit":{"type":"string"},"observations":{"type":"string"},"shipments":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"origin":{"type":"string"},"destination":{"type":"string"},"origin_place_id":{"type":["string","null"],"description":"Id público de una dirección del directorio. La línea impresa se copia en origin."},"destination_place_id":{"type":["string","null"],"description":"Id público de una dirección del directorio. La línea impresa se copia en destination."},"goods_description":{"type":"string"},"weight_value":{"type":["number","null"]},"weight_unit":{"type":"string","enum":["kg","t","pallets","packages","m3","containers","units"]},"vehicles":{"type":["array","null"],"maxItems":20,"description":"Portacoches: los coches que forman la carga. Opcional; el peso sigue siendo obligatorio.","items":{"type":"object","required":["plate"],"properties":{"plate":{"type":"string"},"vin":{"type":["string","null"]},"model":{"type":["string","null"]}}}},"notes":{"type":["string","null"]}}}}}},{"type":"object","properties":{"intent":{"type":"string","enum":["draft","issue","exempt"],"default":"draft"},"exemption_reason":{"type":"string","enum":["international","private_complementary","no_license_required","removals","damaged_vehicles","parcels"]},"exemption_notes":{"type":"string"}}}]},"Notice":{"type":"object","properties":{"id":{"type":"string"},"service_id":{"type":["string","null"]},"service_reference":{"type":["string","null"]},"driver_name":{"type":["string","null"]},"type":{"type":"string","enum":["vehicle_change","destination_change","quantity_change","driver_change","incident"]},"type_label":{"type":"string"},"payload":{"type":"object","properties":{"weight_value":{"type":["number","null"]},"weight_unit":{"type":"string","enum":["kg","t","pallets","packages","m3","containers","units"]},"current_weight_value":{"type":["number","null"]},"current_weight_unit":{"type":["string","null"]},"shipment_id":{"type":["integer","null"]},"shipment_position":{"type":["integer","null"]}}},"message":{"type":["string","null"]},"created_at":{"type":"string"},"resolved_at":{"type":["string","null"]}}},"Shipper":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"nif":{"type":"string"},"address":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"send_copy_by_email":{"type":"boolean"}}},"ShipperInput":{"type":"object","properties":{"name":{"type":"string"},"nif":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"send_copy_by_email":{"type":"boolean"}}},"Carrier":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"nif":{"type":"string"},"address":{"type":["string","null"]},"email":{"type":["string","null"]},"send_copy_by_email":{"type":"boolean"}}},"CarrierInput":{"type":"object","properties":{"name":{"type":"string"},"nif":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"send_copy_by_email":{"type":"boolean"}}},"Vehicle":{"type":"object","properties":{"id":{"type":"string"},"plate":{"type":"string"},"kind":{"type":"string","enum":["rigid","box_truck","refrigerated","tanker","car_carrier","articulated","tractor","van","car","industrial_car","trailer","other"]},"kind_other":{"type":["string","null"]},"kind_label":{"type":"string"},"description":{"type":["string","null"]},"special_permit":{"type":["string","null"]}}},"VehicleInput":{"type":"object","properties":{"plate":{"type":"string"},"kind":{"type":"string","enum":["rigid","box_truck","refrigerated","tanker","car_carrier","articulated","tractor","van","car","industrial_car","trailer","other"]},"kind_other":{"type":"string","description":"Obligatorio con kind = other."},"description":{"type":"string"},"special_permit":{"type":"string"}}},"Driver":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"nif":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"portal_url":{"type":"string"}}},"DriverInput":{"type":"object","properties":{"name":{"type":"string"},"nif":{"type":"string"},"phone":{"type":"string","description":"Opcional, recomendado. WhatsApp del conductor."},"email":{"type":"string"}}},"SavedRoute":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"shipper_id":{"type":["string","null"]},"origin":{"type":"string"},"destination":{"type":"string"},"goods_description":{"type":["string","null"]},"weight_value":{"type":["number","null"]},"weight_unit":{"type":"string"}}},"Place":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"street":{"type":["string","null"]},"postal_code":{"type":["string","null"]},"locality":{"type":["string","null"]},"province":{"type":["string","null"]},"line":{"type":"string"}}},"PlaceInput":{"type":"object","properties":{"name":{"type":"string"},"street":{"type":"string"},"postal_code":{"type":"string"},"locality":{"type":"string"},"province":{"type":"string"}}},"ContractingParty":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tax_id":{"type":"string","description":"NIF, CIF, CIT o número de IVA extranjero."},"email":{"type":["string","null"]},"phone":{"type":["string","null"]}}},"ContractingPartyInput":{"type":"object","properties":{"name":{"type":"string"},"tax_id":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}}},"RouteSheetSummary":{"type":"object","properties":{"id":{"type":"string"},"reference":{"type":"string"},"status":{"type":"string"},"status_label":{"type":"string"},"first_trip_date":{"type":["string","null"]},"departure_time":{"type":["string","null"]},"contractor_name":{"type":["string","null"]},"origin":{"type":["string","null"]},"destination":{"type":["string","null"]},"trips_count":{"type":"integer"},"bus_plate":{"type":["string","null"]},"driver_name":{"type":["string","null"]},"issued_at":{"type":["string","null"]},"document":{"type":["object","null"]}}},"RouteSheet":{"type":"object","properties":{"id":{"type":"string"},"reference":{"type":"string"},"status":{"type":"string"},"status_label":{"type":"string"},"first_trip_date":{"type":["string","null"]},"departure_time":{"type":["string","null"]},"contractor_name":{"type":["string","null"]},"origin":{"type":["string","null"]},"destination":{"type":["string","null"]},"trips_count":{"type":"integer"},"bus_plate":{"type":["string","null"]},"driver_name":{"type":["string","null"]},"issued_at":{"type":["string","null"]},"document":{"type":["object","null"]},"carrier":{"type":"object","properties":{"name":{"type":"string"},"nif":{"type":["string","null"]}}},"contractor":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]},"tax_id":{"type":["string","null"]}}},"driver":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]},"nif":{"type":["string","null"]},"portal_url":{"type":["string","null"]}}},"co_drivers":{"type":"array","description":"Otros conductores de la hoja, además del principal.","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"},"nif":{"type":["string","null"]},"portal_url":{"type":["string","null"]}}}},"trips":{"type":"array","items":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","description":"Envíalo en un PATCH o una modificación para cambiar este servicio sin perder sus paradas."},"origin":{"type":"string"},"origin_locality":{"type":"string","description":"Localidad o provincia de salida. Opcional."},"destination":{"type":"string"},"destination_locality":{"type":"string","description":"Localidad o provincia de llegada. Opcional."},"trip_date":{"type":"string","format":"date"},"departure_time":{"type":"string","description":"HH:MM"},"extra_pickups":{"type":"array","maxItems":15,"description":"Otros sitios de carga previstos, además del origen.","items":{"type":"object","properties":{"place":{"type":"string"},"time":{"type":["string","null"],"description":"HH:MM, opcional."}}}},"arrival_date":{"type":"string","format":"date","description":"Fecha de llegada. Si no se indica, se entiende el mismo día de la salida."},"arrival_time":{"type":"string","description":"Hora prevista de llegada, HH:MM."},"extra_dropoffs":{"type":"array","maxItems":15,"description":"Otros destinos previstos, además del destino.","items":{"type":"object","properties":{"place":{"type":"string"},"time":{"type":["string","null"],"description":"HH:MM, opcional."}}}},"nature":{"type":"string","enum":["discretionary","regular_reinforcement","special_use_collaboration","tourist"]},"related_service":{"type":"string","description":"Obligatorio en regular_reinforcement y special_use_collaboration."},"plate":{"type":"string","description":"Solo si este servicio va en otro autobús."}}},{"type":"object","properties":{"stops":{"type":"array","items":{"type":"object"}}}}]}},"missing":{"type":"object","additionalProperties":{"type":"string"}},"delivery":{"type":["object","null"]},"open_notices":{"type":"integer"}}},"RouteSheetInput":{"type":"object","properties":{"contracting_party_id":{"type":"string","description":"id de un contratante del directorio."},"contractor_name":{"type":"string"},"contractor_tax_id":{"type":"string","description":"NIF, CIF, CIT o número de IVA extranjero. No se valida el formato."},"tractor_plate":{"type":"string","description":"Matrícula del autobús."},"driver_id":{"type":"string","description":"id de un conductor del directorio."},"driver_name":{"type":"string"},"driver_nif":{"type":"string"},"driver_phone":{"type":"string","description":"Opcional, recomendado. WhatsApp del conductor."},"observations":{"type":"string"},"trips":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"id":{"type":"integer","description":"Envíalo en un PATCH o una modificación para cambiar este servicio sin perder sus paradas."},"origin":{"type":"string"},"origin_locality":{"type":"string","description":"Localidad o provincia de salida. Opcional."},"destination":{"type":"string"},"destination_locality":{"type":"string","description":"Localidad o provincia de llegada. Opcional."},"trip_date":{"type":"string","format":"date"},"departure_time":{"type":"string","description":"HH:MM"},"extra_pickups":{"type":"array","maxItems":15,"description":"Otros sitios de carga previstos, además del origen.","items":{"type":"object","properties":{"place":{"type":"string"},"time":{"type":["string","null"],"description":"HH:MM, opcional."}}}},"arrival_date":{"type":"string","format":"date","description":"Fecha de llegada. Si no se indica, se entiende el mismo día de la salida."},"arrival_time":{"type":"string","description":"Hora prevista de llegada, HH:MM."},"extra_dropoffs":{"type":"array","maxItems":15,"description":"Otros destinos previstos, además del destino.","items":{"type":"object","properties":{"place":{"type":"string"},"time":{"type":["string","null"],"description":"HH:MM, opcional."}}}},"nature":{"type":"string","enum":["discretionary","regular_reinforcement","special_use_collaboration","tourist"]},"related_service":{"type":"string","description":"Obligatorio en regular_reinforcement y special_use_collaboration."},"plate":{"type":"string","description":"Solo si este servicio va en otro autobús."}}}}}},"SavedRouteInput":{"type":"object","properties":{"name":{"type":"string"},"shipper_id":{"type":"string"},"origin":{"type":"string"},"destination":{"type":"string"},"goods_description":{"type":"string"},"weight_value":{"type":"number"},"weight_unit":{"type":"string","enum":["kg","t","pallets","packages","m3","containers","units"]}}}}}}