Authorization header.| Field | Type | Description |
|---|---|---|
| username | required | Your La Grana system login |
| password | required | Your password |
curl -X POST https://b2b.lagrana.pl/api/token/ \ -H "Content-Type: application/json" \ -d '{"username": "twoj_login", "password": "haslo"}'
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
The access token is valid for 60 minutes. Refresh via POST /api/token/refresh/ with the refresh token.
Attach token to every request:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
next field to iterate through pages.https://b2b.lagrana.pl/api/
{
"count": 1248, // total number of results
"next": "https://b2b.lagrana.pl/api/products/?page=2",
"previous": null,
"results": [ /* ... */ ]
}
client_price is the final price after discount; client_price_without_discount is the base price before discount.| Parameter | Type | Description |
|---|---|---|
| page | optional | Page number (default 1) |
| brand | optional | Filter by brand name |
| categories | optional | Filter by category ID |
| status | optional | Filter by status ID |
| active | optional | true / false |
| search | optional | Search by SKU or status |
Response fields
■ price fields ■ nested objects/arrays
{
"count": 1248,
"next": "https://b2b.lagrana.pl/api/products/?page=2",
"previous": null,
"results": [
{
"id": 42,
"sku": "LG-12345",
"name": "Nazwa produktu",
"brand": "BrandName",
"ean": "1234567890123",
"active": true,
"vat_rate": 23,
"for_who": "Dla niej",
"advantages": ["Zaletą jest...", "..."],
"stock_warehouse": 24,
"stock_supplier": 10,
"added_at": "2025-01-15T08:00:00Z",
"updated_at": "2026-03-01T12:00:00Z",
"client_price": "84.15", // price after discount
"client_price_without_discount": "99.00", // base price
"categories": [
{ "id": 3, "name_pl": "Wibratory", "name_en": "Vibrators", "parent": null }
],
"status": { "id": 1, "name": "Nowość" },
"prod_image": [
{ "image": "https://cdn.lagrana.pl/img/lg-12345-1.jpg", "main_image": true, "hoover_image": false },
{ "image": "https://cdn.lagrana.pl/img/lg-12345-2.jpg", "main_image": false, "hoover_image": true }
],
"description": {
"id": 5, "product": 42,
"lang_pl": "Opis po polsku...",
"lang_en": "Description in English...",
"lang_de": "Beschreibung auf Deutsch...",
// also: lang_nl, lang_fr, lang_es, lang_it, lang_gr, lang_cz, lang_sk, lang_ua, lang_ru
},
"additional": [
{ "id": 101, "product": 42, "item": "Kolor", "value": "Czarny" },
{ "id": 102, "product": 42, "item": "Długość", "value": "18 cm" }
]
}
]
}
Returns a single product object with the same fields as the list. Use the numeric internal ID from the id field, or use the products-sku endpoint to look up by SKU.
curl "https://b2b.lagrana.pl/api/products-sku/LG-12345/" \ -H "Authorization: Bearer $TOKEN"
Returns the same fields as GET /api/products/{id}/. Returns 404 if the SKU does not exist.
Same filtering parameters as /api/products/ (brand, categories, status, active, search). The detail endpoint uses SKU as the key instead of numeric ID.
parent field to build a category tree.[
{
"id": 1,
"name_pl": "Wibratory",
"name_en": "Vibrators",
"name_de": "Vibratoren",
"name_nl": null,
"name_fr": null,
"name_es": null,
"name_it": null,
"name_gr": null,
"name_cz": null,
"name_sk": null,
"name_ua": null,
"name_ru": null,
"parent": null // ID of parent category, null = top level
}
]
/api/products/.| Parameter | Type | Description |
|---|---|---|
| brand | optional | Filter by brand |
| categories | optional | Filter by category ID |
| search | optional | Search by SKU |
{
"count": 1248,
"results": [
{ "sku": "LG-12345", "stock_warehouse": 24, "stock_supplier": 10 },
{ "sku": "LG-12346", "stock_warehouse": 0, "stock_supplier": 50 }
]
}
stock_warehouse — quantity in La Grana warehouse
stock_supplier — quantity available at supplier
{
"count": 3,
"results": [
{
"id": 7,
"external_id": "WC-1234", // your reference number (optional)
"status": "pending",
"currency": "PLN",
"total_gross": "267.00",
"notes": "Uwagi do zamówienia",
"created_at": "2026-03-01T12:00:00Z",
"updated_at": "2026-03-01T12:05:00Z",
"items_read": [
{
"product": 42, "sku": "LG-12345", "name": "Nazwa produktu",
"qty": 3, "unit_price_gross": "89.00",
"vat_rate": 23, "line_total_gross": "267.00"
}
]
}
]
}
| Field | Type | Description |
|---|---|---|
| items | required | Array of order items (see below) |
| external_id | optional | Your own reference number (e.g. WooCommerce order ID) |
| currency | optional | PLN / EUR (default: PLN) |
| notes | optional | Order notes |
Each item in the items array:
| Field | Type | Description |
|---|---|---|
| product | product or sku | Internal product ID |
| sku | product or sku | Product SKU (alternative to product) |
| qty | optional | Quantity (default: 1) |
{
"external_id": "WC-5678",
"currency": "PLN",
"notes": "Pilne",
"items": [
{ "product": 42, "qty": 3 },
{ "sku": "LG-12346", "qty": 1 }
]
}
<?xml version="1.0" encoding="UTF-8"?> <products> <product> <id>42</id> <sku>LG-12345</sku> <name>Nazwa produktu</name> <description>Opis po polsku...</description> <category>Wibratory</category> <brand>BrandName</brand> <price>84.15</price> <!-- your price --> <stock>24</stock> <image>https://cdn.lagrana.pl/img/lg-12345-1.jpg</image> <active>true</active> </product> </products>
The feed requires no authentication header — the token in the URL grants access. Prices reflect your individual rates.
detail field with a description.| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created (e.g. new order) |
| 400 | Request error — check parameters or required fields |
| 401 | Missing authentication or expired token |
| 403 | No permission to access resource |
| 404 | Resource not found |
| 429 | Request limit exceeded (rate limiting) |
import requests # 1. Uzyskaj token resp = requests.post("https://b2b.lagrana.pl/api/token/", json={ "username": "twoj_login", "password": "haslo" }) token = resp.json()["access"] headers = {"Authorization": f"Bearer {token}"} # 2. Pobierz produkty (wszystkie strony) url = "https://b2b.lagrana.pl/api/products/" while url: data = requests.get(url, headers=headers).json() for p in data["results"]: print(p["sku"], p["client_price"], p["stock_warehouse"]) url = data["next"] # 3. Pobierz produkt po SKU p = requests.get( "https://b2b.lagrana.pl/api/products-sku/LG-12345/", headers=headers ).json() print(p["name"], p["client_price"], p["client_price_without_discount"]) # 4. Utwórz zamówienie order = requests.post("https://b2b.lagrana.pl/api/orders/", json={ "external_id": "WC-1234", "items": [ {"sku": "LG-12345", "qty": 3}, {"sku": "LG-12346", "qty": 1}, ] }, headers=headers) print(order.json())
// 1. Uzyskaj token $res = file_get_contents('https://b2b.lagrana.pl/api/token/', false, stream_context_create(['http' => [ 'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode(['username'=>'login', 'password'=>'haslo']) ]]) ); $token = json_decode($res)->access; $authHeader = "Authorization: Bearer $token"; // 2. Pobierz produkty $url = 'https://b2b.lagrana.pl/api/products/'; while ($url) { $data = json_decode(file_get_contents($url, false, stream_context_create(['http' => ['header' => $authHeader]]) )); foreach ($data->results as $p) { echo $p->sku . ' ' . $p->client_price . ' ' . $p->stock_warehouse . "\n"; } $url = $data->next; } // 3. Utwórz zamówienie $order = file_get_contents('https://b2b.lagrana.pl/api/orders/', false, stream_context_create(['http' => [ 'method' => 'POST', 'header' => "Content-Type: application/json\r\n" . $authHeader, 'content' => json_encode([ 'external_id' => 'WC-1234', 'items' => [ ['sku' => 'LG-12345', 'qty' => 3], ['sku' => 'LG-12346', 'qty' => 1], ] ]) ]]) ); var_dump(json_decode($order));
# Uzyskaj token i zapisz TOKEN=$(curl -s -X POST https://b2b.lagrana.pl/api/token/ \ -H "Content-Type: application/json" \ -d '{"username":"login","password":"haslo"}' \ | python3 -c "import sys,json;print(json.load(sys.stdin)['access'])") # Pobierz produkty (pierwsza strona) curl "https://b2b.lagrana.pl/api/products/" \ -H "Authorization: Bearer $TOKEN" # Pobierz produkt po SKU curl "https://b2b.lagrana.pl/api/products-sku/LG-12345/" \ -H "Authorization: Bearer $TOKEN" # Pobierz stany magazynowe curl "https://b2b.lagrana.pl/api/stock/" \ -H "Authorization: Bearer $TOKEN" # Utwórz zamówienie curl -X POST "https://b2b.lagrana.pl/api/orders/" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"external_id":"WC-1234","items":[{"sku":"LG-12345","qty":3}]}'
Log in and start using the API
API access is granted on request — contact us or log in if you already have an account.