{
  "openapi": "3.1.0",
  "info": {
    "title": "ALBELA price API",
    "version": "1.0.0",
    "summary": "Цена конфигурации и дата отгрузки изделий ALBELA.",
    "description": "Расчёт повторяет конфигуратор на сайте до рубля. Источник правил — блок pricing товара в https://albela.ru/catalog.json; эндпойнт только считает и ничего не хранит. Цены с НДС, в рублях. Поле binding показывает, можно ли считать цифру обязывающей: у изделий, считаемых по формуле, оно false — заказ подтверждается после согласования чертежа. Ограничение: 60 запросов в минуту с одного адреса.",
    "contact": {
      "email": "info@albela.ru",
      "url": "https://albela.ru/contacts/"
    }
  },
  "servers": [
    {
      "url": "https://albela.ru"
    }
  ],
  "paths": {
    "/api/v1/price": {
      "get": {
        "operationId": "getPrice",
        "summary": "Цена конфигурации и дата отгрузки",
        "parameters": [
          {
            "name": "sku",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Артикул. Без него возвращается список артикулов.",
            "example": "ALB-CTP-LIN"
          },
          {
            "name": "length_mm",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Длина в мм, только значения из pricing.grid.length_mm.",
            "example": 1800
          },
          {
            "name": "depth_mm",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Глубина в мм, только значения из pricing.grid.depth_mm.",
            "example": 550
          },
          {
            "name": "led",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "Подсветка, если она есть у модели."
          },
          {
            "name": "cutouts",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Число вырезов. У PURE и LEVITAS PLUS минимум один."
          },
          {
            "name": "finish",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "M",
                "G"
              ]
            },
            "description": "Фактура: M — матовая, G — глянцевая. На цену не влияет."
          },
          {
            "name": "option",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Вариант для товаров с моделью options_v1."
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Версия изделия для options_v1, например base или led."
          },
          {
            "name": "length_cm",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Длина в сантиметрах для options_v1 (INTEGRA)."
          }
        ],
        "responses": {
          "200": {
            "description": "Расчёт, либо правила и сетка, либо список артикулов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Размер вне сетки или недопустимый параметр",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Артикул не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Цена позиции не опубликована"
          },
          "429": {
            "description": "Превышен лимит запросов"
          },
          "503": {
            "description": "Каталог временно недоступен"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PriceResponse": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "pricing_model": {
            "type": "string",
            "enum": [
              "formula_v1",
              "options_v1",
              "fixed"
            ]
          },
          "variant_sku": {
            "type": "string",
            "description": "Артикул конкретной конфигурации"
          },
          "configuration": {
            "type": "object"
          },
          "price_rub": {
            "type": "integer"
          },
          "price_usd": {
            "type": "integer",
            "description": "Справочно, по курсу usd_rate"
          },
          "breakdown": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "value": {
                  "type": "integer"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "vat_included": {
            "type": "boolean"
          },
          "vat_rate_percent": {
            "type": "integer"
          },
          "binding": {
            "type": "boolean",
            "description": "false — цена расчётная, не публичная оферта"
          },
          "binding_note": {
            "type": "string"
          },
          "availability": {
            "type": "string"
          },
          "lead_time_working_days": {
            "type": "integer"
          },
          "ship_by": {
            "type": "string",
            "format": "date",
            "description": "Дата готовности к отгрузке, без доставки"
          },
          "price_valid_until": {
            "type": "string",
            "format": "date"
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "catalog_updated": {
            "type": "string",
            "format": "date"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  },
  "x-examples": [
    "https://albela.ru/api/v1/price",
    "https://albela.ru/api/v1/price?sku=ALB-CTP-LIN",
    "https://albela.ru/api/v1/price?sku=ALB-CTP-LIN&length_mm=1800&depth_mm=550&led=1",
    "https://albela.ru/api/v1/price?sku=ALB-SNK-INT&version=led&length_cm=120"
  ]
}
