B7RDevelopers
ReferenceStore jobs
Reference / Store jobs

Store jobs

View .md

A store job is what a store button of the app does on one product and one store: publish puts the product on the store, sync sends its current state again, unpublish hides it there (the app calls it Disconnect), republish shows a hidden product again (Reconnect). resend_issue sends again a change a store did not take (from GET /v1/store-issues). A store can take longer to answer than a call may wait, so the call answers 202 with one job a store at once, and B7R does the work after it.

  • Starting jobs needs stores:publish; reading them needs stores:read, which stores:publish goes with.
  • One product and one store hold one open job at a time, from the app or the API. The same action again answers the job already open (you join it). Another action is refused for that store with store_job_open until the open one ends.
  • A publish of a product already on that store, shown or hidden, is done with nothing changed. To show a hidden one, use republish.
  • A person in the app is never queued behind a key: pressing a store button while your job only waits takes its place, and your job ends failed with superseded_by_app.
  • A job is tried up to 4 times: the first, then after 1, 5 and 15 minutes, while the cause can pass (the store or the integration did not answer, the photos of a new product are still being drawn). A cause a retry cannot change ends it at once.
  • Each try checks again that the key is still valid and holds stores:publish, and that the product and the store are yours. A key revoked while its jobs wait sends nothing.
  • Follow a job without asking: with updates on, each job ends with one product.store_changed carrying its job_id: a publish, unpublish or republish with where the product now stands on the store (published, hidden or removed, even when it was there already), a sync or a resend with synced, and a job that fails with failed and its reason. A sync that re-creates a product the store deleted also sends removed and published. The update needs a key holding stores:read.
  • By default your account runs at most 2 jobs at once and holds at most 50 open jobs; GET /v1/me?include=limits shows your values. Starting jobs is also limited per minute (store_actions_per_minute) and per day (store_jobs_per_day, from midnight Riyadh time). When several accounts wait, the account with the fewest jobs running goes first.

Start store jobs

POST/v1/store-jobs

Name one action, one product and 1 to 20 stores, or resend_issue and one issue_id. Send an Idempotency-Key: the same key and body answer the same jobs again.

Before any job is made, the product and every store must be yours (else 404 not_found), the product not taken down (422 design_rejected with design_taken_down) and, except for unpublish, not archived (409 product_not_editable).

Each store is then its own job, and a store refused does not undo the others. This example names three stores: the second is busy with another action, so the answer is 202 with two jobs and that store in refused, with the job that holds it (job_id is null when the store is busy with an action in the app). Every store you name is in jobs or in refused. A store or a product removed while the call ran is in refused with not_found. Only a call that got no job at all answers an error: 404 not_found, 409 store_job_open, or 429 rate_limited with the error queue_full when your account holds its most open jobs. A call that would pass your daily number of jobs starts none: 429 rate_limited with the error daily_limit.

Headers

Authorizationstringrequired

Bearer b7r_live_.... A key with the stores:publish 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

actionstringrequired

publish: put the product on the stores. sync: send its current state again. unpublish: hide it on the stores (the app's Disconnect). republish: show a hidden product again (the app's Reconnect). resend_issue: send again a change a store did not take. One of publish, sync, unpublish, republish, resend_issue.

product_idstring (uuid)

A pair action: the product, from GET /v1/products.

store_idsarray of string (uuid)

A pair action: 1 to 20 stores, from GET /v1/stores; one job each. 1 to 20 items.

issue_idstring (uuid)

resend_issue: the issue, from GET /v1/store-issues.

Answer

jobsarray of objectrequired

One a store: a new job, or the open job of the same action, which this call joins.

Child fields
idstring (uuid)required
actionstringrequired

One of publish, sync, unpublish, republish, resend_issue.

statusstringrequired

queued: waiting for its turn or its next try. running: at the store now. done and failed are final. One of queued, running, done, failed.

reasonstring or nullrequired

Why it failed, or why its last try did not finish (while queued); null when done.

product_idstring (uuid) or nullrequired
store_idstring (uuid) or nullrequired
issue_idstring (uuid) or nullrequired
attemptsintegerrequired

Tries made so far; at most 4. At least 0.

next_attempt_atstring or nullrequired

When a queued job is tried next; null once it runs or ends.

created_atstringrequired
updated_atstringrequired
finished_atstring or nullrequired
refusedarray of objectrequired
Child fields
store_idstring (uuid)required
codestringrequired

store_job_open: another action runs on this product and store now. queue_full: the account holds its most open store jobs. not_found: the store or the product went while the call ran. One of store_job_open, queue_full, not_found.

job_idstring (uuid) or nullrequired

The job of the other action that holds the pair; null for queue_full and not_found.

