Skip to content

Creation with products

POST
/v2/product-import/create-with-products
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.

platform-id
string
default: 7d4a4c38-dd84-4902-b744-0488b80a4c01

Platform identifier. A static value is used for integrations.

Billz-Response-Channel
string
Allowed values: HTTP

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.

Billz-Response-Channel
string
Allowed values: HTTP

Same as the Billz-Response-Channel header — for clients that cannot send a custom header. If both are passed, the header applies.

Media typeapplication/json
object
shop_id
required

The shop must be accessible to the user, otherwise 400

string
products
required

List of products

Array<object>
object
id

Identifier of an existing product. If not passed, the product is looked up by sku and barcode, and created if not found

string
name

Name; required for a new product

string
sku

SKU; required if id is not passed

string
barcode

Barcode; required if id is not passed. The sku and barcode pair must not repeat within the request

string
description

Description

string
measurement_value
required

Quantity to import; must be greater than zero, otherwise 400

number format: double
supply_price

Supply price

number format: double
retail_price

Retail price; if it differs from the current price in the shop, it replaces it

number format: double
wholesale_price

Wholesale price

number format: double
measurement_unit_id

Unit of measure; if omitted, the company’s default unit is used

string
category_ids

Product categories

Array<string>
brand_id

Brand id

string
supplier_id

Supplier

string
product_custom_fields

Product attributes

Array<object>
object
product_detail_id
string
product_characteristic_id
string
value
string
name
string
from_parent
boolean
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"
}
]
}
]
}

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.

Media typeapplication/json

Response of an asynchronous method without the Billz-Response-Channel header — the event has been published.

object
message

Correlation_id of the published event

string format: uuid
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.

Media typeapplication/json
One of:

Error body. Several error body formats coexist in the API; all formats and codes are described in the “Response codes and errors” section.

object
code

HTTP code or internal numeric error code

integer
message

Human-readable message

string
error
One of:
string
data

Payload (usually null on error)

object
Examplegenerated
{
"code": 1,
"message": "example",
"error": {
"code": "example",
"message": "example"
},
"data": {}
}