{
    "openapi": "3.0.0",
    "info": {
        "title": "API Services Malva Colombia",
        "description": "Documentación API Services Malva Colombia\n ## 🔐 Autenticación y uso de la API\n\nPara consumir los servicios de la API, es necesario autenticarse mediante **OAuth 2.0** utilizando credenciales proporcionadas por el equipo de soporte.\n\n---\n\n### 1. Credenciales de acceso\n\nCada cliente recibirá:\n\n- **client_id**\n- **client_secret**\n\n> ⚠️ Estas credenciales son confidenciales y deben resguardarse de forma segura.\n\n---\n\n### 2. Obtención del token\n\nAntes de consumir cualquier endpoint, debes generar un **access token**.\n\n**Endpoint:**\nPOST - /oauth/token\n\n**Parámetros:**\n\n- client_id  \n- client_secret  \n- grant_type: client_credentials\n\n**Respuesta:**\n\n- access_token\n- token_type: Bearer\n- expires_in\n\n---\n\n### 3. Autorización en Swagger\n\n1. Haz clic en el botón **Authorize**\n2. Ingresa el token según el método configurado\n3. Presiona **Authorize**\n\n---\n\n### 4. Consumo de servicios\n\nIncluye el token en el header de cada request:\n\nAuthorization: Bearer TU_ACCESS_TOKEN\n\n---\n\n### 5. Consideraciones\n\n- El token expira, debes regenerarlo cuando sea necesario  \n- No compartas tus credenciales  \n---\n📩 **Soporte:** programador5@kronotime.com.co ",
        "contact": {
            "name": "Soporte API Malva",
            "email": "programador5@kronotime.com.co"
        },
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "http://malva-procesos.eastus.cloudapp.azure.com/g_new_api_services/public",
            "description": "Servidor de API Malva"
        }
    ],
    "paths": {
        "/oauth/token": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Obtener token OAuth2",
                "description": "Genera un token Bearer usando client_id y client_secret (Client Credentials Grant)",
                "operationId": "2dc26f7a3a3fd129523e9aca618cb9e8",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "grant_type": {
                                        "type": "string",
                                        "example": "client_credentials"
                                    },
                                    "client_id": {
                                        "type": "string",
                                        "example": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxx"
                                    },
                                    "client_secret": {
                                        "type": "string",
                                        "example": "XXXXXXXXXXXXXXXX"
                                    },
                                    "scope": {
                                        "type": "string",
                                        "example": "*"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Token generado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "token_type": {
                                            "type": "string",
                                            "example": "Bearer"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "example": 3600
                                        },
                                        "access_token": {
                                            "type": "string",
                                            "example": "eyJ0eXAiOiJKV1QiLCJh..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/orders": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "Consulta detallada de órdenes",
                "description": "Retorna el listado de órdenes con su estructura completa: detalle de productos, facturación (billing), separación (separate), logística de envío y trazabilidad de comentarios.",
                "operationId": "6390e58970c6b576bd8c1ec198cb5fbb",
                "parameters": [
                    {
                        "name": "order_number",
                        "in": "query",
                        "description": "Número de la orden",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "document",
                        "in": "query",
                        "description": "Documento del cliente",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "description": "Email del cliente",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "phone",
                        "in": "query",
                        "description": "Teléfono del cliente",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "guide",
                        "in": "query",
                        "description": "Número de guía de envío",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Respuesta exitosa",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "example": 44316
                                            },
                                            "order_id": {
                                                "type": "string",
                                                "example": "123456123456-MALVA_ONLINE"
                                            },
                                            "order_number": {
                                                "type": "string",
                                                "example": "11111-MALVA_ONLINE"
                                            },
                                            "customer_id": {
                                                "type": "string",
                                                "example": "XXXXXXXXXXX"
                                            },
                                            "payment_method_id": {
                                                "type": "integer",
                                                "example": 1
                                            },
                                            "total_price": {
                                                "type": "string",
                                                "example": "949990.00"
                                            },
                                            "channel_id": {
                                                "type": "integer",
                                                "example": 1
                                            },
                                            "total_items": {
                                                "type": "integer",
                                                "example": 1
                                            },
                                            "pay_status": {
                                                "type": "integer",
                                                "example": 3
                                            },
                                            "marketplace_id": {
                                                "type": "integer",
                                                "example": 4
                                            },
                                            "approval_payment_id": {
                                                "type": "string",
                                                "example": "XXXXXXXXXXX"
                                            },
                                            "giftMessage": {
                                                "type": "string",
                                                "example": ""
                                            },
                                            "addressBilling": {
                                                "type": "string",
                                                "example": "calle falsa 122345, apto 201..."
                                            },
                                            "addressShipping": {
                                                "type": "string",
                                                "example": "calle falsa 122345, apto 201..."
                                            },
                                            "created_at": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "updated_at": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "pay_updated_at": {
                                                "type": "string",
                                                "nullable": true
                                            },
                                            "user_at": {
                                                "type": "string",
                                                "example": "PAGINA"
                                            },
                                            "transfer_id": {
                                                "type": "integer",
                                                "nullable": true
                                            },
                                            "detail": {
                                                "type": "array",
                                                "items": {
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "example": 367179
                                                        },
                                                        "order_item_id": {
                                                            "type": "string",
                                                            "example": "12345123456-MALVA_ONLINE0"
                                                        },
                                                        "order_id": {
                                                            "type": "integer",
                                                            "example": 44316
                                                        },
                                                        "item_id": {
                                                            "type": "string",
                                                            "example": "7615537594538"
                                                        },
                                                        "status_id": {
                                                            "type": "integer",
                                                            "example": 6
                                                        },
                                                        "item_price": {
                                                            "type": "string",
                                                            "example": "949990.00"
                                                        },
                                                        "discount": {
                                                            "type": "string",
                                                            "example": "0.00"
                                                        },
                                                        "full_price": {
                                                            "type": "string",
                                                            "example": "949990.00"
                                                        },
                                                        "shipping_amount": {
                                                            "type": "string",
                                                            "example": "0.00"
                                                        },
                                                        "tax_amount": {
                                                            "type": "string",
                                                            "example": "151679.08"
                                                        },
                                                        "status_own": {
                                                            "type": "string",
                                                            "example": "PENDIENTE"
                                                        },
                                                        "log": {
                                                            "type": "string",
                                                            "example": ""
                                                        },
                                                        "created_at": {
                                                            "type": "string",
                                                            "format": "date-time"
                                                        },
                                                        "updated_at": {
                                                            "type": "string",
                                                            "format": "date-time"
                                                        },
                                                        "force_location": {
                                                            "type": "string",
                                                            "nullable": true
                                                        },
                                                        "item": {
                                                            "properties": {
                                                                "No": {
                                                                    "type": "string",
                                                                    "example": "3MG10271430-7.5"
                                                                },
                                                                "Size": {
                                                                    "type": "string",
                                                                    "example": "7.5"
                                                                },
                                                                "Search_Description": {
                                                                    "type": "string",
                                                                    "example": "CLOUDTILT REMIX"
                                                                },
                                                                "Description": {
                                                                    "type": "string",
                                                                    "example": "CLOUDTILT REMIX"
                                                                },
                                                                "Division_Code": {
                                                                    "type": "string",
                                                                    "example": "CALZADO"
                                                                },
                                                                "Item_Category_Code": {
                                                                    "type": "string",
                                                                    "example": "CALZ_DEPOR"
                                                                },
                                                                "DefaultBarcode": {
                                                                    "type": "string",
                                                                    "example": "7615537594538"
                                                                },
                                                                "Special_Group_Code": {
                                                                    "type": "string",
                                                                    "example": "ONM"
                                                                },
                                                                "Item_Family_Code": {
                                                                    "type": "string",
                                                                    "example": "ONM"
                                                                },
                                                                "Gender": {
                                                                    "type": "string",
                                                                    "example": "HOMBRE"
                                                                },
                                                                "Color": {
                                                                    "type": "string",
                                                                    "example": "GRIS"
                                                                },
                                                                "price": {
                                                                    "type": "integer",
                                                                    "example": 0
                                                                },
                                                                "brand": {
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer",
                                                                            "example": 1724
                                                                        },
                                                                        "Code": {
                                                                            "type": "string",
                                                                            "example": "ONM"
                                                                        },
                                                                        "Description": {
                                                                            "type": "string",
                                                                            "example": "ON RUNNING KT"
                                                                        },
                                                                        "name_online": {
                                                                            "type": "string",
                                                                            "example": "ON"
                                                                        },
                                                                        "user_nav": {
                                                                            "type": "string",
                                                                            "example": "MALVAPROD"
                                                                        },
                                                                        "Category": {
                                                                            "type": "string",
                                                                            "example": "CALZADO"
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "status": {
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer",
                                                                    "example": 6
                                                                },
                                                                "name": {
                                                                    "type": "string",
                                                                    "example": "DESPACHADO"
                                                                },
                                                                "type": {
                                                                    "type": "string",
                                                                    "example": "alistamiento"
                                                                },
                                                                "status": {
                                                                    "type": "string",
                                                                    "example": "1"
                                                                },
                                                                "color": {
                                                                    "type": "string",
                                                                    "example": "success"
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "billing": {
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer",
                                                                    "example": 36090
                                                                },
                                                                "nmrfct": {
                                                                    "type": "string",
                                                                    "example": "FEON-XXXXXXXX"
                                                                },
                                                                "pdf_url": {
                                                                    "type": "string",
                                                                    "example": "https://malvavendor.com/api/v1/invoices/FEON-XXXXXX/pdf"
                                                                },
                                                                "user_id": {
                                                                    "type": "string",
                                                                    "example": "1298"
                                                                },
                                                                "user": {
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer",
                                                                            "example": 1298
                                                                        },
                                                                        "name": {
                                                                            "type": "string",
                                                                            "example": "JHON DOE"
                                                                        },
                                                                        "nit": {
                                                                            "type": "string",
                                                                            "example": "XXXXXXXXXX"
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "separate": {
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer",
                                                                    "example": 159634
                                                                },
                                                                "separate": {
                                                                    "type": "string",
                                                                    "example": "OV-XXXXXXXX"
                                                                },
                                                                "shop": {
                                                                    "type": "string",
                                                                    "example": "AG01"
                                                                },
                                                                "status": {
                                                                    "type": "integer",
                                                                    "example": 1
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "shipping": {
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer",
                                                                    "example": 316539
                                                                },
                                                                "trackingCode": {
                                                                    "type": "string",
                                                                    "example": "XXXXXXXXX"
                                                                },
                                                                "tracking_print": {
                                                                    "type": "string",
                                                                    "example": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                                                                },
                                                                "tracking_label": {
                                                                    "type": "string",
                                                                    "example": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                                                                },
                                                                "status": {
                                                                    "type": "string",
                                                                    "example": "ENTREGADA"
                                                                },
                                                                "deliver_date": {
                                                                    "type": "string",
                                                                    "example": "2026-03-13 00:00:00"
                                                                },
                                                                "trackingCodeReturn": {
                                                                    "type": "string",
                                                                    "example": "73400487580"
                                                                },
                                                                "trackingPrintReturn": {
                                                                    "type": "string",
                                                                    "example": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                                                                },
                                                                "trackingLabelReturn": {
                                                                    "type": "string",
                                                                    "example": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                                                                },
                                                                "logistic": {
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer",
                                                                            "example": 2
                                                                        },
                                                                        "name": {
                                                                            "type": "string",
                                                                            "example": "COORDINADORA"
                                                                        },
                                                                        "tracking": {
                                                                            "type": "integer",
                                                                            "example": 1
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "comments": {
                                                            "type": "array",
                                                            "items": {
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "commit": {
                                                                        "type": "string"
                                                                    },
                                                                    "user": {
                                                                        "properties": {
                                                                            "id": {
                                                                                "type": "integer"
                                                                            },
                                                                            "name": {
                                                                                "type": "string"
                                                                            },
                                                                            "business_name": {
                                                                                "type": "string"
                                                                            },
                                                                            "nit": {
                                                                                "type": "string"
                                                                            }
                                                                        },
                                                                        "type": "object"
                                                                    }
                                                                },
                                                                "type": "object"
                                                            }
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "status": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 3
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "PENDIENTE"
                                                    },
                                                    "color": {
                                                        "type": "string",
                                                        "example": "secondary"
                                                    }
                                                },
                                                "type": "object"
                                            },
                                            "customer": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 117822
                                                    },
                                                    "Name": {
                                                        "type": "string",
                                                        "example": "JHON DOE"
                                                    },
                                                    "Name_2": {
                                                        "type": "string",
                                                        "example": "DOE"
                                                    },
                                                    "VAT_Registration_Type": {
                                                        "type": "string",
                                                        "example": "CC"
                                                    },
                                                    "Address": {
                                                        "type": "string",
                                                        "example": "calle falsa 12345"
                                                    },
                                                    "City": {
                                                        "type": "string",
                                                        "example": "MONTERIA"
                                                    },
                                                    "E_Mail": {
                                                        "type": "string",
                                                        "example": "xxxxxxxx@gmail.com"
                                                    },
                                                    "No": {
                                                        "type": "string",
                                                        "example": "XXXXXXXXXXX"
                                                    }
                                                },
                                                "type": "object"
                                            },
                                            "pay_method": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 1
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "MERCADOPAGO"
                                                    },
                                                    "cartera_contable": {
                                                        "type": "string",
                                                        "example": "MERCPAGO"
                                                    },
                                                    "status": {
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "example": 2
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "example": "APROBACION"
                                                            },
                                                            "color": {
                                                                "type": "string",
                                                                "example": "warning"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "type": "object"
                                            },
                                            "mkp": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 4
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "MALVA_ONLINE"
                                                    },
                                                    "warehouse": {
                                                        "type": "string",
                                                        "example": "MALVA_NAV_COL"
                                                    },
                                                    "seller": {
                                                        "type": "string",
                                                        "example": "SHOPIFY"
                                                    }
                                                },
                                                "type": "object"
                                            },
                                            "evidences_cr": {
                                                "type": "array",
                                                "items": {}
                                            }
                                        },
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "No autorizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "description": "Pegar el token Bearer aquí",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Auth",
            "description": "Auth"
        },
        {
            "name": "Orders",
            "description": "Orders"
        }
    ]
}