{"openapi":"3.1.0","info":{"title":"SalesAgent Catalog API","description":"Публичный API полной атомарной синхронизации товаров и услуг. Передайте каталог одним PUT-запросом и проверяйте обработку по operation_id.","version":"1.1.0"},"paths":{"/v1/catalog":{"put":{"tags":["Catalog"],"summary":"Передать полный каталог","operationId":"replaceCatalog","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogReplaceInput"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOperationRead"}}}},"200":{"description":"Идентичный каталог уже активен","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOperationRead"}}}},"401":{"description":"Токен отсутствует, неверен или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"409":{"description":"Другая операция ещё выполняется","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"413":{"description":"Превышен лимит размера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"422":{"description":"Каталог не прошёл проверку","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}}},"security":[{"CatalogToken":[]}]},"delete":{"tags":["Catalog"],"summary":"Очистить каталог","operationId":"clearCatalog","responses":{"204":{"description":"Successful Response"},"401":{"description":"Токен отсутствует, неверен или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"409":{"description":"Другая операция ещё выполняется","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}}},"security":[{"CatalogToken":[]}]}},"/v1/catalog/operations/{operation_id}":{"get":{"tags":["Catalog"],"summary":"Проверить обработку каталога","operationId":"getCatalogOperation","security":[{"CatalogToken":[]}],"parameters":[{"name":"operation_id","in":"path","required":true,"schema":{"type":"string","title":"Operation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOperationRead"}}}},"401":{"description":"Токен отсутствует, неверен или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"404":{"description":"Операция не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CatalogAvailability":{"type":"string","enum":["available","unavailable","preorder","on_request"],"title":"CatalogAvailability"},"CatalogErrorBody":{"properties":{"code":{"type":"string","title":"Code"},"message":{"type":"string","title":"Message"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"CatalogErrorBody"},"CatalogErrorEnvelope":{"properties":{"error":{"$ref":"#/components/schemas/CatalogErrorBody"}},"additionalProperties":false,"type":"object","required":["error"],"title":"CatalogErrorEnvelope"},"CatalogIssue":{"properties":{"code":{"type":"string","maxLength":100,"minLength":1,"title":"Code"},"message":{"type":"string","maxLength":1000,"minLength":1,"title":"Message"},"row":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Row"},"field":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Field"}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"CatalogIssue"},"CatalogItemInput":{"properties":{"external_id":{"type":"string","maxLength":200,"minLength":1,"title":"External Id"},"name":{"type":"string","maxLength":500,"minLength":1,"title":"Name"},"product_id":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Product Id"},"type":{"anyOf":[{"$ref":"#/components/schemas/CatalogItemType"},{"type":"null"}]},"category_path":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Category Path"},"description":{"anyOf":[{"type":"string","maxLength":20000},{"type":"null"}],"title":"Description"},"price":{"anyOf":[{"$ref":"#/components/schemas/CatalogPriceInput"},{"type":"null"}]},"availability":{"anyOf":[{"$ref":"#/components/schemas/CatalogAvailability"},{"type":"null"}]},"url":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Url"},"image_url":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Image Url"},"tags":{"items":{"type":"string"},"type":"array","maxItems":100,"title":"Tags"},"direction_key":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Direction Key"},"cross_sell_product_ids":{"items":{"type":"string"},"type":"array","title":"Cross Sell Product Ids"},"upsell_product_ids":{"items":{"type":"string"},"type":"array","title":"Upsell Product Ids"},"attributes":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"string","format":"date"},{"type":"null"}]},"type":"object","maxProperties":100,"title":"Attributes"}},"additionalProperties":false,"type":"object","required":["external_id","name"],"title":"CatalogItemInput"},"CatalogItemType":{"type":"string","enum":["product","service"],"title":"CatalogItemType"},"CatalogOperationRead":{"properties":{"operation_id":{"type":"string","title":"Operation Id"},"content_key":{"type":"string","title":"Content Key"},"status":{"type":"string","enum":["queued","validating","indexing","active","replaced","failed","cleared"],"title":"Status"},"item_count":{"type":"integer","title":"Item Count"},"processed_count":{"type":"integer","title":"Processed Count"},"warnings":{"items":{"$ref":"#/components/schemas/CatalogIssue"},"type":"array","title":"Warnings"},"errors":{"items":{"$ref":"#/components/schemas/CatalogIssue"},"type":"array","title":"Errors"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"activated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Activated At"}},"additionalProperties":false,"type":"object","required":["operation_id","content_key","status","item_count","processed_count","warnings","errors","created_at","finished_at","activated_at"],"title":"CatalogOperationRead"},"CatalogPriceInput":{"properties":{"kind":{"$ref":"#/components/schemas/CatalogPriceKind"},"amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d{0,4}0*$"},{"type":"null"}],"title":"Amount"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"}},"additionalProperties":false,"type":"object","required":["kind"],"title":"CatalogPriceInput"},"CatalogPriceKind":{"type":"string","enum":["exact","from","free","on_request"],"title":"CatalogPriceKind"},"CatalogReplaceInput":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CatalogItemInput"},"type":"array","maxItems":10000,"minItems":1,"title":"Items"}},"additionalProperties":false,"type":"object","required":["items"],"title":"CatalogReplaceInput","example":{"items":[{"attributes":{"Плотность":180,"Размер":"M"},"availability":"available","category_path":"Одежда > Футболки","external_id":"tshirt-black-m","name":"Футболка чёрная, размер M","price":{"amount":990,"currency":"RUB","kind":"exact"},"product_id":"tshirt-black","tags":["чёрная","хлопок"],"type":"product"}]}},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"CatalogToken":{"type":"http","scheme":"bearer","bearerFormat":"sa_cat_…"}}}}