Skip to main content
POST
/
api
/
products
/
create-with-epc
Create or update product with EPC IDs
curl --request POST \
  --url https://app.buylo.ai/api/products/create-with-epc \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "epc_id": [
    "aaa1234",
    "bbb1234",
    "ccc1234"
  ],
  "product": {
    "product_id": "ABC123",
    "name": {
      "en": "Brazil Santos Coffee",
      "cs": "Brazilská káva Santos"
    },
    "category": "Coffee",
    "description": {
      "en": "Roasted Arabica coffee beans from Brazil",
      "cs": "Pražená arabica z Brazílie"
    },
    "ean": "8591234567890",
    "brand": "CoffeeCo",
    "prices": [
      {
        "currency": "EUR",
        "price": 199.99
      },
      {
        "currency": "CZK",
        "price": 4999
      }
    ],
    "vat_rate": 21,
    "unit": "kg",
    "product_data": {
      "color": "red",
      "size": "L"
    }
  },
  "location_id": 1
}
'
import requests

url = "https://app.buylo.ai/api/products/create-with-epc"

payload = {
"epc_id": ["aaa1234", "bbb1234", "ccc1234"],
"product": {
"product_id": "ABC123",
"name": {
"en": "Brazil Santos Coffee",
"cs": "Brazilská káva Santos"
},
"category": "Coffee",
"description": {
"en": "Roasted Arabica coffee beans from Brazil",
"cs": "Pražená arabica z Brazílie"
},
"ean": "8591234567890",
"brand": "CoffeeCo",
"prices": [
{
"currency": "EUR",
"price": 199.99
},
{
"currency": "CZK",
"price": 4999
}
],
"vat_rate": 21,
"unit": "kg",
"product_data": {
"color": "red",
"size": "L"
}
},
"location_id": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
epc_id: ['aaa1234', 'bbb1234', 'ccc1234'],
product: {
product_id: 'ABC123',
name: {en: 'Brazil Santos Coffee', cs: 'Brazilská káva Santos'},
category: 'Coffee',
description: {
en: 'Roasted Arabica coffee beans from Brazil',
cs: 'Pražená arabica z Brazílie'
},
ean: '8591234567890',
brand: 'CoffeeCo',
prices: [{currency: 'EUR', price: 199.99}, {currency: 'CZK', price: 4999}],
vat_rate: 21,
unit: 'kg',
product_data: {color: 'red', size: 'L'}
},
location_id: 1
})
};

fetch('https://app.buylo.ai/api/products/create-with-epc', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.buylo.ai/api/products/create-with-epc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'epc_id' => [
'aaa1234',
'bbb1234',
'ccc1234'
],
'product' => [
'product_id' => 'ABC123',
'name' => [
'en' => 'Brazil Santos Coffee',
'cs' => 'Brazilská káva Santos'
],
'category' => 'Coffee',
'description' => [
'en' => 'Roasted Arabica coffee beans from Brazil',
'cs' => 'Pražená arabica z Brazílie'
],
'ean' => '8591234567890',
'brand' => 'CoffeeCo',
'prices' => [
[
'currency' => 'EUR',
'price' => 199.99
],
[
'currency' => 'CZK',
'price' => 4999
]
],
'vat_rate' => 21,
'unit' => 'kg',
'product_data' => [
'color' => 'red',
'size' => 'L'
]
],
'location_id' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://app.buylo.ai/api/products/create-with-epc"

payload := strings.NewReader("{\n \"epc_id\": [\n \"aaa1234\",\n \"bbb1234\",\n \"ccc1234\"\n ],\n \"product\": {\n \"product_id\": \"ABC123\",\n \"name\": {\n \"en\": \"Brazil Santos Coffee\",\n \"cs\": \"Brazilská káva Santos\"\n },\n \"category\": \"Coffee\",\n \"description\": {\n \"en\": \"Roasted Arabica coffee beans from Brazil\",\n \"cs\": \"Pražená arabica z Brazílie\"\n },\n \"ean\": \"8591234567890\",\n \"brand\": \"CoffeeCo\",\n \"prices\": [\n {\n \"currency\": \"EUR\",\n \"price\": 199.99\n },\n {\n \"currency\": \"CZK\",\n \"price\": 4999\n }\n ],\n \"vat_rate\": 21,\n \"unit\": \"kg\",\n \"product_data\": {\n \"color\": \"red\",\n \"size\": \"L\"\n }\n },\n \"location_id\": 1\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://app.buylo.ai/api/products/create-with-epc")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"epc_id\": [\n \"aaa1234\",\n \"bbb1234\",\n \"ccc1234\"\n ],\n \"product\": {\n \"product_id\": \"ABC123\",\n \"name\": {\n \"en\": \"Brazil Santos Coffee\",\n \"cs\": \"Brazilská káva Santos\"\n },\n \"category\": \"Coffee\",\n \"description\": {\n \"en\": \"Roasted Arabica coffee beans from Brazil\",\n \"cs\": \"Pražená arabica z Brazílie\"\n },\n \"ean\": \"8591234567890\",\n \"brand\": \"CoffeeCo\",\n \"prices\": [\n {\n \"currency\": \"EUR\",\n \"price\": 199.99\n },\n {\n \"currency\": \"CZK\",\n \"price\": 4999\n }\n ],\n \"vat_rate\": 21,\n \"unit\": \"kg\",\n \"product_data\": {\n \"color\": \"red\",\n \"size\": \"L\"\n }\n },\n \"location_id\": 1\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.buylo.ai/api/products/create-with-epc")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"epc_id\": [\n \"aaa1234\",\n \"bbb1234\",\n \"ccc1234\"\n ],\n \"product\": {\n \"product_id\": \"ABC123\",\n \"name\": {\n \"en\": \"Brazil Santos Coffee\",\n \"cs\": \"Brazilská káva Santos\"\n },\n \"category\": \"Coffee\",\n \"description\": {\n \"en\": \"Roasted Arabica coffee beans from Brazil\",\n \"cs\": \"Pražená arabica z Brazílie\"\n },\n \"ean\": \"8591234567890\",\n \"brand\": \"CoffeeCo\",\n \"prices\": [\n {\n \"currency\": \"EUR\",\n \"price\": 199.99\n },\n {\n \"currency\": \"CZK\",\n \"price\": 4999\n }\n ],\n \"vat_rate\": 21,\n \"unit\": \"kg\",\n \"product_data\": {\n \"color\": \"red\",\n \"size\": \"L\"\n }\n },\n \"location_id\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "product_epc_hashes": [
    "8aaedfc3559d0ce545ca55bcea31aad2",
    "2b1c7f8c2aab4e33a5e09a2d77f3b611",
    "a7d9c4e8b3f2a1c5e7b9d4f8a2c6e9b1"
  ]
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
epc_id
string[]
required

Array of EPC identifiers to assign to the product (must all be new)

Minimum array length: 1
Example:
["aaa1234", "bbb1234", "ccc1234"]
product
object
required
location_id
integer | null

Optional location ID to immediately assign all created EPCs to (sets latest_location_id). If omitted or null, EPCs are created without a location.

Example:

1

Response

Product created/updated and EPCs assigned successfully

product_epc_hashes
string[]
required

List of unique EPC hashes for newly created EPCs

Example:
[
"8aaedfc3559d0ce545ca55bcea31aad2",
"2b1c7f8c2aab4e33a5e09a2d77f3b611",
"a7d9c4e8b3f2a1c5e7b9d4f8a2c6e9b1"
]