Introduction
Welcome to the StoreBuddy API documentation. You can use StoreBuddy API endpoints to access various resources and fiscalize invoices.
Environments
StoreBuddy provides two environments:
- Sandbox, used for testing purposes. The API is located at https://api.sandbox.storebuddy.rs and the application is located at https://sandbox.storebuddy.rs
- Production, used for production applications. The API is located at https://api.production.storebuddy.rs and the application is located at https://storebuddy.rs
API version
Currently active API version is v2
Authentication
In order to use the API, you will need to create an API key and secret under the StoreBuddy settings.
API key and secret must be included in all API request in an Authorization header.
The contents of the header should be base64 encoded API_KEY:API_SECRET
For example, if your API key is production.6BO7smrNTMCpugLBzPSVdX
and API secret is 6cuiEePSXps0xdHjm4SeQp
, concatenate it as production.6BO7smrNTMCpugLBzPSVdX:6cuiEePSXps0xdHjm4SeQp
and then encode it with base64. Then use it in the Authorization header like this:
Authorization: cHJvZHVjdGlvbi42Qk83c21yTlRNQ3B1Z0xCelBTVmRYOjZjdWlFZVBTWHBzMHhkSGptNFNlUXA=
Stores
Get all stores
This endpoint retrieves all stores
HTTP Request
GET https://api.production.storebuddy.rs/v2/stores
The above request returns JSON array of all stores.
[
{
"id": "c20aef1d-3944-45ba-b984-7900242d2c68", // Store ID
"name": "Store 1", // Store name
"address": "Address 1", // Store address
"phone": null, // Store phone
"createdAt": "2020-01-01T00:00:00.000Z", // Store creation date
"updatedAt": "2020-01-01T00:00:00.000Z", // Store update date
"deletedAt": null, // Store deletion date
"companyId": "c20aef1d-3944-45ba-b984-7900242d2c68", // Company ID
}
]
Products
Get all products
This endpoint retrieves all products
HTTP Request
GET https://api.production.storebuddy.rs/v2/products?full=true
Query parameter full
can be used to retrieve full product data. If it’s not passed, or it’s set to false
, only basic (essential) product data will be returned.
The above request returns JSON array of all products.
[
{
"active": true, // Is the product active
"baseUnitId": null, // ID of the base unit (the one that is specified on the product)
"brandId": null, // Not used yet
"bulk": null, // Not used yet
"categories": [], // Array of category IDs
"companyId": "b91a166d-41a6-4a70-979d-afefc5515f3e", // Company ID that owns the product
"coverImage": null, // Main product image
"createdAt": "2022-07-25T08:36:33.727Z", // Creation timestamp
"currencyId": null, // 3 letter currency ID, defaults to RSD if unspecified. Note: the amount will always be converted to RSD with currently valid exchange rate by the National Bank of Serbia.
"deletedAt": null, // Deletion timestamp
"description": null, // Product description
"dimensions": null, // Not yet used
"ean": null, // Product EAN code
"hasVariants": false, // Is this product holding multiple variants
"id": "f6fb869c-48b7-4642-890b-60a144298905", // Product ID,
"images": [], // All product images
"invoiceUnit": null, // Not yet used
"manufacturerSku": null, // SKU that is assigned by the manufacturer
"name": "Product 1", // Product name
"order": null, // Sorting order of the product, only used for variants
"parentId": null, // ID of the parent product, only used for variants
"price": 200, // Product price, defined in the selected currency
"productType": "product", // Produt type, can be "product", "service" or "digital"
"quantityFromScale": false, // Whether this product will take quantity from the connected weighing scale
"quantityPerBaseUnit": null, // Quantity that is specified on the product packaging, e.g. net weight
"saleUnitId": null, // Unit in which the product is being sold, e.g. piece
"sku": 1, // Stock keeping unit
"subtitle": null, // Short description
"taxRateLabels": ["Ђ"], // Tax labels, currently valid labels are: Ђ (20%), Е (10%), Г (0%), А (subject is not VAT registered). Tax labels must be in cyrillic.
"trackStock": false, // Not yet used
"unit": null, // Deprecated, use baseUnitId
"unitAmount": null, // Deprecated, use quantityPerBaseUnit
"updatedAt": "2022-07-25T08:36:33.727Z", // Updated timestamp
"variantName": null, // Variant name
"variants": [], // Array of all child variants
"weight": null // Not yet used
}
]
Get a product
This endpoint retrieves a single product
HTTP Request
GET https://api.production.storebuddy.rs/v2/products/:productId
GET https://api.production.storebuddy.rs/v2/products/:sku
The above request returns the single product
{
"active": true, // Is the product active
"baseUnitId": null, // ID of the base unit (the one that is specified on the product)
"brandId": null, // Not used yet
"bulk": null, // Not used yet
"categories": [], // Array of category IDs
"companyId": "b91a166d-41a6-4a70-979d-afefc5515f3e", // Company ID that owns the product
"coverImage": null, // Main product image
"createdAt": "2022-07-25T08:36:33.727Z", // Creation timestamp
"currencyId": null, // 3 letter currency ID, defaults to RSD if unspecified
"deletedAt": null, // Deletion timestamp
"description": null, // Product description
"dimensions": null, // Not yet used
"ean": null, // Product EAN code
"hasVariants": false, // Is this product holding multiple variants
"id": "f6fb869c-48b7-4642-890b-60a144298905", // Product ID,
"images": [], // All product images
"invoiceUnit": null, // Not yet used
"manufacturerSku": null, // SKU that is assigned by the manufacturer
"name": "Product 1", // Product name
"order": null, // Sorting order of the product, only used for variants
"parentId": null, // ID of the parent product, only used for variants
"price": 200, // Product price, defined in the selected currency
"productType": "product", // Produt type, can be "product", "service" or "digital"
"quantityFromScale": false, // Whether this product will take quantity from the connected weighing scale
"quantityPerBaseUnit": null, // Quantity that is specified on the product packaging, e.g. net weight
"saleUnitId": null, // Unit in which the product is being sold, e.g. piece
"sku": 1, // Stock keeping unit
"subtitle": null, // Short description
"taxRateLabels": ["Ђ"], // Tax labels, currently valid labels are: Ђ (20%), Е (10%), Г (0%), А (subject is not VAT registered). Tax labels must be in cyrillic.
"trackStock": false, // Not yet used
"unit": null, // Deprecated, use baseUnitId
"unitAmount": null, // Deprecated, use quantityPerBaseUnit
"updatedAt": "2022-07-25T08:36:33.727Z", // Updated timestamp
"variantName": null, // Variant name
"variants": [], // Array of all child variants
"weight": null // Not yet used
}
Create a product
This endpoint creates a product
HTTP Request
POST https://api.production.storebuddy.rs/v2/products
Request body
{
"active": true, // Is the product active
"baseUnitId": null, // ID of the base unit (the one that is specified on the product)
"categories": [], // Array of category IDs
"currencyId": null, // 3 letter currency ID, defaults to RSD if unspecified. Note: the amount will always be converted to RSD with currently valid exchange rate by the National Bank of Serbia.
"description": null, // Product description
"dimensions": null, // Not yet used
"ean": null, // Product EAN code
"hasVariants": false, // Is this product holding multiple variants
"images": [], // IDs of the product images. See files section for more information
"manufacturerSku": null, // SKU that is assigned by the manufacturer
"name": "Product 1", // Product name, required
"price": 200, // Product price, defined in the selected currency
"productType": "product", // Produt type, can be "product", "service" or "digital", required
"quantityFromScale": false, // Whether this product will take quantity from the connected weighing scale
"quantityPerBaseUnit": null, // Quantity that is specified on the product packaging, e.g. net weight
"saleUnitId": null, // Unit in which the product is being sold, e.g. piece
"sku": 1, // Stock keeping unit, if not specified, first available SKU will be assigned
"variants": [], // Array of all child variants, structure is the same as the product, with the addition of "variantName" field
}
The above request returns the created product
{
"active": true, // Is the product active
"baseUnitId": null, // ID of the base unit (the one that is specified on the product)
"brandId": null, // Not used yet
"bulk": null, // Not used yet
"categories": [], // Array of category IDs
"companyId": "b91a166d-41a6-4a70-979d-afefc5515f3e", // Company ID that owns the product
"coverImage": null, // Main product image
"createdAt": "2022-07-25T08:36:33.727Z", // Creation timestamp
"currencyId": null, // 3 letter currency ID, defaults to RSD if unspecified
"deletedAt": null, // Deletion timestamp
"description": null, // Product description
"dimensions": null, // Not yet used
"ean": null, // Product EAN code
"hasVariants": false, // Is this product holding multiple variants
"id": "f6fb869c-48b7-4642-890b-60a144298905", // Product ID,
"images": [], // All product images
"invoiceUnit": null, // Not yet used
"manufacturerSku": null, // SKU that is assigned by the manufacturer
"name": "Product 1", // Product name
"order": null, // Sorting order of the product, only used for variants
"parentId": null, // ID of the parent product, only used for variants
"price": 200, // Product price, defined in the selected currency
"productType": "product", // Produt type, can be "product", "service" or "digital"
"quantityFromScale": false, // Whether this product will take quantity from the connected weighing scale
"quantityPerBaseUnit": null, // Quantity that is specified on the product packaging, e.g. net weight
"saleUnitId": null, // Unit in which the product is being sold, e.g. piece
"sku": 1, // Stock keeping unit
"subtitle": null, // Short description
"taxRateLabels": ["Ђ"], // Tax labels, currently valid labels are: Ђ (20%), Е (10%), Г (0%), А (subject is not VAT registered). Tax labels must be in cyrillic.
"trackStock": false, // Not yet used
"unit": null, // Deprecated, use baseUnitId
"unitAmount": null, // Deprecated, use quantityPerBaseUnit
"updatedAt": "2022-07-25T08:36:33.727Z", // Updated timestamp
"variantName": null, // Variant name
"variants": [], // Array of all child variants
"weight": null // Not yet used
}
Update a product
This endpoint updates a product
HTTP Request
PATCH https://api.production.storebuddy.rs/v2/products/:productId
PATCH https://api.production.storebuddy.rs/v2/products/:sku
Request body
{
"active": true, // Is the product active
"baseUnitId": null, // ID of the base unit (the one that is specified on the product)
"categories": [], // Array of category IDs
"currencyId": null, // 3 letter currency ID, defaults to RSD if unspecified. Note: the amount will always be converted to RSD with currently valid exchange rate by the National Bank of Serbia.
"description": null, // Product description
"dimensions": null, // Not yet used
"ean": null, // Product EAN code
"hasVariants": false, // Is this product holding multiple variants
"images": [], // IDs of the product images. See files section for more information
"manufacturerSku": null, // SKU that is assigned by the manufacturer
"name": "Product 1", // Product name
"price": 200, // Product price, defined in the selected currency
"productType": "product", // Produt type, can be "product", "service" or "digital",
"quantityFromScale": false, // Whether this product will take quantity from the connected weighing scale
"quantityPerBaseUnit": null, // Quantity that is specified on the product packaging, e.g. net weight
"saleUnitId": null, // Unit in which the product is being sold, e.g. piece
"sku": 1, // Stock keeping unit, if not specified, first available SKU will be assigned
"variants": [], // Array of all child variants, structure is the same as the product, with the addition of "variantName" field
}
The above request returns the updated product
{
"active": true, // Is the product active
"baseUnitId": null, // ID of the base unit (the one that is specified on the product)
"brandId": null, // Not used yet
"bulk": null, // Not used yet
"categories": [], // Array of category IDs
"companyId": "b91a166d-41a6-4a70-979d-afefc5515f3e", // Company ID that owns the product
"coverImage": null, // Main product image
"createdAt": "2022-07-25T08:36:33.727Z", // Creation timestamp
"currencyId": null, // 3 letter currency ID, defaults to RSD if unspecified
"deletedAt": null, // Deletion timestamp
"description": null, // Product description
"dimensions": null, // Not yet used
"ean": null, // Product EAN code
"hasVariants": false, // Is this product holding multiple variants
"id": "f6fb869c-48b7-4642-890b-60a144298905", // Product ID,
"images": [], // All product images
"invoiceUnit": null, // Not yet used
"manufacturerSku": null, // SKU that is assigned by the manufacturer
"name": "Product 1", // Product name
"order": null, // Sorting order of the product, only used for variants
"parentId": null, // ID of the parent product, only used for variants
"price": 200, // Product price, defined in the selected currency
"productType": "product", // Produt type, can be "product", "service" or "digital"
"quantityFromScale": false, // Whether this product will take quantity from the connected weighing scale
"quantityPerBaseUnit": null, // Quantity that is specified on the product packaging, e.g. net weight
"saleUnitId": null, // Unit in which the product is being sold, e.g. piece
"sku": 1, // Stock keeping unit
"subtitle": null, // Short description
"taxRateLabels": ["Ђ"], // Tax labels, currently valid labels are: Ђ (20%), Е (10%), Г (0%), А (subject is not VAT registered). Tax labels must be in cyrillic.
"trackStock": false, // Not yet used
"unit": null, // Deprecated, use baseUnitId
"unitAmount": null, // Deprecated, use quantityPerBaseUnit
"updatedAt": "2022-07-25T08:36:33.727Z", // Updated timestamp
"variantName": null, // Variant name
"variants": [], // Array of all child variants
"weight": null // Not yet used
}
Delete a product
This endpoint deletes a product
HTTP Request
DELETE https://api.production.storebuddy.rs/v2/products/:productId
DELETE https://api.production.storebuddy.rs/v2/products/:sku
The above request returns the empty object
{}
Receipts
Create a draft receipt
This endpoint will create a draft fiscal receipt.
HTTP Request
POST https://api.production.storebuddy.rs/v2/receipts/drafts
Request body
{
"storeId": "c20aef1d-3944-45ba-b984-7900242d2c68", // Store ID on which the receipt will be created
"invoiceType": "normal", // Type of invoice, possible values are: "normal" and "advance"
"items": [
{
"sku": 1, // SKU of the product
"quantity": 1, // Quantity of the product
"unitPrice": 100, // Override the price of the product, optional
},
{
"sku": 2, // SKU of the product
"quantity": 5, // Quantity of the product
}
]
}
The above request returns the draft receipt
{
"id": "637a0b4a-389c-4d21-a748-b8fb7ac2133b", // Draft receipt ID, it is used for updating the receipt or
"items": [
{
"productId": "86c2408e-034a-45be-b893-28e8afd32254", // Product ID
"sku": 1, // SKU of the product
"quantity": 1, // Quantity of the product
"unitPrice": 100, // Override the price of the product, optional
},
{
"productId": "bb03724d-c8be-4782-86c4-d2370ae9147b", // Product ID
"sku": 2, // SKU of the product
"quantity": 5, // Quantity of the product
}
]
}
Add item to a draft receipt
This endpoint will add an item to a draft fiscal receipt.
HTTP Request
POST https://api.production.storebuddy.rs/v2/receipts/drafts/:draftId/items
Request body
{
"storeId": "c20aef1d-3944-45ba-b984-7900242d2c68", // Store ID
"sku": 1, // SKU of the product
"quantity": 1, // Quantity of the product
"unitPrice": 100, // Override the price of the product, optional
},
The above request returns the added item
{
"productId": "86c2408e-034a-45be-b893-28e8afd32254", // Product ID
"sku": 1, // SKU of the product
"quantity": 1, // Quantity of the product
"unitPrice": 100, // Override the price of the product, optional
}
Finalize a draft receipt
This endpoint will finalize a draft receipt. This action will create a fiscal receipt and will remove the draft receipt.
HTTP Request
PATCH https://api.production.storebuddy.rs/v2/receipts/drafts/:draftId/finalize
Request body
{
"storeId": "c20aef1d-3944-45ba-b984-7900242d2c68", // Store ID
"payment": [ // Array of payments
{
"paymentType": "cash", // Payment type, possible values are: "cash", "card", "check", "mobilemoney", "wiretransfer", "voucher" and "other"
"amount": 100, // Amount of the payment
}
],
"buyerId": "10:110228902", // Buyer ID, optional. See https://tap.sandbox.suf.purs.gov.rs/Help/view/1601869521/%D0%A0%D0%B0%D1%87%D1%83%D0%BD-%D1%81%D0%B0-%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D1%98%D0%BE%D0%BC-%D0%BA%D1%83%D0%BF%D1%86%D0%B0/sr-Cyrl-RS
"buyerCostCenterId": null, // Optional buyer cost center ID, see https://tap.sandbox.suf.purs.gov.rs/Help/view/1601869521/%D0%A0%D0%B0%D1%87%D1%83%D0%BD-%D1%81%D0%B0-%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D1%98%D0%BE%D0%BC-%D0%BA%D1%83%D0%BF%D1%86%D0%B0/sr-Cyrl-RS
"receiptDelivery": { // How should this receipt be delivered
"a4Printer": true, // If the receipt should be printed on A4 paper
"thermalPrinter": true, // If the receipt should be printed on thermal paper
"email": "mail@example.com", // Email address to send the receipt to
"pdf": true, // Return the PDF url
}
},
The above request returns the finalized draft with the fiscalized receipt
{
"draftId": "637a0b4a-389c-4d21-a748-b8fb7ac2133b", // Draft receipt ID
"items": [
{
"productId": "86c2408e-034a-45be-b893-28e8afd32254", // Product ID
"sku": 1, // SKU of the product
"quantity": 1, // Quantity of the product
"unitPrice": 100, // Override the price of the product, optional
},
{
"productId": "bb03724d-c8be-4782-86c4-d2370ae9147b", // Product ID
"sku": 2, // SKU of the product
"quantity": 5, // Quantity of the product
}
],
"receipt": {
// See Response section at https://tap.sandbox.suf.purs.gov.rs/Help/view/1672078854/Create-Invoice/en-US
}
}