The store API: read the products, their sizes and their stock
The reference for the products address of the ArabyBot store API: the product and variant fields, paging, and the refusals.
On this page 7
The short answer
With a GET request to the products address of the store API. The response returns the products, a hundred a page, each with its name, SKU, price, compare-at price, stock, link and picture, and its sizes or colours, each with its own price and stock. The has_more field says whether there is a next page.
Also asked as: «اسحب منتجات المتجر والمخزون بالكود» · «list store products via api»
The address and authentication
GET https://app.arabybot.com/store_api/v1/products
Send the store key in the header Authorization: Bearer abst_… or X-Api-Key. You create the key in the store settings; it is shown once and sees only its own store. This address accepts a read key or a write key.
The fields
page(optional) The page number, starting at 1. A page holds 100 products.
An example request
cURL
curl "https://app.arabybot.com/store_api/v1/products?page=1" \ -H "Authorization: Bearer abst_YOUR_STORE_KEY"
PHP
$ch = curl_init('https://app.arabybot.com/store_api/v1/products?page=1');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer abst_YOUR_STORE_KEY'],
]);
$answer = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch); Python
import requests
r = requests.get(
'https://app.arabybot.com/store_api/v1/products?page=1',
headers={
"Authorization": "Bearer abst_YOUR_STORE_KEY",
},
timeout=30,
)
print(r.status_code, r.json()) Node.js
// Node.js 18+
const r = await fetch('https://app.arabybot.com/store_api/v1/products?page=1', {
headers: {"Authorization": "Bearer abst_YOUR_STORE_KEY"},
});
console.log(r.status, await r.json());
The response
200
{ "ok": true, "products": [
{ "id": 88, "name": "…", "sku": "…", "price": 240.0, "price_on_request": false,
"compare_at_price": 299.0, "track_stock": true, "stock": 14, "visible": true,
"url": "https://…/p/…", "image_url": "https://…",
"variants": [ { "id": 301, "sku": "…", "option1": "M", "option2": "Black",
"price": null, "stock": 6, "visible": true } ] }
], "page": 1, "has_more": false } variantsare the product's sizes or colours; an empty list for a product without them.priceinside a variant is null when the variant takes the product's price.- The product's
idand the variant'sidare what you send to change the stock or the price.
The refusals
Every refusal comes back as JSON with "ok": false and the code in error:
- 401
unauthorized: The key is missing, wrong or revoked. - 402
store_plan_closed: The store plan has ended; renew it. - 429: More than 120 requests in a minute.
- 500
server_error: A failure on our side; try again.
The limits
120 requests a minute from one IP address; passing that returns status 429. A store can have up to five keys. A key sees only its own store, and the store's plan must be active.
All store API addresses · All APIs for developers
Frequently asked questions
How do I get a variant's id to change its stock?
From this address: every variant in variants has an id. Send it in the variant_id field when changing the stock or the price.
How many products come back at a time?
A hundred a page. The has_more field says whether there is a next page.
Read next
Try the agent before you pay anything
The agent that will answer your customers is the one answering you now: ask it from the chat button here or on WhatsApp. Your account is free with no credit card, and the free trial on your own number or page is activated after you contact our team on customer-service WhatsApp.