{
    "openapi": "3.1.0",
    "info": {
        "title": "Portal Express Calculator and Tariff Rules API",
        "version": "2026-08-20",
        "description": "Машиночитний опис напрямків, методів, вхідних даних, точних ставок, порогів, формул і складських послуг стандартного калькулятора Portal Express. Митне оформлення включене в комісію сервісу без окремої доплати."
    },
    "servers": [
        {
            "url": "https://portal-express.com.ua/wp-json"
        }
    ],
    "paths": {
        "/portal-express/v1/calculator-capabilities": {
            "get": {
                "operationId": "getPortalExpressCalculatorCapabilities",
                "summary": "Отримати можливості калькулятора Portal Express",
                "responses": {
                    "200": {
                        "description": "Підтримувані країни, методи, вхідні поля, секції результату й обмеження.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CalculatorCapabilities"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/portal-express/v1/calculator-rates": {
            "get": {
                "operationId": "getPortalExpressCalculatorRates",
                "summary": "Отримати чинні тарифні правила калькулятора Portal Express",
                "responses": {
                    "200": {
                        "description": "Версія тарифів, змінні, ставки, пороги, формули, напрямки, складські послуги та обмеження.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CalculatorRates"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "CalculatorCapabilities": {
                "type": "object",
                "required": [
                    "name",
                    "version",
                    "calculator_url",
                    "rates_url",
                    "customs_clearance_included",
                    "supported_origins",
                    "input_fields",
                    "limitations"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "version": {
                        "type": "string"
                    },
                    "language": {
                        "type": "string",
                        "const": "uk"
                    },
                    "calculator_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "documentation_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "rates_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "rates_version": {
                        "type": "string"
                    },
                    "openapi_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "purpose": {
                        "type": "string"
                    },
                    "customs_clearance_included": {
                        "type": "boolean",
                        "const": true
                    },
                    "supported_origins": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "code",
                                "name",
                                "currency",
                                "methods"
                            ],
                            "properties": {
                                "code": {
                                    "type": "string"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "currency": {
                                    "type": "string"
                                },
                                "methods": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    },
                    "input_fields": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "result_sections": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "limitations": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "CalculatorRates": {
                "type": "object",
                "required": [
                    "name",
                    "version",
                    "effective_date",
                    "customs_clearance",
                    "variables",
                    "routes",
                    "warehouse_services",
                    "limitations",
                    "calculator_url",
                    "tariffs_page_url"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "version": {
                        "type": "string"
                    },
                    "effective_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "language": {
                        "type": "string",
                        "const": "uk"
                    },
                    "currency_rounding": {
                        "type": "string"
                    },
                    "customs_clearance": {
                        "type": "object",
                        "required": [
                            "included",
                            "separate_charge",
                            "description"
                        ],
                        "properties": {
                            "included": {
                                "type": "boolean",
                                "const": true
                            },
                            "separate_charge": {
                                "type": "boolean",
                                "const": false
                            },
                            "description": {
                                "type": "string"
                            }
                        }
                    },
                    "variables": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "routes": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "object"
                        }
                    },
                    "warehouse_services": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "object"
                        }
                    },
                    "limitations": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "calculator_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "tariffs_page_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "documentation_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "capabilities_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "rates_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "openapi_url": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            }
        }
    }
}