{"openapi":"3.0.3","info":{"title":"API Andesmar Cargas","version":"1.1.0","description":"Especificación completa para la creación de envíos y guías internacionales/nacionales."},"paths":{"/api/v1/guias":{"post":{"summary":"Crear una nueva guía de envío","description":"Endpoint para registrar envíos con detalles de bultos, clientes, proveedores e información de importación.","operationId":"crearGuia","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuiaRequest"}}}},"responses":{"200":{"description":"OK - Procesamiento exitoso o registro pendiente","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SuccessResponse"},{"$ref":"#/components/schemas/PendingResponse"}]},"examples":{"Caso3_Exito":{"summary":"CASO 3 — 200 OK","value":{"status":"success","data":{"nropedido":123,"nroremito":"prueba456","fecha":"01-01-2026","message":"Guía insertada correctamente"}}},"Caso6_Pendiente":{"summary":"CASO 6 — Falla técnica (Registro pendiente)","value":{"status":"pending","data":{"nropedido":123,"nroremito":"abc456","fecha":"01-01-2026","message":"Estamos experimentando inconvenientes técnicos. Su pedido fue registrado correctamente y los números de guía serán enviados a juan.perez@email.com a la brevedad."}}}}}}},"400":{"description":"Bad Request - Error de validación","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"status":"error","code":"VALIDATION_ERROR","message":"El request contiene errores de validación","errors":["envio.Bultos es obligatorio","guia.customer.document_number es obligatorio"]}}}},"401":{"description":"Unauthorized - Autenticación fallida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"status":"error","code":"AUTH_ERROR","message":"Usuario o clave incorrectos"}}}},"422":{"description":"Unprocessable Entity - Error de negocio","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"status":"error","code":"BUSINESS_ERROR","message":"El CUIT 20369617924 superó su cupo anual de envíos"}}}},"500":{"description":"Internal Server Error - Error del servidor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"status":"error","code":"INTERNAL_ERROR","message":"Ocurrió un error interno.","ticket":"ERR-20260101-123456"}}}}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"GuiaRequest":{"type":"object","properties":{"envio":{"$ref":"#/components/schemas/Envio"},"guia":{"$ref":"#/components/schemas/GuiaData"}},"example":{"envio":{"NroRemito":"prueba123","Bultos":1,"Peso":0.2,"ValorDeclarado":150,"M3":[0.01],"Alto":[8],"Ancho":[5],"Largo":[15],"ModalidadEntregaID":2,"CodigoAgrupacion":12,"CodigoCliente":5645,"Observaciones":"","servicio":{"EsFletePagoDestino":false,"EsRemitoconformado":false}},"guia":{"type":"C","warehouse_days":10,"note":"Requiere entrega rápida","customer":{"name":"Juan Pérez","email":"juan.perez@email.com","phone":"+5491123456789","legal_form_code":"5","document_type_code":"80","document_number":"30123456789","address":{"country_code_iso":"AR","province_code_iso":"C","street_name":"25 DE MAYO","street_number":"1","zip_code":"5501","city":"Capital Federal"}},"shipper":{"name":"Logística Rápida SA","email":"logistica@rapida.com","address":{"country_code_iso":"US","province_code_iso":"FL","street_name":"Miami Blvd","street_number":"500","zip_code":"33101","city":"Miami"}},"import_guide_details":[{"rate_position_code":"8517.11.00.110M","measurement_unit_type":"un","fob":150.0,"freight_price":25.0}],"import_guide_items":[{"description":"Auriculares Bluetooth JBL","quantity":1,"declared_value":150.0,"hs_code":"8518.30.00","product_brand":"JBL","product_model":"Tune 510BT"}]}}},"Envio":{"type":"object","properties":{"NroRemito":{"type":"string"},"Bultos":{"type":"integer"},"Peso":{"type":"number"},"ValorDeclarado":{"type":"number"},"M3":{"type":"array","items":{"type":"number"}},"Alto":{"type":"array","items":{"type":"number"}},"Ancho":{"type":"array","items":{"type":"number"}},"Largo":{"type":"array","items":{"type":"number"}},"ModalidadEntregaID":{"type":"integer"},"CodigoAgrupacion":{"type":"integer"},"CodigoCliente":{"type":"integer"},"Observaciones":{"type":"string"},"servicio":{"type":"object","properties":{"EsFletePagoDestino":{"type":"boolean"},"EsRemitoconformado":{"type":"boolean"}}}}},"GuiaData":{"type":"object","properties":{"type":{"type":"string"},"warehouse_days":{"type":"integer"},"note":{"type":"string"},"customer":{"$ref":"#/components/schemas/Participante"},"shipper":{"$ref":"#/components/schemas/Participante"},"import_guide_details":{"type":"array","items":{"$ref":"#/components/schemas/ImportDetail"}},"import_guide_items":{"type":"array","items":{"$ref":"#/components/schemas/ImportItem"}}}},"Participante":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"legal_form_code":{"type":"string"},"document_type_code":{"type":"string"},"document_number":{"type":"string"},"address":{"$ref":"#/components/schemas/Address"}}},"Address":{"type":"object","properties":{"country_code_iso":{"type":"string"},"province_code_iso":{"type":"string"},"street_name":{"type":"string"},"street_number":{"type":"string"},"zip_code":{"type":"string"},"city":{"type":"string"}}},"ImportDetail":{"type":"object","properties":{"rate_position_code":{"type":"string"},"measurement_unit_type":{"type":"string"},"fob":{"type":"number"},"freight_price":{"type":"number"}}},"ImportItem":{"type":"object","properties":{"description":{"type":"string"},"quantity":{"type":"integer"},"declared_value":{"type":"number"},"hs_code":{"type":"string"},"product_brand":{"type":"string"},"product_model":{"type":"string"}}},"SuccessResponse":{"type":"object","properties":{"status":{"type":"string","enum":["success"]},"data":{"$ref":"#/components/schemas/ResponseData"}}},"PendingResponse":{"type":"object","properties":{"status":{"type":"string","enum":["pending"]},"data":{"$ref":"#/components/schemas/ResponseData"}}},"ResponseData":{"type":"object","properties":{"nropedido":{"type":"integer"},"nroremito":{"type":"string"},"fecha":{"type":"string"},"message":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"message":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}},"ticket":{"type":"string"}}}}},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/andesmar/api-andesmar-cargas-Internacional/1.1.0"}]}