Errors

Request
curl -X POST https://api.b7r.app/v1/store-jobs \
  -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 '{
    "action": "publish",
    "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
    "store_ids": [
      "1a2b3c4d-1111-4a5b-8c6d-7e8f9a0b1c2d",
      "1a2b3c4d-2222-4a5b-8c6d-7e8f9a0b1c2d",
      "1a2b3c4d-3333-4a5b-8c6d-7e8f9a0b1c2d"
    ]
  }'
const res = await fetch("https://api.b7r.app/v1/store-jobs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "action": "publish",
    "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
    "store_ids": [
      "1a2b3c4d-1111-4a5b-8c6d-7e8f9a0b1c2d",
      "1a2b3c4d-2222-4a5b-8c6d-7e8f9a0b1c2d",
      "1a2b3c4d-3333-4a5b-8c6d-7e8f9a0b1c2d"
    ]
  }),
});
const data = await res.json();
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/store-jobs",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "action": "publish",
        "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
        "store_ids": [
            "1a2b3c4d-1111-4a5b-8c6d-7e8f9a0b1c2d",
            "1a2b3c4d-2222-4a5b-8c6d-7e8f9a0b1c2d",
            "1a2b3c4d-3333-4a5b-8c6d-7e8f9a0b1c2d"
        ]
    },
    timeout=30,
)
data = res.json()
202 Accepted
{
  "jobs": [
    {
      "id": "b1c2d3e4-0001-4f5a-8b6c-7d8e9f0a1b2c",
      "action": "publish",
      "status": "queued",
      "reason": null,
      "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
      "store_id": "1a2b3c4d-1111-4a5b-8c6d-7e8f9a0b1c2d",
      "issue_id": null,
      "attempts": 0,
      "next_attempt_at": "2026-11-26T09:00:00.000Z",
      "created_at": "2026-11-26T09:00:00.000Z",
      "updated_at": "2026-11-26T09:00:00.000Z",
      "finished_at": null
    },
    {
      "id": "b1c2d3e4-0002-4f5a-8b6c-7d8e9f0a1b2c",
      "action": "publish",
      "status": "queued",
      "reason": null,
      "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
      "store_id": "1a2b3c4d-3333-4a5b-8c6d-7e8f9a0b1c2d",
      "issue_id": null,
      "attempts": 0,
      "next_attempt_at": "2026-11-26T09:00:00.000Z",
      "created_at": "2026-11-26T09:00:00.000Z",
      "updated_at": "2026-11-26T09:00:00.000Z",
      "finished_at": null
    }
  ],
  "refused": [
    {
      "store_id": "1a2b3c4d-2222-4a5b-8c6d-7e8f9a0b1c2d",
      "code": "store_job_open",
      "job_id": "b1c2d3e4-0009-4f5a-8b6c-7d8e9f0a1b2c"
    }
  ]
}

Read a store job

GET/v1/store-jobs/{id}

status is queued, running, done or failed; done and failed are final. A queued job shows when it is tried next, and the reason of its last try when one did not finish.

Another account’s job answers 404 not_found, exactly like a job that does not exist.

Headers

Authorizationstringrequired

Bearer b7r_live_.... A key with the stores: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.

Path

idstring (uuid)required

Answer

idstring (uuid)required
actionstringrequired

One of publish, sync, unpublish, republish, resend_issue.

statusstringrequired

queued: waiting for its turn or its next try. running: at the store now. done and failed are final. One of queued, running, done, failed.

reasonstring or nullrequired

Why it failed, or why its last try did not finish (while queued); null when done.

product_idstring (uuid) or nullrequired
store_idstring (uuid) or nullrequired
issue_idstring (uuid) or nullrequired
attemptsintegerrequired

Tries made so far; at most 4. At least 0.

next_attempt_atstring or nullrequired

When a queued job is tried next; null once it runs or ends.

created_atstringrequired
updated_atstringrequired
finished_atstring or nullrequired

Errors

Request
curl https://api.b7r.app/v1/store-jobs/b1c2d3e4-0001-4f5a-8b6c-7d8e9f0a1b2c \
  -H "Authorization: Bearer $B7R_API_KEY"
