Creation with products
const url = 'https://api-admin.billz.ai/v2/product-import/create-with-products?Billz-Response-Channel=HTTP';const options = { method: 'POST', headers: { 'platform-id': '7d4a4c38-dd84-4902-b744-0488b80a4c01', 'Billz-Response-Channel': 'HTTP', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"shop_id":"32216bdd-28c6-4fd4-923a-4e9dd8a9263f","products":[{"name":"Nike Air Force 1","barcode":"20000003143","sku":"NK-AF1-D23","description":"Nike Air Force 1. Classical Shoes","measurement_value":1,"retail_price":20,"supply_price":10,"wholesale_price":15,"measurement_unit_id":"2e77e0b3-f173-4f77-b39a-5ec7f36c501a","category_ids":["f31da3e2-cded-478f-abb3-8b6d72c43653"],"brand_id":"3a862e16-9e10-4850-9fd1-abe28c2a19b9","supplier_id":"cf2bf476-2215-4d19-be78-e36ba9610408","product_custom_fields":[{"product_characteristic_id":"4a8b56ca-4fea-4454-8171-72226873665b","value":"Black"}]}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://api-admin.billz.ai/v2/product-import/create-with-products?Billz-Response-Channel=HTTP' \ --header 'Authorization: Bearer <token>' \ --header 'Billz-Response-Channel: HTTP' \ --header 'Content-Type: application/json' \ --header 'platform-id: 7d4a4c38-dd84-4902-b744-0488b80a4c01' \ --data '{ "shop_id": "32216bdd-28c6-4fd4-923a-4e9dd8a9263f", "products": [ { "name": "Nike Air Force 1", "barcode": "20000003143", "sku": "NK-AF1-D23", "description": "Nike Air Force 1. Classical Shoes", "measurement_value": 1, "retail_price": 20, "supply_price": 10, "wholesale_price": 15, "measurement_unit_id": "2e77e0b3-f173-4f77-b39a-5ec7f36c501a", "category_ids": [ "f31da3e2-cded-478f-abb3-8b6d72c43653" ], "brand_id": "3a862e16-9e10-4850-9fd1-abe28c2a19b9", "supplier_id": "cf2bf476-2215-4d19-be78-e36ba9610408", "product_custom_fields": [ { "product_characteristic_id": "4a8b56ca-4fea-4454-8171-72226873665b", "value": "Black" } ] } ] }'Asynchronous method. To receive the result synchronously over HTTP, pass the Billz-Response-Channel: HTTP header — otherwise the response will be 200 {"message": "<correlation_id>"}. Maximum wait is 600 seconds, after which 408 with error.code = TIMEOUT is returned. > ⚠️ A synchronous successful response is unreachable. With the Billz-Response-Channel: HTTP header the request ends with 408 TIMEOUT after 600 seconds, although the operation is performed. The result must be checked with a separate read request.
Error codes: 404 — object not found; 408 — timed out waiting for the asynchronous result; 401, 403, 429, 500 — shared by all methods. Body formats and semantics: Response codes and errors.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Platform identifier. A static value is used for integrations.
HTTP — wait for the event processing result and return it in the HTTP response. Without the header the method returns only the correlation_id of the published event.
Query Parameters
Section titled “Query Parameters”Same as the Billz-Response-Channel header — for clients that cannot send a custom header. If both are passed, the header applies.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The shop must be accessible to the user, otherwise 400
List of products
object
Identifier of an existing product. If not passed, the product is looked up by sku and barcode, and created if not found
Name; required for a new product
SKU; required if id is not passed
Barcode; required if id is not passed. The sku and barcode pair must not repeat within the request
Description
Quantity to import; must be greater than zero, otherwise 400
Supply price
Retail price; if it differs from the current price in the shop, it replaces it
Wholesale price
Unit of measure; if omitted, the company’s default unit is used
Product categories
Brand id
Supplier
Product attributes
object
Example
{ "shop_id": "32216bdd-28c6-4fd4-923a-4e9dd8a9263f", "products": [ { "name": "Nike Air Force 1", "barcode": "20000003143", "sku": "NK-AF1-D23", "description": "Nike Air Force 1. Classical Shoes", "measurement_value": 1, "retail_price": 20, "supply_price": 10, "wholesale_price": 15, "measurement_unit_id": "2e77e0b3-f173-4f77-b39a-5ec7f36c501a", "category_ids": [ "f31da3e2-cded-478f-abb3-8b6d72c43653" ], "brand_id": "3a862e16-9e10-4850-9fd1-abe28c2a19b9", "supplier_id": "cf2bf476-2215-4d19-be78-e36ba9610408", "product_custom_fields": [ { "product_characteristic_id": "4a8b56ca-4fea-4454-8171-72226873665b", "value": "Black" } ] } ]}Responses
Section titled “Responses”Event accepted: {"message": "<correlation_id>"}. With the Billz-Response-Channel: HTTP header there is no success response — the request ends with 408 even though the operation is performed; only errors arrive synchronously.
Response of an asynchronous method without the Billz-Response-Channel header — the event has been published.
object
Correlation_id of the published event
Examplegenerated
{ "message": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Bad request. With the Billz-Response-Channel: HTTP header, item rejections also come here: if at least one item fails validation, the import is not created and the errors are in data.errors.
Error body. Several error body formats coexist in the API; all formats and codes are described in the “Response codes and errors” section.
Import item rejection
object
Final HTTP code, 400
Response event type
object
Import shop
Errors by item
object
Item index in products, zero-based
Error text
object
Error code
Error text
Details, if any
Examplegenerated
{ "code": 1, "message": "example", "error": { "code": "example", "message": "example" }, "data": {}}