{"openapi":"3.1.0","info":{"title":"SalesAgent Catalog API","description":"Публичный API полной замены и поштучного изменения товаров и услуг. Каждый PUT/DELETE возвращает 202 Accepted; проверяйте обработку по operation_id до статуса succeeded или failed.","version":"2.0.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"}}}},"401":{"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"}}}},"429":{"description":"Очередь каталога заполнена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}},"409":{"description":"В каталоге повторяется id позиции","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}}},"security":[{"CatalogToken":[]}]},"delete":{"tags":["Catalog"],"summary":"Очистить каталог","operationId":"clearCatalog","responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOperationRead"}}}},"401":{"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"}}}},"429":{"description":"Очередь каталога заполнена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}}},"security":[{"CatalogToken":[]}]}},"/v1/catalog/items/{external_id}":{"put":{"tags":["Catalog"],"summary":"Создать или заменить позицию","operationId":"upsertCatalogItem","security":[{"CatalogToken":[]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":200,"pattern":".*\\S.*","title":"External Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogItemMutationInput"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOperationRead"}}}},"401":{"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"}}}},"429":{"description":"Очередь каталога заполнена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}}}},"delete":{"tags":["Catalog"],"summary":"Удалить позицию","operationId":"deleteCatalogItem","security":[{"CatalogToken":[]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":200,"pattern":".*\\S.*","title":"External Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOperationRead"}}}},"401":{"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"}}}},"429":{"description":"Очередь каталога заполнена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorEnvelope"}}}}}}},"/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":{"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":{"name":{"type":"string","maxLength":500,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":20000},{"type":"null"}],"title":"Description"},"category":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Category"},"price":{"anyOf":[{"$ref":"#/components/schemas/CatalogPriceInput"},{"type":"null"}]},"url":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Url"},"image_url":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Image Url"},"attributes":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"string","format":"date"},{"type":"null"}]},"type":"object","maxProperties":100,"title":"Attributes"},"id":{"type":"string","maxLength":200,"minLength":1,"title":"Id"}},"additionalProperties":false,"type":"object","required":["name","id"],"title":"CatalogItemInput"},"CatalogItemMutationInput":{"properties":{"name":{"type":"string","maxLength":500,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":20000},{"type":"null"}],"title":"Description"},"category":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Category"},"price":{"anyOf":[{"$ref":"#/components/schemas/CatalogPriceInput"},{"type":"null"}]},"url":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Url"},"image_url":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Image Url"},"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":["name"],"title":"CatalogItemMutationInput"},"CatalogOperationKind":{"type":"string","enum":["full_replace","item_upsert","item_delete"],"title":"CatalogOperationKind"},"CatalogOperationRead":{"properties":{"operation_id":{"type":"string","title":"Operation Id"},"operation_type":{"$ref":"#/components/schemas/CatalogOperationKind"},"source":{"$ref":"#/components/schemas/CatalogOperationSource"},"status":{"$ref":"#/components/schemas/CatalogOperationStatus"},"source_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Filename"},"item_count":{"type":"integer","minimum":0.0,"title":"Item Count"},"added":{"type":"integer","minimum":0.0,"title":"Added"},"changed":{"type":"integer","minimum":0.0,"title":"Changed"},"deleted":{"type":"integer","minimum":0.0,"title":"Deleted"},"unchanged":{"type":"integer","minimum":0.0,"title":"Unchanged"},"indexed":{"type":"integer","minimum":0.0,"title":"Indexed"},"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"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"}},"additionalProperties":false,"type":"object","required":["operation_id","operation_type","source","status","source_filename","item_count","added","changed","deleted","unchanged","indexed","warnings","errors","created_at","started_at","finished_at"],"title":"CatalogOperationRead"},"CatalogOperationSource":{"type":"string","enum":["excel","api","site","manual"],"title":"CatalogOperationSource"},"CatalogOperationStatus":{"type":"string","enum":["queued","validating","indexing","succeeded","failed"],"title":"CatalogOperationStatus"},"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"},"period":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Period"}},"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":30000,"minItems":1,"title":"Items"}},"additionalProperties":false,"type":"object","required":["items"],"title":"CatalogReplaceInput","example":{"items":[{"attributes":{"Плотность":180,"Размер":"M"},"category":"Одежда > Футболки","id":"tshirt-black-m","image_url":"https://example.com/images/tshirt-black-m.jpg","name":"Футболка чёрная, размер M","price":{"amount":990,"currency":"RUB","kind":"exact","period":"month"},"url":"https://example.com/tshirt-black-m"}]}},"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_…"}}}}