{"openapi":"3.0.3","info":{"title":"1C HTTP API","version":"0.1.0"},"servers":[{"url":"/"}],"security":[{"basicAuth":[]}],"tags":[{"name":"Categories","description":"Категории"},{"name":"Products","description":"Товары"},{"name":"Counterparties","description":"Контрагенты"},{"name":"ProductAttributes","description":"Атрибуты товаров"},{"name":"Orders","description":"Заказы"},{"name":"Documents","description":"Документы"}],"paths":{"/categories":{"get":{"operationId":"getCategories","tags":["Categories"],"parameters":[{"$ref":"#/components/parameters/Offset"},{"$ref":"#/components/parameters/Limit"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/products":{"get":{"operationId":"getProducts","tags":["Products"],"parameters":[{"$ref":"#/components/parameters/Offset"},{"$ref":"#/components/parameters/Limit"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/orders":{"post":{"operationId":"createOrder","tags":["Orders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderCreateRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderCreateResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"409":{"description":"Conflict (order with same externalGuid already exists)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/counterparties":{"get":{"operationId":"getCounterparties","tags":["Counterparties"],"parameters":[{"$ref":"#/components/parameters/Offset"},{"$ref":"#/components/parameters/Limit"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Counterparty"}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/productAttributes":{"get":{"operationId":"getProductAttributes","tags":["ProductAttributes"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductAttribute"}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/documents/{documentGuid}/download":{"get":{"operationId":"downloadDocument","tags":["Documents"],"parameters":[{"name":"documentGuid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDownloadResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"$ref":"#/components/responses/NotFoundError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"parameters":{"Offset":{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}},"Limit":{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":20}}},"responses":{"UnauthorizedError":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFoundError":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"Category":{"type":"object","title":"Категория","description":"Категория/группа товаров.","required":["guid","name","catalogs"],"properties":{"guid":{"type":"string","format":"uuid","description":"GUID категории в 1С.","example":"8b0c9c9a-1f9f-4edb-8d6b-8a3b2d2c0c1a"},"parentGuid":{"type":"string","format":"uuid","nullable":true,"description":"GUID родительской категории (null для корневых).","example":null},"name":{"type":"string","description":"Наименование категории.","example":"Клеи и герметики"},"catalogs":{"type":"array","description":"Список кодов каталогов, в которых доступна категория.","items":{"type":"string"},"example":["retail","wholesale"]}}},"Product":{"type":"object","title":"Товар","description":"Базовый товар. Конкретные цены, остатки, атрибуты и изображения задаются на уровне вариантов (variants).","required":["guid","sku","name","isArchived","variants"],"properties":{"guid":{"type":"string","format":"uuid","description":"GUID номенклатуры в 1С.","example":"2b1f3f4a-1a2b-4c3d-8e9f-0123456789ab"},"sku":{"type":"string","description":"Артикул базового товара.","example":"PLZ-000123"},"name":{"type":"string","description":"Наименование базового товара.","example":"Герметик силиконовый универсальный 280 мл"},"brand":{"type":"string","nullable":true,"description":"Бренд товара.","example":"Palizh"},"marketplaceUrl":{"type":"string","format":"uri","nullable":true,"description":"Ссылка на карточку товара на маркетплейсе.","example":"https://example.com/marketplace/product/PLZ-000123"},"description":{"type":"string","nullable":true,"description":"Текстовое описание товара.","example":"Подходит для внутренних и наружных работ."},"isArchived":{"type":"boolean","description":"Признак архивности (товар выведен из ассортимента).","example":false},"variants":{"type":"array","description":"Варианты товара. Если вариантов нет — массив из одного варианта.","items":{"$ref":"#/components/schemas/ProductVariant"}}}},"ProductPrice":{"type":"object","title":"Цена товара","description":"Базовая цена товара (платформа рассчитывает финальную цену для контрагента самостоятельно).","required":["currency","amount"],"properties":{"currency":{"type":"string","description":"Валюта.","example":"RUB"},"amount":{"type":"number","description":"Базовая цена.","example":1290.5},"priceTypeCode":{"type":"string","nullable":true,"description":"Код вида цены.","example":"BASE"}}},"Money":{"type":"object","title":"Денежная сумма","required":["currency","amount"],"properties":{"currency":{"type":"string","description":"Валюта (ISO 4217).","example":"RUB"},"amount":{"type":"number","description":"Сумма.","example":1290.5}}},"OrderCreateRequest":{"type":"object","title":"Создание заказа","description":"Запрос на создание заказа в 1С. externalGuid используется для связывания с заказом на платформе и для идемпотентности.","required":["externalGuid","counterpartyGuid","deliveryAddress","items"],"properties":{"externalGuid":{"type":"string","format":"uuid","description":"GUID заказа на платформе (ключ идемпотентности).","example":"9c1b2c3d-4e5f-6789-aaaa-bbbbbbbbbbbb"},"counterpartyGuid":{"type":"string","format":"uuid","description":"GUID контрагента в 1С.","example":"6f9619ff-8b86-d011-b42d-00c04fc964ff"},"deliveryAddress":{"type":"string","description":"Адрес доставки одной строкой.","example":"109012, г. Москва, ул. Примерная, д. 1"},"comment":{"type":"string","nullable":true,"description":"Комментарий к заказу.","example":"Позвонить за час до доставки"},"items":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/OrderCreateItem"}}}},"OrderCreateItem":{"type":"object","title":"Позиция заказа","required":["productVariantGuid","quantity"],"properties":{"productVariantGuid":{"type":"string","format":"uuid","description":"GUID варианта товара в 1С.","example":"5d3a9d5b-0b2f-4e9c-9f1f-0d3b2a1c9e77"},"quantity":{"type":"integer","minimum":1,"description":"Количество.","example":3},"priceBase":{"allOf":[{"$ref":"#/components/schemas/Money"}],"nullable":true,"description":"Базовая цена за единицу для сверки."},"priceFinal":{"allOf":[{"$ref":"#/components/schemas/Money"}],"nullable":true,"description":"Финальная (после скидок) цена за единицу для сверки."}}},"OrderCreateResponse":{"type":"object","title":"Результат создания заказа","required":["orderGuid"],"properties":{"orderGuid":{"type":"string","format":"uuid","description":"GUID созданного заказа в 1С.","example":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}}},"ProductVariant":{"type":"object","title":"Вариант товара","description":"Вариант товара (например, по весу/цвету). Именно вариант имеет цены, остаток, атрибуты и изображения. Вариант может быть архивирован отдельно от базового товара.","required":["guid","isDefault","isArchived","stockQty","prices","attributes","images"],"properties":{"guid":{"type":"string","format":"uuid","description":"GUID варианта товара в 1С.","example":"5d3a9d5b-0b2f-4e9c-9f1f-0d3b2a1c9e77"},"isDefault":{"type":"boolean","description":"Признак варианта, который нужно отображать по умолчанию в каталоге.","example":true},"isArchived":{"type":"boolean","description":"Признак архивности варианта (вариант снят с производства/недоступен).","example":false},"sku":{"type":"string","nullable":true,"description":"Артикул варианта (если отличается от базового).","example":"PLZ-000123-10KG"},"name":{"type":"string","nullable":true,"description":"Наименование/маркер варианта (например, вес/объём).","example":"10 кг"},"stockQty":{"type":"integer","description":"Общий остаток данного варианта.","example":12},"productionTimeDays":{"type":"integer","nullable":true,"description":"Время производства в днях, если товара нет в наличии (stockQty = 0).","example":7},"prices":{"type":"array","description":"Набор базовых цен для данного варианта.","items":{"$ref":"#/components/schemas/ProductPrice"}},"attributes":{"type":"array","description":"Атрибуты варианта (значения).","items":{"$ref":"#/components/schemas/ProductAttributeValue"}},"images":{"type":"array","description":"Изображения варианта (base64).","items":{"$ref":"#/components/schemas/ProductImage"}}}},"ProductImage":{"type":"object","title":"Изображение товара","description":"Файл изображения в base64.","required":["fileName","contentType","dataBase64"],"properties":{"fileName":{"type":"string","description":"Имя файла изображения.","example":"product_1.jpg"},"contentType":{"type":"string","description":"MIME-type изображения.","example":"image/jpeg"},"dataBase64":{"type":"string","format":"byte","description":"Содержимое изображения в base64.","example":"/9j/4AAQSkZJRgABAQAAAQABAAD/"}}},"Counterparty":{"type":"object","title":"Контрагент","description":"Контрагент (компания-клиент).","required":["guid","name","inn","kpp"],"properties":{"guid":{"type":"string","format":"uuid","description":"GUID контрагента в 1С.","example":"6f9619ff-8b86-d011-b42d-00c04fc964ff"},"name":{"type":"string","description":"Наименование контрагента.","example":"ООО \"Ромашка\""},"inn":{"type":"string","description":"ИНН.","example":"7707083893"},"kpp":{"type":"string","description":"КПП.","example":"770701001"},"legalAddress":{"type":"string","nullable":true,"description":"Юридический адрес.","example":"109012, г. Москва, ул. Примерная, д. 1"},"paymentTerms":{"$ref":"#/components/schemas/PaymentTerms","nullable":true}}},"PaymentTerms":{"type":"object","title":"Коммерческие условия","description":"Условия оплаты и ценообразования для контрагента.","properties":{"priceTypeCode":{"type":"string","nullable":true,"description":"Вид цены, который следует использовать при расчёте итоговой стоимости.","example":"B2B_BASE"},"paymentMode":{"type":"string","enum":["prepayment","postpayment"],"nullable":true,"description":"Режим оплаты.","example":"postpayment"},"defermentDays":{"type":"integer","nullable":true,"description":"Количество дней отсрочки.","example":14},"creditLimit":{"type":"number","nullable":true,"description":"Лимит кредитования.","example":250000},"hasPostpayAccess":{"type":"boolean","nullable":true,"description":"Признак доступности постоплаты.","example":true},"discounts":{"type":"array","nullable":true,"description":"Персональные скидки контрагента.","items":{"$ref":"#/components/schemas/PersonalDiscount"},"example":[{"value":"5","unit":"percent","conditions":[{"description":"Товары в категории \"Клеи и герметики\"","categories":["8b0c9c9a-1f9f-4edb-8d6b-8a3b2d2c0c1a"]},{"description":"Конкретный товар","products":["2b1f3f4a-1a2b-4c3d-8e9f-0123456789ab"]}]},{"value":"2","unit":"percent","conditions":[]}]}}},"PersonalDiscount":{"type":"object","title":"Персональная скидка","required":["value","unit","conditions"],"properties":{"value":{"type":"string","description":"Значение скидки (как строка; формат будет уточнён).","example":"5"},"unit":{"type":"string","description":"Единица измерения скидки.","enum":["percent"],"example":"percent"},"conditions":{"type":"array","description":"Условия применения скидки. Если условий несколько — применяются по принципу \"или\" (OR). Внутри одного условия все указанные подусловия применяются по принципу \"и\" (AND). Если массив пустой — скидка применяется без условий.","items":{"$ref":"#/components/schemas/PersonalDiscountCondition"}}}},"PersonalDiscountCondition":{"type":"object","title":"Условие применения скидки","description":"Условие применения скидки. Внутри одного объекта все указанные подусловия применяются по принципу \"и\" (AND).","properties":{"description":{"type":"string","nullable":true,"description":"Человекочитаемое описание условия.","example":"Товары из выбранных категорий и минимальная сумма заказа"},"categories":{"type":"array","nullable":true,"description":"GUID категорий. Товар должен принадлежать одной из категорий.","items":{"type":"string","format":"uuid"},"example":["8b0c9c9a-1f9f-4edb-8d6b-8a3b2d2c0c1a"]},"products":{"type":"array","nullable":true,"description":"GUID базовых товаров. Товар должен быть одним из перечисленных.","items":{"type":"string","format":"uuid"},"example":["2b1f3f4a-1a2b-4c3d-8e9f-0123456789ab"]},"productVariants":{"type":"array","nullable":true,"description":"GUID вариантов товара. Вариант должен быть одним из перечисленных.","items":{"type":"string","format":"uuid"},"example":["5d3a9d5b-0b2f-4e9c-9f1f-0d3b2a1c9e77"]},"minAmount":{"type":"array","nullable":true,"description":"Минимальная сумма заказа в разрезе валют. Для валюты из списка сумма заказа должна быть не меньше указанной.","items":{"$ref":"#/components/schemas/Money"},"example":[{"currency":"RUB","amount":10000}]}}},"ProductAttribute":{"type":"object","title":"Атрибут товара","description":"Описание атрибута товара (справочник).","required":["guid","name","type"],"properties":{"guid":{"type":"string","format":"uuid","description":"GUID атрибута.","example":"11111111-2222-3333-4444-555555555555"},"name":{"type":"string","description":"Человекопонятное название атрибута.","example":"Цвет"},"type":{"type":"string","enum":["string","number","list"],"description":"Тип данных атрибута.","example":"list"},"values":{"type":"array","nullable":true,"description":"Допустимые значения (только если type=list).","items":{"$ref":"#/components/schemas/ProductAttributeListValue"}}}},"ProductAttributeListValue":{"type":"object","title":"Значение атрибута из списка","required":["guid","name"],"properties":{"guid":{"type":"string","format":"uuid","example":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"},"name":{"type":"string","example":"Красный"}}},"ProductAttributeValue":{"type":"object","title":"Значение атрибута товара","description":"Значение атрибута для конкретного товара.","required":["guid","value"],"properties":{"guid":{"type":"string","format":"uuid","description":"GUID атрибута.","example":"11111111-2222-3333-4444-555555555555"},"value":{"type":"string","description":"Значение атрибута (или GUID, если это вариант из списка).","example":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"}}},"DocumentDownloadResponse":{"type":"object","title":"Скачивание документа","required":["fileName","contentType","dataBase64"],"properties":{"fileName":{"type":"string","example":"invoice_123.pdf"},"contentType":{"type":"string","example":"application/pdf"},"dataBase64":{"type":"string","format":"byte","description":"Содержимое файла в base64.","example":"JVBERi0xLjQK"}}},"ErrorResponse":{"type":"object","title":"Ошибка","required":["message"],"properties":{"message":{"type":"string","example":"Unauthorized"},"code":{"type":"string","nullable":true,"example":"AUTH_REQUIRED"}}}}}}