Skip to content

Fan-out Dispatches ​

The fan-out API is the generic multi-store write framework. It follows a three-step lifecycle: preview (validate the payload against each target store), commit (dispatch to all valid targets), and poll (track per-store apply progress).

Async operations are documented in Async and Polling. For staging the hostcom file that the hostcom_batch operation consumes, see Hostcom Files.

Permission Model ​

Every fan-out call requires two permissions:

  1. rorcex:fanout.execute — required on all preview, commit, and get endpoints
  2. The operation-specific permission listed on each endpoint below

Preview Dispatch ​

Validate a payload against each target store before committing. RORCex checks that each store's lane is reachable and that the payload is accepted — no writes occur at this stage.

POST /v1/fanout/{operation_type}/preview

Authentication: OAuth Token (service_account or user)

Permission: rorcex:fanout.execute + operation-specific (see below)

Path Parameters ​

ParameterTypeDescription
operation_typestringOne of hostcom_batch or inventory_adjustment

Request Body ​

json
{
  "store_org_ids": ["org_00000k1L2m3N4o5", "org_00000a1B2c3D4e5"],
  "payload": {}
}
FieldTypeRequiredDescription
store_org_idsarrayYesOrganization hashkeys for the target stores
payloadobjectYesOperation-specific payload (see below)

hostcom_batch payload ​

Operation permission: rorcex:hostcom-batches.dispatch

json
{
  "store_org_ids": ["org_00000k1L2m3N4o5"],
  "payload": {
    "file_id": "hkx_00000k1L2m3N4o5",
    "note": "Weekly price change"
  }
}
FieldTypeRequiredDescription
file_idstringYesA staged hostcom file — obtain from POST /v1/hostcom/files or POST /v1/hostcom/files/author
notestringNoFree-text annotation attached to the dispatch

inventory_adjustment payload ​

Operation permission: rorcex:inventory-adjustments.create

json
{
  "store_org_ids": ["org_00000k1L2m3N4o5"],
  "payload": {
    "product_code": "001234567890",
    "reason_code": "SHRINK",
    "quantity": -3
  }
}
FieldTypeRequiredDescription
product_codestringYesUPC or internal item code
reason_codestringYesReason for the adjustment (e.g., SHRINK, RECEIVE, WASTE)
quantityintegerYesSigned adjustment quantity (negative to reduce, positive to increase)

Response ​

json
{
  "dispatch_id": "01J9XR4K7P8VN2YQ6ZB3TGD0WC",
  "operation_type": "hostcom_batch",
  "status": "previewed",
  "can_commit": true,
  "targets": [
    {
      "store_org_id": "org_00000k1L2m3N4o5",
      "validation_status": "valid",
      "validation_message": null
    },
    {
      "store_org_id": "org_00000a1B2c3D4e5",
      "validation_status": "invalid",
      "validation_message": "Lane is offline"
    }
  ]
}

Status: 200 OK

FieldTypeDescription
dispatch_idstringUnique identifier — use in commit and poll requests
operation_typestringEcho of the requested operation type
statusstringpreviewed if all targets validated; preview_failed if one or more targets were invalid
can_commitbooleantrue when at least one target is valid and the dispatch can be committed
targetsarrayPer-store validation results
targets[].store_org_idstringTarget store organization hashkey
targets[].validation_statusstringvalid or invalid
targets[].validation_messagestring|nullHuman-readable explanation when invalid

Errors ​

See Errors for shared error envelope format.


Commit Dispatch ​

Dispatch a previewed payload to all valid target stores. The commit is asynchronous — poll GET /v1/fanout/{dispatch_id} to track per-store apply progress.

POST /v1/fanout/{dispatch_id}/commit

Authentication: OAuth Token (service_account or user)

Permission: rorcex:fanout.execute + operation-specific (same as preview)

Path Parameters ​

ParameterTypeDescription
dispatch_idstringThe dispatch_id returned from the preview step

Request Body ​

Empty body.

Response ​

json
{
  "dispatch_id": "01J9XR4K7P8VN2YQ6ZB3TGD0WC",
  "status": "committing",
  "poll_url": "/api/v1/fanout/01J9XR4K7P8VN2YQ6ZB3TGD0WC"
}

Status: 202 Accepted

FieldTypeDescription
dispatch_idstringEcho of the committed dispatch identifier
statusstringAlways committing immediately after commit
poll_urlstringRelative URL to poll for status updates

Errors ​

See Errors for shared error envelope format.


Get Dispatch ​

Poll the status of a fan-out dispatch, including per-store apply progress.

GET /v1/fanout/{dispatch_id}

Authentication: OAuth Token (service_account or user)

Permission: rorcex:fanout.execute + operation-specific (same as preview)

Path Parameters ​

ParameterTypeDescription
dispatch_idstringThe dispatch_id to retrieve

Response ​

