### Install ozon-api Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Install the ozon-api library using pip. This is the first step to using the Ozon Seller API in your Python project. ```bash pip install ozon-api ``` -------------------------------- ### Get Detailed Product Information Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Fetches detailed information for products specified by their IDs (offer_id, product_id, or sku). Includes images, prices, statuses, and attributes. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_info_list import ProductInfoListRequest async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductInfoListRequest( offer_id=["MY-SKU-001", "MY-SKU-002"], product_id=[], sku=[], ) response = await api.product_info_list(request) for item in response.result.items: print(f"Товар: {item.offer_id}, SKU: {item.sku}, " f"Цена: {item.price}, Статус: {item.status.state}") # Вывод: # Товар: MY-SKU-001, SKU: 987654321, Цена: 1990, Статус: price_sent # Товар: MY-SKU-002, SKU: 987654322, Цена: 3490, Статус: price_sent asyncio.run(main()) ``` -------------------------------- ### Get Product Attributes with Filtering Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves product attributes, supporting filtering by article (offer_id) and visibility. Allows for sorting and pagination. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_info_attributes import ( ProductInfoAttributesRequest, ProductInfoAttributesFilter, ) async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductInfoAttributesRequest( filter=ProductInfoAttributesFilter( offer_id=["MY-SKU-001"], visibility="ALL", ), limit=10, sort_by="sku", sort_dir="asc", ) result = await api.product_info_attributes(request) for product in result.result: print(f"offer_id: {product.offer_id}") for attr in product.attributes[:3]: print(f" attr_id={attr.attribute_id}: {attr.values}") # Вывод: # offer_id: MY-SKU-001 # attr_id=85: [{'value': 'Nike', 'dictionary_value_id': 906158}] # attr_id=10096: [{'value': 'Белый', 'dictionary_value_id': 61577}] asyncio.run(main()) ``` -------------------------------- ### Get Account Product Limits Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves information about your account's product limits, including the total assortment limit, daily creation limit, and daily update limit. ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: limits = await api.product_info_limit() print(f"Лимит ассортимента: {limits.get('daily_create', {}).get('limit')}") print(f"Создано сегодня: {limits.get('daily_create', {}).get('usage')}") print(f"Обновлено сегодня: {limits.get('daily_update', {}).get('usage')}") # Вывод: # Лимит ассортимента: 100000 # Создано сегодня: 12 # Обновлено сегодня: 45 asyncio.run(main()) ``` -------------------------------- ### Get Product Subscription Info - Python Ozon API Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Fetch information about customer subscriptions for product notifications, such as stock availability alerts. Displays SKU and the number of subscribers. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_subscription import ProductSubscriptionRequest async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductSubscriptionRequest( skus=[987654321, 987654322] ) response = await api.product_subscription(request) for item in response.result: print(f"SKU: {item.sku}, подписчиков: {item.count}") # Вывод: # SKU: 987654321, подписчиков: 17 # SKU: 987654322, подписчиков: 5 asyncio.run(main()) ``` -------------------------------- ### Get Related SKUs for Products Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves a list of related SKUs for specified products. Use this to find child or associated product items. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_related_sku import ProductRelatedSkuRequest async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductRelatedSkuRequest(sku=[987654321]) response = await api.product_related_sku(request) for item in response.items: print(f"SKU: {item.sku}, связанные: {item.sku_list}") # Вывод: # SKU: 987654321, связанные: [987654323, 987654324] asyncio.run(main()) ``` -------------------------------- ### Get Product Rating by SKU - Python Ozon API Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieve the rating and reviews for products using their Ozon SKU. Includes overall rating, review count, and category-specific ratings. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_rating import ProductRatingRequest async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductRatingRequest(skus=[987654321, 987654322]) response = await api.product_rating_by_sku(request) for product in response.products: print(f"SKU: {product.sku}, " f"Рейтинг: {product.rating}, " f"Отзывов: {product.reviews_count}") # Вывод: # SKU: 987654321, Рейтинг: 4.7, Отзывов: 234 # SKU: 987654322, Рейтинг: 4.2, Отзывов: 89 asyncio.run(main()) ``` -------------------------------- ### Get Full Category Info - Python Source: https://context7.com/mephistofox/python-ozon-api/llms.txt A combined method to retrieve comprehensive category information, including all attributes and their possible values. Ideal for initial category structure exploration before bulk imports. ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: api.description_category_id = 17028922 api.type_id = 94765 api.language = "RU" category_info = await api.get_full_category_info() for field in category_info[:2]: print(f"Атрибут: {field['name']} (ID: {field['id']})") print(f" Описание: {field['description']}") print(f" Обязательный: {field['is_required']}") print(f" Значений: {len(field['values'].get('result', []))}") # Вывод: # Атрибут: Бренд (ID: 85) # Описание: Укажите название бренда товара # Обязательный: True # Значений: 12450 # Атрибут: Цвет (ID: 10096) # Описание: Выберите цвет товара # Обязательный: False # Значений: 287 asyncio.run(main()) ``` -------------------------------- ### Get Product Image Processing Status (v1 & v2) Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves the status of product image processing. v1 accepts a list of product_ids directly, while v2 uses a typed Pydantic request and response. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_pictures_info import ProductPicturesInfoRequestV2 async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: # Версия v1 — принимает список product_id напрямую result_v1 = await api.product_pictures_info(product_id=[123456789, 123456790]) print(f"Статусы (v1): {result_v1}") # Версия v2 — типизированный запрос request_v2 = ProductPicturesInfoRequestV2(product_id=[123456789]) result_v2 = await api.product_pictures_info_v2(request_v2) for pic in result_v2.pictures: print(f"product_id={pic.product_id}, " f"фото={pic.primary_photo}, статус={pic.state}") # Вывод: # product_id=123456789, фото=product-front.jpg, статус=imported asyncio.run(main()) ``` -------------------------------- ### Get Category Tree Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieve the complete category tree from Ozon using the `get_description_category_tree` method. This is useful for determining `description_category_id` and `type_id` required for product imports. ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: tree = await api.get_description_category_tree() # tree.result — список корневых категорий for category in tree.result[:3]: print(f"ID: {category.description_category_id}, " f"Название: {category.category_name}, " f"Подкатегорий: {len(category.children)}") # Вывод: # ID: 17028922, Название: Одежда, обувь и аксессуары, Подкатегорий: 12 # ID: 15621031, Название: Электроника, Подкатегорий: 25 # ID: 17028923, Название: Дом и сад, Подкатегорий: 18 asyncio.run(main()) ``` -------------------------------- ### Initialize OzonAPI Client Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Demonstrates how to initialize the OzonAPI client using both a recommended asynchronous context manager and a direct instantiation. It also shows how to configure response language and product description categories. ```APIDOC ## Initialize OzonAPI Client ### Description This section shows how to initialize the `OzonAPI` client, which is the main class for interacting with the Ozon API. It accepts `client_id` and `api_key` obtained from the seller's personal account. It is recommended to use the client as an asynchronous context manager for proper HTTP session management. ### Initialization with Context Manager (Recommended) ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key-here") as api: # Optional: Configure response language api.language = "RU" # Optional: Configure description category and type ID api.description_category_id = 17028922 api.type_id = 94765 print(f"Client initialized. URL: {api.api_url}") asyncio.run(main()) ``` ### Direct Initialization (Less Efficient) ```python import asyncio from ozon_api import OzonAPI async def main(): api = OzonAPI(client_id="123456", api_key="your-api-key-here") # Each request will create a temporary session, which is less efficient. # ... use api methods here ... asyncio.run(main()) ``` ### Output Example ``` Client initialized. URL: https://api-seller.ozon.ru ``` ``` -------------------------------- ### Initialize OzonAPI Client Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Initialize the OzonAPI client with your client ID and API key. It is recommended to use an asynchronous context manager for proper session management. Language and other settings can be configured upon initialization. ```python import asyncio from ozon_api import OzonAPI from ozon_api.exceptions import OzonAPIClientError, OzonAPIForbiddenError, OzonAPIError async def main(): # Рекомендуемый способ — через контекстный менеджер async with OzonAPI(client_id="123456", api_key="your-api-key-here") as api: # Настройка языка ответов (опционально) api.language = "RU" # Настройка категории и типа товара (опционально) api.description_category_id = 17028922 api.type_id = 94765 print(f"Клиент инициализирован. URL: {api.api_url}") # Альтернативный способ без контекстного менеджера api = OzonAPI(client_id="123456", api_key="your-api-key-here") # (каждый запрос создаёт временную сессию — менее эффективно) asyncio.run(main()) ``` -------------------------------- ### Import Product by SKU Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Creates seller product listings based on existing Ozon catalog items (by SKU). Use this when the product already exists in Ozon's database and you only need to create your offer. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.import_by_sku import ImportBySku async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ImportBySku( items=[ { "sku": 987654321, "name": "Кроссовки Nike Air Max 90 белые", "offer_id": "MY-SKU-001", "price": "4990", "old_price": "6990", "vat": "0.2", "currency_code": "RUB", } ] ) result = await api.product_import_by_sku(request) print(f"Результат: {result}") # Вывод: {'result': {'task_id': 172549812}} asyncio.run(main()) ``` -------------------------------- ### Get Related SKUs - `product_related_sku` Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves a list of related SKUs for specified products. This is useful for obtaining child or associated product items. ```APIDOC ## product_related_sku ### Description Retrieves a list of related SKUs for specified products. Useful for obtaining child or associated product items. ### Method POST ### Endpoint /product.related_sku ### Parameters #### Request Body - **sku** (array[integer]) - Required - List of product SKUs to get related SKUs for. ### Request Example ```json { "sku": [987654321] } ``` ### Response #### Success Response (200) - **items** (array[object]) - List of related SKU information. - **sku** (integer) - The original SKU. - **sku_list** (array[integer]) - List of related SKUs. ### Response Example ```json { "items": [ { "sku": 987654321, "sku_list": [987654323, 987654324] } ] } ``` ``` -------------------------------- ### Import Products to Ozon Platform Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Creates or updates products on the Ozon platform. Use this for initial product uploads with full details. Requires `client_id` and `api_key` for authentication. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_import import ProductImport, ProductImport_Item, ProductImport_Item_Attribute async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: item = ProductImport_Item( offer_id="MY-SKU-001", name="Кроссовки Nike Air Max 90", description_category_id=17028922, new_description_category_id=17028922, barcode="4607086563099", price="4990", old_price="6990", currency_code="RUB", vat="0.2", weight=500, weight_unit="g", width=20, height=30, depth=15, dimension_unit="cm", images=["https://cdn.example.com/img/nike-001.jpg"], images360=[], color_image="", primary_image="https://cdn.example.com/img/nike-001.jpg", pdf_list=[], attributes=[ ProductImport_Item_Attribute(complex_id=0, id=85, values=[{"value": "Nike", "dictionary_value_id": 906158}]), ProductImport_Item_Attribute(complex_id=0, id=10096, values=[{"value": "Белый", "dictionary_value_id": 61577}]), ], complex_attributes=[], ) request = ProductImport(items=[item]) result = await api.product_import(request) print(f"task_id: {result.get('result', {}).get('task_id')}") # Вывод: task_id: 172549811 asyncio.run(main()) ``` -------------------------------- ### Get Product Import Status Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves the status of a product import task using its `task_id`. Useful for tracking import success or identifying errors. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_import_info import ProductImportInfo async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductImportInfo(task_id=172549811) info = await api.product_import_info(request) items = info.get("result", {}).get("items", []) for item in items: print(f"offer_id: {item['offer_id']}, " f"status: {item['status']}, " f"product_id: {item.get('product_id')}") if item.get("errors"): print(f" Ошибки: {item['errors']}") # Вывод: # offer_id: MY-SKU-001, status: imported, product_id: 123456789 asyncio.run(main()) ``` -------------------------------- ### Get Digital Code Upload Status Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves the status of a digital code upload task using its task_id. Useful for tracking import progress. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.upload_digital_codes import UploadDigitalCodesInfoRequest async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = UploadDigitalCodesInfoRequest(task_id=172549820) response = await api.upload_digital_codes_info(request) print(f"Статус: {response.result.status}") print(f"Загружено кодов: {response.result.total}") # Вывод: # Статус: imported # Загружено кодов: 2 asyncio.run(main()) ``` -------------------------------- ### Product Listing and Information Source: https://github.com/mephistofox/python-ozon-api/blob/main/implemented_methods_list.md Methods for retrieving lists of products and their details. ```APIDOC ## product_list POST /v3/product/list ### Description Retrieves a list of products. ### Method POST ### Endpoint /v3/product/list ## product_info_limit POST /v4/product/info/limit ### Description Retrieves the product limit information. ### Method POST ### Endpoint /v4/product/info/limit ## product_info_attributes POST /v3/product/info/attributes ### Description Retrieves the description of product attributes. ### Method POST ### Endpoint /v3/product/info/attributes ## product_info_list POST /v3/product/info/list ### Description Retrieves information about products by their identifiers. ### Method POST ### Endpoint /v3/product/info/list ``` -------------------------------- ### List Seller Products with Filtering and Pagination Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Use this to retrieve a list of seller's products. Supports filtering by offer_id, product_id, visibility, and pagination using last_id. Up to 1000 products can be returned per request. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_list import ProductListRequest, ProductListFilter async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: # Получить все видимые товары request = ProductListRequest( filter=ProductListFilter(visibility="VISIBLE"), limit=100, sort_by="product_id", sort_dir="ASC", ) result = await api.product_list(request) items = result.result.items print(f"Получено: {len(items)} из {result.result.total}") for item in items[:3]: print(f" product_id={item['product_id']}, offer_id={item['offer_id']}") # Пагинация — следующая страница if result.result.last_id: request.last_id = result.result.last_id next_page = await api.product_list(request) print(f"Следующая страница: {len(next_page.result.items)} товаров") # Вывод: # Получено: 100 из 3450 # product_id=123456789, offer_id=MY-SKU-001 # product_id=123456790, offer_id=MY-SKU-002 # product_id=123456791, offer_id=MY-SKU-003 asyncio.run(main()) ``` -------------------------------- ### Get Category Attributes - Python Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves a list of attributes for a specified category. Requires `api.description_category_id` and `api.type_id` to be set. The output is used for product import requests. ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: api.description_category_id = 17028922 api.type_id = 94765 api.language = "RU" attributes = await api.get_description_category_attribute() for attr in attributes.get("result", [])[:3]: print(f"ID: {attr['id']}, Название: {attr['name']}, " f"Обязательный: {attr['is_required']}") # Вывод: # ID: 85, Название: Бренд, Обязательный: True # ID: 10096, Название: Цвет, Обязательный: False # ID: 4294478, Название: Размер, Обязательный: False asyncio.run(main()) ``` -------------------------------- ### Product Information List - product_info_list Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves detailed information about products using their identifiers (offer_id, product_id, or sku). Includes images, prices, statuses, and attributes. ```APIDOC ## Товары — `product_info_list` ### Description Возвращает детальную информацию о товарах по их идентификаторам (`offer_id`, `product_id` или `sku`). Включает изображения, цены, статусы и характеристики. ### Method `POST` (implied by SDK usage) ### Endpoint `/product/info/list` (inferred from SDK usage) ### Parameters #### Request Body - **offer_id** (`array` of `string`) - Optional - List of offer identifiers. - **product_id** (`array` of `string`) - Optional - List of product identifiers. - **sku** (`array` of `string`) - Optional - List of SKU identifiers. ### Request Example ```python ProductInfoListRequest( offer_id=["MY-SKU-001", "MY-SKU-002"], product_id=[], sku=[], ) ``` ### Response #### Success Response (200) - **result** (`object`) - **items** (`array`) - List of product information items. - **offer_id** (`string`) - The seller's offer identifier. - **sku** (`string`) - The Stock Keeping Unit identifier. - **price** (`string`) - The product's price. - **status** (`object`) - **state** (`string`) - The current state of the product (e.g., "price_sent"). ### Response Example ```json { "result": { "items": [ { "offer_id": "MY-SKU-001", "sku": "987654321", "price": "1990", "status": {"state": "price_sent"} }, { "offer_id": "MY-SKU-002", "sku": "987654322", "price": "3490", "status": {"state": "price_sent"} } ] } } ``` ``` -------------------------------- ### product_import_by_sku Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Creates seller product offers based on existing products in the Ozon catalog (by SKU). Used when the product already exists in the Ozon database and only your offer needs to be created. ```APIDOC ## product_import_by_sku ### Description Creates seller product offers based on existing products in the Ozon catalog (by SKU). Used when the product already exists in the Ozon database and only your offer needs to be created. ### Method POST (inferred from SDK usage) ### Endpoint (Not explicitly provided, inferred from SDK usage) ### Request Body - **items** (array[object]) - Required - List of items to import by SKU. - **sku** (integer) - Required - The SKU of the existing product in Ozon's catalog. - **name** (string) - Required - Name of the product offer. - **offer_id** (string) - Required - Unique identifier for the product offer. - **price** (string) - Required - Price of the product offer. - **old_price** (string) - Optional - Previous price of the product offer. - **vat** (string) - Required - VAT rate for the offer. - **currency_code** (string) - Required - Currency code (e.g., "RUB"). ### Response #### Success Response (200) - **result** (object) - **task_id** (integer) - Description: Task ID for tracking the import process. ### Request Example ```python { "items": [ { "sku": 987654321, "name": "Кроссовки Nike Air Max 90 белые", "offer_id": "MY-SKU-001", "price": "4990", "old_price": "6990", "vat": "0.2", "currency_code": "RUB" } ] } ``` ### Response Example ```json { "result": { "task_id": 172549812 } } ``` ``` -------------------------------- ### Import Product Images Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Uploads or completely replaces product images. Pass all images for a product in each call. Accepts public JPG or PNG URLs. ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: result = await api.product_pictures_import( items={ "items": [ { "product_id": 123456789, "images": [ "https://cdn.example.com/img/product-front.jpg", "https://cdn.example.com/img/product-back.jpg", "https://cdn.example.com/img/product-side.jpg", ], "images360": [], "color_image": "https://cdn.example.com/img/product-color.jpg", } ] } ) print(f"Результат загрузки: {result}") # Вывод: {'result': [{'product_id': 123456789, 'status': 'imported'}]} asyncio.run(main()) ``` -------------------------------- ### Get Category Attribute Values - Python Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Fetches all possible values for a specific category attribute with built-in pagination. This data is used to populate the `values` field during product import. ```python import asyncio from ozon_api import OzonAPI async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: api.description_category_id = 17028922 api.type_id = 94765 api.language = "RU" # Получить все значения атрибута "Цвет" (id=10096) values_data = await api.get_description_category_attribute_values( attribute_id=10096, name="Цвет", limit=5000, ) values = values_data.get("result", []) print(f"Всего значений: {len(values)}") for v in values[:3]: print(f" ID: {v['id']}, Значение: {v['value']}") # Вывод: # Всего значений: 287 # ID: 61576, Значение: Бежевый # ID: 61577, Значение: Белый # ID: 61578, Значение: Голубой asyncio.run(main()) ``` -------------------------------- ### Exception Handling Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Illustrates how to handle various exceptions provided by the library, which correspond to different HTTP error codes from the Ozon API. All exceptions inherit from `OzonAPIError`. ```APIDOC ## Exception Handling ### Description The library provides a hierarchy of exceptions for all types of HTTP errors from the Ozon API. All exceptions inherit from `OzonAPIError` and contain `code`, `message`, and `details` attributes. ### Usage Example ```python import asyncio from ozon_api import OzonAPI from ozon_api.exceptions import ( OzonAPIClientError, # 400 - Bad Request OzonAPIForbiddenError, # 403 - Forbidden OzonAPINotFoundError, # 404 - Not Found OzonAPIConflictError, # 409 - Conflict OzonAPIServerError, # 500 - Server Error OzonAPIError, # Base exception ) from ozon_api.models.product_list import ProductListRequest, ProductListFilter async def main(): async with OzonAPI(client_id="123456", api_key="wrong-key") as api: try: request = ProductListRequest(filter=ProductListFilter(visibility="ALL")) result = await api.product_list(request) except OzonAPIForbiddenError as e: print(f"Forbidden Error [{e.code}]: {e.message}") except OzonAPIClientError as e: print(f"Client Error [{e.code}]: {e.message}") print(f"Details: {e.details}") except OzonAPIServerError as e: print(f"Server Error [{e.code}]: {e.message}") # Automatic retries up to 3 times with exponential backoff except OzonAPIError as e: print(f"Unknown Error: {e}") asyncio.run(main()) ``` ### Example Output for Forbidden Error ``` Forbidden Error [403]: Forbidden ``` ``` -------------------------------- ### Import Product Pictures - product_pictures_import Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Uploads or completely replaces product images. All images must be provided in each call, overwriting previous ones. Supports up to 15 regular images and 70 360° images. Accepts public URLs in JPG or PNG format. ```APIDOC ## Import Product Pictures - `product_pictures_import` Uploads or completely replaces product images. All images are provided in each call and overwrite previous ones. Supports up to 15 regular images and 70 360° images. Accepts public URLs in JPG or PNG format. ### Method ```python await api.product_pictures_import(items: dict) ``` ### Parameters #### Request Body - **items** (dict) - Required - A dictionary containing the product images to import. - **items** (list[dict]) - Required - A list of items, where each item represents a product and its images. - **product_id** (int) - Required - The ID of the product. - **images** (list[str]) - Required - A list of public URLs for the product's regular images. - **images360** (list[str]) - Optional - A list of public URLs for the product's 360° images. - **color_image** (str) - Optional - The public URL for the product's color image. ### Request Example ```python items={ "items": [ { "product_id": 123456789, "images": [ "https://cdn.example.com/img/product-front.jpg", "https://cdn.example.com/img/product-back.jpg", "https://cdn.example.com/img/product-side.jpg", ], "images360": [], "color_image": "https://cdn.example.com/img/product-color.jpg", } ] } ``` ### Response #### Success Response - **result** (list[dict]) - A list of results for each product processed. - **product_id** (int) - The ID of the product. - **status** (str) - The status of the image import (e.g., 'imported'). ``` -------------------------------- ### Product Image Management Source: https://github.com/mephistofox/python-ozon-api/blob/main/implemented_methods_list.md Methods for importing and managing product images. ```APIDOC ## product_pictures_import POST /v1/product/pictures/import ### Description Imports images for products. ### Method POST ### Endpoint /v1/product/pictures/import ## product_pictures_info POST /v2/product/pictures/info ### Description Retrieves the status of a product image import task. ### Method POST ### Endpoint /v2/product/pictures/info ## product_pictures_info_v2 POST /v2/product/pictures/info ### Description Retrieves information about product images (new version). ### Method POST ### Endpoint /v2/product/pictures/info ``` -------------------------------- ### Product Limits - product_info_limit Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves information about account limits, including the total assortment limit, daily creation limit, and daily update limit for products. ```APIDOC ## Товары — `product_info_limit` ### Description Возвращает информацию о лимитах аккаунта: общий лимит ассортимента, дневной лимит на создание и дневной лимит на обновление товаров. ### Method `GET` (implied by SDK usage) ### Endpoint `/product/info/limit` (inferred from SDK usage) ### Parameters None ### Request Example ```python # No specific request body or parameters needed for this call pass ``` ### Response #### Success Response (200) - **daily_create** (`object`) - **limit** (`integer`) - The daily limit for creating products. - **usage** (`integer`) - The number of products created today. - **daily_update** (`object`) - **usage** (`integer`) - The number of products updated today. ### Response Example ```json { "daily_create": { "limit": 100000, "usage": 12 }, "daily_update": { "usage": 45 } } ``` ``` -------------------------------- ### product_import Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Creates or updates products on the Ozon platform. It accepts a list of products with full characteristics, prices, images, and dimensions. Returns a `task_id` for tracking the task status. ```APIDOC ## product_import ### Description Creates or updates products on the Ozon platform. Accepts a list of products with full characteristics, prices, images, and dimensions. Returns a `task_id` for tracking the task status. ### Method POST (inferred from SDK usage) ### Endpoint (Not explicitly provided, inferred from SDK usage) ### Request Body - **items** (array[ProductImport_Item]) - Required - List of products to import. #### ProductImport_Item - **offer_id** (string) - Required - Unique identifier for the product offer. - **name** (string) - Required - Name of the product. - **description_category_id** (integer) - Required - Category ID for the description. - **new_description_category_id** (integer) - Required - New category ID for the description. - **barcode** (string) - Required - Product barcode. - **price** (string) - Required - Product price. - **old_price** (string) - Optional - Previous price of the product. - **currency_code** (string) - Required - Currency code (e.g., RUB). - **vat** (string) - Required - VAT rate (e.g., "0.2"). - **weight** (integer) - Required - Product weight. - **weight_unit** (string) - Required - Unit of weight (e.g., "g"). - **width** (integer) - Required - Product width. - **height** (integer) - Required - Product height. - **depth** (integer) - Required - Product depth. - **dimension_unit** (string) - Required - Unit of dimension (e.g., "cm"). - **images** (array[string]) - Optional - List of product image URLs. - **images360** (array[string]) - Optional - List of 360-degree image URLs. - **color_image** (string) - Optional - URL of the color image. - **primary_image** (string) - Optional - URL of the primary image. - **pdf_list** (array[string]) - Optional - List of PDF URLs. - **attributes** (array[ProductImport_Item_Attribute]) - Optional - List of product attributes. - **complex_attributes** (array) - Optional - List of complex attributes. #### ProductImport_Item_Attribute - **complex_id** (integer) - Required - Complex ID for the attribute. - **id** (integer) - Required - Attribute ID. - **values** (array[object]) - Required - List of attribute values. - **value** (string) - Required - The attribute value. - **dictionary_value_id** (integer) - Required - The dictionary value ID for the attribute. ### Response #### Success Response (200) - **result** (object) - **task_id** (integer) - Description: Task ID for tracking the import process. ### Request Example ```python { "items": [ { "offer_id": "MY-SKU-001", "name": "Кроссовки Nike Air Max 90", "description_category_id": 17028922, "new_description_category_id": 17028922, "barcode": "4607086563099", "price": "4990", "old_price": "6990", "currency_code": "RUB", "vat": "0.2", "weight": 500, "weight_unit": "g", "width": 20, "height": 30, "depth": 15, "dimension_unit": "cm", "images": ["https://cdn.example.com/img/nike-001.jpg"], "images360": [], "color_image": "", "primary_image": "https://cdn.example.com/img/nike-001.jpg", "pdf_list": [], "attributes": [ { "complex_id": 0, "id": 85, "values": [{"value": "Nike", "dictionary_value_id": 906158}] }, { "complex_id": 0, "id": 10096, "values": [{"value": "Белый", "dictionary_value_id": 61577}] } ], "complex_attributes": [] } ] } ``` ### Response Example ```json { "result": { "task_id": 172549811 } } ``` ``` -------------------------------- ### Product List - product_list Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Retrieves a list of seller's products with support for filtering by offer_id, product_id, visibility, and pagination using last_id. Up to 1000 products can be returned per request. ```APIDOC ## Товары — `product_list` ### Description Возвращает список товаров продавца с поддержкой фильтрации по `offer_id`, `product_id`, видимости, а также пагинации через `last_id`. За один запрос возвращается до 1000 товаров. ### Method `POST` (implied by SDK usage) ### Endpoint `/product/list` (inferred from SDK usage) ### Parameters #### Request Body - **filter** (`ProductListFilter`) - Required - Filter criteria for products. - **visibility** (`string`) - Optional - Product visibility status (e.g., "VISIBLE"). - **limit** (`integer`) - Optional - Maximum number of items to return (up to 1000). - **sort_by** (`string`) - Optional - Field to sort by (e.g., "product_id"). - **sort_dir** (`string`) - Optional - Sort direction ("ASC" or "DESC"). - **last_id** (`string`) - Optional - Identifier for pagination, to fetch the next page of results. ### Request Example ```python ProductListRequest( filter=ProductListFilter(visibility="VISIBLE"), limit=100, sort_by="product_id", sort_dir="ASC", ) ``` ### Response #### Success Response (200) - **result** (`object`) - **items** (`array`) - List of product items. - **product_id** (`string`) - The product's unique identifier. - **offer_id** (`string`) - The seller's offer identifier. - **total** (`integer`) - Total number of products available. - **last_id** (`string`) - Identifier for the next page of results, if available. ### Response Example ```json { "result": { "items": [ { "product_id": "123456789", "offer_id": "MY-SKU-001" }, { "product_id": "123456790", "offer_id": "MY-SKU-002" } ], "total": 3450, "last_id": "some_last_id" } } ``` ``` -------------------------------- ### Product Import and Management Source: https://github.com/mephistofox/python-ozon-api/blob/main/implemented_methods_list.md Methods for importing, updating, and deleting products. ```APIDOC ## product_import POST /v3/product/import ### Description Imports products into the system. ### Method POST ### Endpoint /v3/product/import ## product_import_info POST /v1/product/import/info ### Description Retrieves the status of a product import task. ### Method POST ### Endpoint /v1/product/import/info ## product_import_by_sku POST /v1/product/import-by-sku ### Description Imports products using their SKUs. ### Method POST ### Endpoint /v1/product/import-by-sku ## product_attributes_update POST /v1/product/attributes/update ### Description Updates attributes for existing products. ### Method POST ### Endpoint /v1/product/attributes/update ## products_delete POST /v2/products/delete ### Description Deletes products from the system. ### Method POST ### Endpoint /v2/products/delete ## upload_digital_codes POST /v1/product/upload_digital_codes ### Description Uploads digital codes for products. ### Method POST ### Endpoint /v1/product/upload_digital_codes ## upload_digital_codes_info POST /v1/product/upload_digital_codes/info ### Description Retrieves the status of a digital code upload task. ### Method POST ### Endpoint /v1/product/upload_digital_codes/info ``` -------------------------------- ### Product Subscription Source: https://github.com/mephistofox/python-ozon-api/blob/main/implemented_methods_list.md Method for subscribing to product information updates. ```APIDOC ## product_subscription POST /v1/product/info/subscription ### Description Subscribes to updates for product information. ### Method POST ### Endpoint /v1/product/info/subscription ``` -------------------------------- ### Add Product Barcodes - Python Ozon API Source: https://context7.com/mephistofox/python-ozon-api/llms.txt Use this to associate existing barcodes with products. Supports up to 100 products per request and 100 barcodes per product. Rate limit is 20 requests per minute. ```python import asyncio from ozon_api import OzonAPI from ozon_api.models.product_barcode_add import ProductBarcodeAddRequest async def main(): async with OzonAPI(client_id="123456", api_key="your-api-key") as api: request = ProductBarcodeAddRequest( items=[ {"product_id": 123456789, "barcode": "4607086563099"}, {"product_id": 123456790, "barcode": "4607086563100"}, ] ) response = await api.product_barcode_add(request) for item in response.result: print(f"product_id={item.product_id}: " f"{'добавлен' if item.updated else 'ошибка - ' + str(item.errors)}") # Вывод: # product_id=123456789: добавлен # product_id=123456790: добавлен asyncio.run(main()) ```