B7RDevelopers
ReferenceStore products
Reference / Store products

Store products

View .md

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

GET/v1/my-store/products

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

Authorizationstringrequired

Bearer b7r_live_.... A key with the my_store:read area. X-B7R-Key works too; send one, never both.

Accept-Languagestring

ar for Arabic error titles; anything else gives English. Codes never change.

Query

limitstring
cursorstring

1 to 256.

Answer

dataarray of objectrequired
Child fields
store_product_idstring (uuid)required
product_idstring (uuid)required
nameobjectrequired
Child fields
arstringrequired
enstringrequired
image_urlstring or nullrequired
retail_pricestringrequired
floor_pricestring or nullrequired
visiblebooleanrequired
pinnedbooleanrequired
positionintegerrequired
hidden_reasonstring or nullrequired
taken_downbooleanrequired
archivedbooleanrequired
seoobjectrequired
Child fields
titlestring or nullrequired
descriptionstring or nullrequired
next_cursorstring or nullrequired

Errors

Request
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()
200 OK
{
  "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

GET/v1/my-store/products/candidates

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

Authorizationstringrequired

Bearer b7r_live_.... A key with the my_store:read area. X-B7R-Key works too; send one, never both.

Accept-Languagestring

ar for Arabic error titles; anything else gives English. Codes never change.

Query

limitstring
cursorstring

1 to 256.

Answer

dataarray of objectrequired
Child fields
product_idstring (uuid)required
nameobjectrequired
Child fields
arstringrequired
enstringrequired
image_urlstring or nullrequired
retail_pricestringrequired
floor_pricestring or nullrequired
floor_statusstringrequired

One of ok, below_floor, unavailable.

base_product_availablebooleanrequired
can_addbooleanrequired
next_cursorstring or nullrequired

Errors

Request
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()
200 OK
{
  "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

POST/v1/my-store/products

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

Authorizationstringrequired

Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.

Idempotency-Keystringrequired

A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.

Content-Typestringrequired

application/json, when the request has a body.

Accept-Languagestring

ar for Arabic error titles; anything else gives English. Codes never change.

Body

product_idstring (uuid)required

Answer

productobjectrequired
Child fields
store_product_idstring (uuid)required
product_idstring (uuid)required
nameobjectrequired
Child fields
arstringrequired
enstringrequired
image_urlstring or nullrequired
retail_pricestringrequired
floor_pricestring or nullrequired
visiblebooleanrequired
pinnedbooleanrequired
positionintegerrequired
hidden_reasonstring or nullrequired
taken_downbooleanrequired
archivedbooleanrequired
seoobjectrequired
Child fields
titlestring or nullrequired
descriptionstring or nullrequired

Errors

Request
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()
201 Created
{
  "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

POST/v1/my-store/products/{id}/remove

Takes it off the store only: the product itself and the other stores that sell it are not changed.

Headers

Authorizationstringrequired

Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.

Idempotency-Keystringrequired

A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.

Content-Typestringrequired

application/json, when the request has a body.

Accept-Languagestring

ar for Arabic error titles; anything else gives English. Codes never change.

Path

idstring (uuid)required

Answer

removedconstantrequired

Always true.

store_product_idstring (uuid)required

Errors

Request
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()
200 OK
{
  "removed": true,
  "store_product_id": "3c4d5e6f-7a8b-4c9d-8e1f-2a3b4c5d6e7f"
}

Show, hide, pin or change a product on your store

PATCH/v1/my-store/products/{id}

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

Authorizationstringrequired

Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.

If-Matchstring

The ETag header of your last read. If the product changed since, the answer is 412 precondition_failed and nothing changes.

Idempotency-Keystring

Optional on a PATCH; when sent, a retry with the same key answers the first result.

Content-Typestringrequired

application/json, when the request has a body.

Accept-Languagestring

ar for Arabic error titles; anything else gives English. Codes never change.

Path

idstring (uuid)required

Body

visibleboolean
pinnedboolean
seoobject
Child fields
titlestring or nullrequired
descriptionstring or nullrequired

Answer

productobjectrequired
Child fields
store_product_idstring (uuid)required
product_idstring (uuid)required
nameobjectrequired
Child fields
arstringrequired
enstringrequired
image_urlstring or nullrequired
retail_pricestringrequired
floor_pricestring or nullrequired
visiblebooleanrequired
pinnedbooleanrequired
positionintegerrequired
hidden_reasonstring or nullrequired
taken_downbooleanrequired
archivedbooleanrequired
seoobjectrequired
Child fields
titlestring or nullrequired
descriptionstring or nullrequired

Errors

Request
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()
200 OK
{
  "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

POST/v1/my-store/products/{id}/move

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

Authorizationstringrequired

Bearer b7r_live_.... A key with the my_store:write area. X-B7R-Key works too; send one, never both.

Idempotency-Keystringrequired

A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.

Content-Typestringrequired

application/json, when the request has a body.

Accept-Languagestring

ar for Arabic error titles; anything else gives English. Codes never change.

Path

idstring (uuid)required

Body

tostringrequired

One of up, down, top.

Answer

productobjectrequired
Child fields
store_product_idstring (uuid)required
product_idstring (uuid)required
nameobjectrequired
Child fields
arstringrequired
enstringrequired
image_urlstring or nullrequired
retail_pricestringrequired
floor_pricestring or nullrequired
visiblebooleanrequired
pinnedbooleanrequired
positionintegerrequired
hidden_reasonstring or nullrequired
taken_downbooleanrequired
archivedbooleanrequired
seoobjectrequired
Child fields
titlestring or nullrequired
descriptionstring or nullrequired

Errors

Request
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()
200 OK
{
  "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.

Titles and headings of every page. llms-full.txt holds the full text.