json
{
  "dispatch_id": "01J9XR4K7P8VN2YQ6ZB3TGD0WC",
  "operation_type": "hostcom_batch",
  "status": "completed",
  "payload_preview": {
    "file_id": "hkx_00000x9Y8z7W6v5"
  },
  "requested_by_org_id": "org_00000h1Q2r3S4t5",
  "requested_by_user_id": "usr_00000u1V2w3X4y5",
  "created_at": "2026-06-11T14:33:10Z",
  "committed_at": "2026-06-11T14:35:00Z",
  "completed_at": "2026-06-11T14:37:42Z",
  "targets": [
    {
      "store_org_id": "org_00000k1L2m3N4o5",
      "validation_status": "valid",
      "apply_status": "applied",
      "apply_message": null,
      "rorc_reference": "OP-00042"
    },
    {
      "store_org_id": "org_00000a1B2c3D4e5",
      "validation_status": "invalid",
      "apply_status": "skipped",
      "apply_message": "Skipped: failed validation during preview",
      "rorc_reference": null
    }
  ]
}

Status: 200 OK

FieldTypeDescription
dispatch_idstringDispatch identifier
operation_typestringhostcom_batch or inventory_adjustment
statusstringAggregate dispatch status (see table below)
payload_previewobjectAbridged payload for display, the same shape as in List Dispatches: {file_id} for hostcom_batch, {product_code, store_count} for inventory_adjustment
requested_by_org_idstringOrganization hashkey of the requesting org
requested_by_user_idstring|nullUser hashkey of the requestor
created_atstringISO 8601 timestamp when the dispatch was previewed
committed_atstring|nullISO 8601 timestamp when the commit was accepted
completed_atstring|nullISO 8601 timestamp when all targets reached a terminal state
targetsarrayPer-store apply results
targets[].store_org_idstringTarget store organization hashkey
targets[].validation_statusstringvalid or invalid (set during preview)
targets[].validation_messagestring|nullWhy the store failed validation during preview
targets[].apply_statusstringPer-store apply status (see table below)
targets[].apply_messagestring|nullHuman-readable detail when errored or skipped
targets[].rorc_referencestring|nullRORC operation reference ID, populated once the lane acknowledges the dispatch

Dispatch Status Values ​

StatusDescription
previewingPreview is in progress
preview_failedAll targets failed validation — cannot commit
previewedPreview complete — ready to commit
committingCommit accepted, applying to stores
completedAll valid targets applied successfully
partially_failedSome targets applied; others errored
erroredAll targets errored during apply

Per-Store Apply Status Values ​

StatusDescription
pendingQueued, not yet sent to the lane
applyingSent to the lane, awaiting acknowledgement
appliedLane confirmed successful application
skippedNot attempted (e.g., failed preview validation)
erroredLane rejected or did not acknowledge within timeout

Errors ​

See Errors for shared error envelope format.


List Dispatches ​

List fan-out dispatches with optional filtering.

GET /v1/fanout

Authentication: OAuth Token (service_account or user)

Permission: rorcex:reports.view

Request Query Parameters ​

FieldTypeRequiredDescription
statusstringNoFilter by dispatch status (see status values above)
operation_typestringNoFilter by operation type: inventory_adjustment or hostcom_batch
pageintegerNoPage number (default: 1)
per_pageintegerNoResults per page, 1–100 (default: 50)

Response ​

json
{
  "data": [
    {
      "dispatch_id": "01J9XR4K7P8VN2YQ6ZB3TGD0WC",
      "operation_type": "hostcom_batch",
      "status": "completed",
      "target_rollup": {
        "pending": 0,
        "applying": 0,
        "applied": 12,
        "skipped": 1,
        "errored": 0
      },
      "requested_by_org_id": "org_00000z9Y8x7W6v5",
      "requested_by_user_id": "usr_00000p4Q3r2S1t0",
      "created_at": "2026-06-11T14:30:00Z",
      "committed_at": "2026-06-11T14:35:00Z",
      "completed_at": "2026-06-11T14:37:42Z",
      "payload_preview": {
        "file_id": "hkx_00000k1L2m3N4o5",
        "note": "Weekly price change"
      }
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 50,
    "total": 143,
    "last_page": 3
  }
}

Status: 200 OK

FieldTypeDescription
dataarrayList of dispatch summaries
data[].dispatch_idstringDispatch identifier
data[].operation_typestringhostcom_batch or inventory_adjustment
data[].statusstringAggregate dispatch status
data[].target_rollupobjectCounts of targets in each apply status
data[].requested_by_org_idstringOrganization hashkey of the requesting org
data[].requested_by_user_idstringUser hashkey of the requestor
data[].created_atstringISO 8601 creation timestamp
data[].committed_atstring|nullISO 8601 commit timestamp
data[].completed_atstring|nullISO 8601 completion timestamp
data[].payload_previewobjectAbridged payload for display — does not include row data
meta.current_pageintegerCurrent page number
meta.per_pageintegerResults per page
meta.totalintegerTotal matching dispatches
meta.last_pageintegerLast available page

Errors ​

See Errors for shared error envelope format.


Changelog
DateChange
2026-06-11Initial publication.
2026-10-14Get Dispatch adds payload_preview, requested_by_org_id, requested_by_user_id and created_at; documents targets[].validation_message.

ShopHero CommerceCore Platform