Store products
Ids, names, prices and times in the examples are samples. Read the real values from the API.
Reading needs the key area my_store:read and changing needs my_store:write beside it. The calls answer as the My Store calls do when B7R stores are not open to your account (409 feature_not_available), when B7R cannot tell (503 service_unavailable), and before you open a store in the B7R app (404 not_found with store_missing). A change counts against store_writes_per_minute (GET /v1/me?include=limits) and takes an Idempotency-Key; a call sent again with the same key answers what the first answered.
A floor is the lowest price the store allows a product, worked out from its cost and B7R’s settings: it is null, and the promotions say why, when it cannot be worked out right now.
List the products on your store
Oldest on the store first, at most limit (1 to 100, 50 by default) a page; pass next_cursor as cursor for the next one, and follow it until it is null: a page can be shorter than limit. position is the order the store shows them in. hidden_reason says why B7R hides one (below_floor, for one priced under its floor); taken_down means its design was taken down, so it cannot be shown or pinned.
Headers
Bearer b7r_live_.... A key with the my_store:read area. X-B7R-Key works too; send one, never both.
ar for Arabic error titles; anything else gives English. Codes never change.
Query
1 to 256.
Answer
Child fields
Child fields
Child fields
Errors
| HTTP | Code | Retry |
|---|---|---|
| 400 | invalid_request | No |
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 403 | https_required | No |
| 404 | not_found | No |
| 409 | feature_not_available | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl https://api.b7r.app/v1/my-store/products \
-H "Authorization: Bearer $B7R_API_KEY"const res = await fetch("https://api.b7r.app/v1/my-store/products", {
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
},
});
const data = await res.json();import os, requests
res = requests.get(
"https://api.b7r.app/v1/my-store/products",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
},
timeout=30,
)
data = res.json(){
"data": [
{
"store_product_id": "3c4d5e6f-7a8b-4c9d-8e1f-2a3b4c5d6e7f",
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a",
"name": {
"ar": "قميص الخط العربي",
"en": "Calligraphy shirt"
},
"image_url": "https://media.b7r.sa/mockups/shirt.jpg",
"retail_price": "120.00",
"floor_price": "84.00",
"visible": true,
"pinned": true,
"position": 0,
"hidden_reason": null,
"taken_down": false,
"archived": false,
"seo": {
"title": null,
"description": null
}
}
],
"next_cursor": null
}List the products you can add
Your active products that are not on the store yet, newest first, paged as the list above; a page can even be empty while next_cursor is set, so follow it until it is null. can_add is true when the price is at or above the floor and the product’s base product is still sold. Before you open a store, these are the products the store can open with.
Headers
Bearer b7r_live_.... A key with the my_store:read area. X-B7R-Key works too; send one, never both.
ar for Arabic error titles; anything else gives English. Codes never change.
Query
1 to 256.
Answer
Child fields
Child fields
One of ok, below_floor, unavailable.
Errors
| HTTP | Code | Retry |
|---|---|---|
| 400 | invalid_request | No |
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 403 | https_required | No |
| 409 | feature_not_available | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl https://api.b7r.app/v1/my-store/products/candidates \
-H "Authorization: Bearer $B7R_API_KEY"const res = await fetch("https://api.b7r.app/v1/my-store/products/candidates", {
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
},
});
const data = await res.json();import os, requests
res = requests.get(
"https://api.b7r.app/v1/my-store/products/candidates",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
},
timeout=30,
)
data = res.json(){
"data": [
{
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a",
"name": {
"ar": "كوب الخط العربي",
"en": "Calligraphy mug"
},
"image_url": null,
"retail_price": "60.00",
"floor_price": "48.00",
"floor_status": "ok",
"base_product_available": true,
"can_add": true
}
],
"next_cursor": null
}The calls below change the products on the store. Each answers the store product it changed, as the list gives it; {id} is its store_product_id. One that is not on your store, or is on another account’s, answers 404 not_found, the same as one that does not exist.
If an answer is lost and you send the call again with a new key, a second add answers 409 my_store_rejected with already_published, naming the store product in existing_id, and a second remove answers 404. Read GET /v1/my-store/products to see what happened. The same key always answers what the first call answered.
Put a product on your store
Adds one of your products, by its product_id (as GET /v1/products lists it), at the end of the store, as the app does. GET /v1/my-store/products/candidates lists the ones you can add. Refused with 409 my_store_rejected and the reason: already_published (with existing_id), product_archived, design_taken_down, base_product_unavailable, below_floor (its price is under the floor, given in minimum_price) or store_suspended. A product that is not yours answers 404. When the floor cannot be worked out now, the call answers 503 service_unavailable, which you can send again.
Headers
Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.
A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.
application/json, when the request has a body.
ar for Arabic error titles; anything else gives English. Codes never change.
Body
Answer
Child fields
Child fields
Child fields
Errors
| HTTP | Code | Retry |
|---|---|---|
| 400 | invalid_request | No |
| 400 | idempotency_key_required | No |
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 403 | https_required | No |
| 403 | verification_required | No |
| 404 | not_found | No |
| 409 | idempotency_mismatch | No |
| 409 | idempotency_in_flight | Yes |
| 409 | feature_not_available | No |
| 409 | my_store_rejected | No |
| 413 | request_too_large | No |
| 415 | unsupported_media_type | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl -X POST https://api.b7r.app/v1/my-store/products \
-H "Authorization: Bearer $B7R_API_KEY" \
-H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
-H "Content-Type: application/json" \
-d '{
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a"
}'const res = await fetch("https://api.b7r.app/v1/my-store/products", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a"
}),
});
const data = await res.json();import os, requests, uuid
res = requests.post(
"https://api.b7r.app/v1/my-store/products",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a"
},
timeout=30,
)
data = res.json(){
"product": {
"store_product_id": "3c4d5e6f-7a8b-4c9d-8e1f-2a3b4c5d6e7f",
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a",
"name": {
"ar": "قميص الخط العربي",
"en": "Calligraphy shirt"
},
"image_url": "https://media.b7r.sa/mockups/shirt.jpg",
"retail_price": "120.00",
"floor_price": "84.00",
"visible": true,
"pinned": true,
"position": 0,
"hidden_reason": null,
"taken_down": false,
"archived": false,
"seo": {
"title": null,
"description": null
}
}
}Take a product off your store
Takes it off the store only: the product itself and the other stores that sell it are not changed.
Headers
Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.
A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.
application/json, when the request has a body.
ar for Arabic error titles; anything else gives English. Codes never change.
Path
Answer
Always true.
Errors
| HTTP | Code | Retry |
|---|---|---|
| 400 | invalid_request | No |
| 400 | idempotency_key_required | No |
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 403 | https_required | No |
| 404 | not_found | No |
| 409 | idempotency_mismatch | No |
| 409 | idempotency_in_flight | Yes |
| 409 | feature_not_available | No |
| 413 | request_too_large | No |
| 415 | unsupported_media_type | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl -X POST https://api.b7r.app/v1/my-store/products/{id}/remove \
-H "Authorization: Bearer $B7R_API_KEY" \
-H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')"const res = await fetch("https://api.b7r.app/v1/my-store/products/{id}/remove", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
},
});
const data = await res.json();import os, requests, uuid
res = requests.post(
"https://api.b7r.app/v1/my-store/products/{id}/remove",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
timeout=30,
)
data = res.json(){
"removed": true,
"store_product_id": "3c4d5e6f-7a8b-4c9d-8e1f-2a3b4c5d6e7f"
}Show, hide, pin or change a product on your store
Send exactly one of visible, pinned or seo a call. visible: false hides the product on the store; pinned: true adds it to the store’s featured products, four at most; the first pin also shows the featured section (a fifth is refused with pin_limit). A product whose design was taken down cannot be shown or pinned (design_taken_down). seo takes both title (at most 70 characters) and description (at most 160), empty or null for the default; new text goes to B7R’s review as it does in the app.
Headers
Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.
The ETag header of your last read. If the product changed since, the answer is 412 precondition_failed and nothing changes.
Optional on a PATCH; when sent, a retry with the same key answers the first result.
application/json, when the request has a body.
ar for Arabic error titles; anything else gives English. Codes never change.
Path
Body
Child fields
Answer
Child fields
Child fields
Child fields
Errors
| HTTP | Code | Retry |
|---|---|---|
| 400 | invalid_request | No |
| 400 | idempotency_key_required | No |
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 403 | https_required | No |
| 403 | verification_required | No |
| 404 | not_found | No |
| 409 | idempotency_mismatch | No |
| 409 | idempotency_in_flight | Yes |
| 409 | feature_not_available | No |
| 409 | my_store_rejected | No |
| 413 | request_too_large | No |
| 415 | unsupported_media_type | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl -X PATCH https://api.b7r.app/v1/my-store/products/{id} \
-H "Authorization: Bearer $B7R_API_KEY" \
-H "If-Match: $ETAG" \
-H "Content-Type: application/json" \
-d '{
"pinned": true
}'const res = await fetch("https://api.b7r.app/v1/my-store/products/{id}", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
"If-Match": etag, // the ETag header of your last read
"Content-Type": "application/json",
},
body: JSON.stringify({
"pinned": true
}),
});
const data = await res.json();import os, requests
res = requests.patch(
"https://api.b7r.app/v1/my-store/products/{id}",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
"If-Match": etag, # the ETag header of your last read
},
json={
"pinned": True
},
timeout=30,
)
data = res.json(){
"product": {
"store_product_id": "3c4d5e6f-7a8b-4c9d-8e1f-2a3b4c5d6e7f",
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a",
"name": {
"ar": "قميص الخط العربي",
"en": "Calligraphy shirt"
},
"image_url": "https://media.b7r.sa/mockups/shirt.jpg",
"retail_price": "120.00",
"floor_price": "84.00",
"visible": true,
"pinned": true,
"position": 0,
"hidden_reason": null,
"taken_down": false,
"archived": false,
"seo": {
"title": null,
"description": null
}
}
}Move a product on your store
to is up, down or top. The answer’s position is the product’s new place. When two changes to the order meet at once, one can answer 503 service_unavailable: send it again.
Headers
Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.
A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.
application/json, when the request has a body.
ar for Arabic error titles; anything else gives English. Codes never change.
Path
Body
One of up, down, top.
Answer
Child fields
Child fields
Child fields
Errors
| HTTP | Code | Retry |
|---|---|---|
| 400 | invalid_request | No |
| 400 | idempotency_key_required | No |
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 403 | https_required | No |
| 403 | verification_required | No |
| 404 | not_found | No |
| 409 | idempotency_mismatch | No |
| 409 | idempotency_in_flight | Yes |
| 409 | feature_not_available | No |
| 413 | request_too_large | No |
| 415 | unsupported_media_type | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl -X POST https://api.b7r.app/v1/my-store/products/{id}/move \
-H "Authorization: Bearer $B7R_API_KEY" \
-H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
-H "Content-Type: application/json" \
-d '{
"to": "top"
}'const res = await fetch("https://api.b7r.app/v1/my-store/products/{id}/move", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"to": "top"
}),
});
const data = await res.json();import os, requests, uuid
res = requests.post(
"https://api.b7r.app/v1/my-store/products/{id}/move",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"to": "top"
},
timeout=30,
)
data = res.json(){
"product": {
"store_product_id": "3c4d5e6f-7a8b-4c9d-8e1f-2a3b4c5d6e7f",
"product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a",
"name": {
"ar": "قميص الخط العربي",
"en": "Calligraphy shirt"
},
"image_url": "https://media.b7r.sa/mockups/shirt.jpg",
"retail_price": "120.00",
"floor_price": "84.00",
"visible": true,
"pinned": true,
"position": 0,
"hidden_reason": null,
"taken_down": false,
"archived": false,
"seo": {
"title": null,
"description": null
}
}
}One product’s state on the store rides its own read: GET /v1/products/{id}?include=my_store needs my_store:read beside products:read, and is refused with 403 area_forbidden without it. my_store is null when the account has no store or B7R stores are not open to it.