const res = await fetch("https://api.b7r.app/v1/store-jobs/b1c2d3e4-0001-4f5a-8b6c-7d8e9f0a1b2c", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/store-jobs/b1c2d3e4-0001-4f5a-8b6c-7d8e9f0a1b2c",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
200 OK
{
  "id": "b1c2d3e4-0001-4f5a-8b6c-7d8e9f0a1b2c",
  "action": "publish",
  "status": "done",
  "reason": null,
  "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
  "store_id": "1a2b3c4d-1111-4a5b-8c6d-7e8f9a0b1c2d",
  "issue_id": null,
  "attempts": 1,
  "next_attempt_at": null,
  "created_at": "2026-11-26T09:00:00.000Z",
  "updated_at": "2026-11-26T09:00:07.214Z",
  "finished_at": "2026-11-26T09:00:07.214Z"
}

List store jobs

GET/v1/store-jobs

Newest first. Filter by product_id, store_id or status. Page with cursor until next_cursor is null. A finished job stays listed for the days of your request log.

Headers

Authorizationstringrequired

Bearer b7r_live_.... A key with the stores: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.

product_idstring (uuid)
store_idstring (uuid)
statusstring

One of queued, running, done, failed.

Answer

dataarray of objectrequired
Child fields
idstring (uuid)required
actionstringrequired

One of publish, sync, unpublish, republish, resend_issue.

statusstringrequired

queued: waiting for its turn or its next try. running: at the store now. done and failed are final. One of queued, running, done, failed.

reasonstring or nullrequired

Why it failed, or why its last try did not finish (while queued); null when done.

product_idstring (uuid) or nullrequired
store_idstring (uuid) or nullrequired
issue_idstring (uuid) or nullrequired
attemptsintegerrequired

Tries made so far; at most 4. At least 0.

next_attempt_atstring or nullrequired

When a queued job is tried next; null once it runs or ends.

created_atstringrequired
updated_atstringrequired
finished_atstring or nullrequired
next_cursorstring or nullrequired

Errors

Request
curl "https://api.b7r.app/v1/store-jobs?product_id=7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d&status=failed" \
  -H "Authorization: Bearer $B7R_API_KEY"
const res = await fetch("https://api.b7r.app/v1/store-jobs?product_id=7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d&status=failed", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/store-jobs?product_id=7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d&status=failed",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
200 OK
{
  "data": [
    {
      "id": "b1c2d3e4-0002-4f5a-8b6c-7d8e9f0a1b2c",
      "action": "publish",
      "status": "failed",
      "reason": "subscription_inactive",
      "product_id": "7f3c2a10-5b9e-4d6a-8c21-3e4f5a6b7c8d",
      "store_id": "1a2b3c4d-3333-4a5b-8c6d-7e8f9a0b1c2d",
      "issue_id": null,
      "attempts": 1,
      "next_attempt_at": null,
      "created_at": "2026-11-26T09:00:00.000Z",
      "updated_at": "2026-11-26T09:00:05.880Z",
      "finished_at": "2026-11-26T09:00:05.880Z"
    }
  ],
  "next_cursor": null
}

Why a job failed

reasonWhat happened
not_foundThe product, the store or the issue is not yours, or is gone. A disconnect, in the app or with POST /v1/stores/{id}/disconnect, does not end the store’s waiting jobs at once: each fails when it comes to run, a product job with not_found.
taken_downThe design was taken down; it is never published or changed on a store.
not_publishedA sync of a product that is not on that store: publish it first.
not_unpublishedA republish of a product that is not hidden on that store.
platform_pausedB7R paused that store platform's integration for a while.
subscription_inactiveThe store's subscription to the B7R app lapsed. An unpublish still runs.
store_rejectedThe store refused the product or the change.
store_disconnectedThe store holds no valid connection to B7R: reconnect it in the app.
sku_takenA SKU of the product belongs to another product on that store.
admin_onlyOnly B7R sends this change (the shipping company of an order).
store_unavailableThe store or the integration did not answer, on the last try.
no_photos_yetThe product's photos were still being drawn, on the last try.
unlinkedThe store had deleted the product and it could not be made again, on the last try. Publish it.
superseded_by_appSomeone pressed a store button in the app for this product and store while the job waited.
interruptedThe job stopped while it ran and was out of tries.
attempts_exhaustedThe job waited past its last try.
integration_offThe Custom API was off when the job came to run.
key_revoked, key_expired, area_missingThe key that started the job is revoked, expired or no longer holds stores:publish.
account_inactive, connection_disabledThe account or its Custom API connection was off when the job came to run.
lease_lost, internal_errorSomething failed on B7R’s side, on the last try. Start the job again.

To send a change a store did not take, start resend_issue with its issue_id: { "action": "resend_issue", "issue_id": "9e8d7c6b-5a4f-4e3d-9c2b-1a0f9e8d7c6b" }. A resolved issue, and the shipping company change of an order (B7R's alone), answer 400 invalid_request at /body/issue_id. A product's issue is not sent again once the product is taken down (422 design_rejected, design_taken_down) or archived (404 not_found), except the hide of a product hidden on that store, which always goes.

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