API Reference

REST API endpoints for Sync As A Service.

Note: Most developers don't need to call these APIs directly. The SDK widget handles authentication, retailer connection, syncing, and MFA automatically. Use these endpoints for advanced backend integrations or custom UIs.

Base URLs:

  • Production: https://sync-api.stackline.com

  • Sandbox: https://sync-api-beta.stackline.com

Authentication: All requests (except GET /sync/retailers) require an OAuth access token:

Authorization: Bearer {access_token}

The SDK handles token management automatically.


Retailers (Catalog)

List Available Retailers

GET /sync/retailers

Public endpoint (no auth required). Returns all retailers users can connect.

Response:

[
  {
    "displayName": "Amazon",
    "logo": "https://media.brandclub.com/retailer_logo/1.webp",
    "syncConfig": {
      "serverSide": true
    }
  }
]
Field
Type
Description

displayName

string

Retailer display name

logo

string

Logo URL

syncConfig.serverSide

boolean

Whether sync is enabled


Connections (User's Linked Accounts)

List Connected Retailers

Returns user's linked retailer accounts.

Query Parameters:

Parameter
Type
Description

limit

integer

Max results

offset

integer

Pagination offset

status

string

Filter: valid, invalid, pending

Response:

Connection Statuses:

Status
Meaning

valid

Connected and working

invalid

Needs reconnection

pending

Currently being validated

Get Connection Details

Returns a single connection. Same shape as an item in the list response.

Connect a Retailer

Connect a new retailer account. Credentials must be encrypted using the TOTP from GET /sync/auth/totp.

Note: The SDK widget handles this entire flow automatically, including credential encryption and MFA. Use this endpoint only if building a custom connection UI.

Request Body:

Field
Type
Required
Description

retailerId

integer

Yes

Retailer to connect (from catalog)

connectionInfo

string

Yes

Encrypted credentials (see TOTP section)

currentStamp

string

Yes

TOTP timestamp from GET /sync/auth/totp

mode

string

Yes

CONNECT (new) or FIX (repair broken)

Response:

After connecting, poll GET /sync/sessions/:batchId to track sync progress.

Update Connection (Fix)

Re-authenticate a broken connection (status: invalid). Same encryption requirements as connect.

Request Body:

Response:

Trigger Sync for Connection

Manually trigger sync for a specific connected retailer.

Response:

Sync All Connections

Triggers sync for all connected retailers at once.

Response:

Returns { "status": "no_retailers" } if no valid connections exist.


Orders

List Orders

Returns purchase history as line-item level data.

Query Parameters:

Parameter
Type
Default
Description

retailer_id

integer

-

Filter by retailer

limit

integer

50

Max results (max: 1000)

offset

integer

0

Pagination offset

start_date

string

-

Filter orders after this date (ISO 8601)

end_date

string

-

Filter orders before this date (ISO 8601)

format

string

json

Response format: json or csv

JSON Response:

CSV Response (format=csv):

Returns a downloadable CSV file with columns: Retailer, Retailer Order ID, Order Date, Item Name, Brand, Dept, Category, SubCategory, SKU, Quantity, Price, Currency, Shipment Status, Order Total. See Data Reference for details.

Get Order Details

Returns a single order. Same shape as an item in the list response.

Trigger Order Sync

Trigger a sync to fetch latest orders.

Query Parameters:

Parameter
Type
Description

retailer

integer

Optional — sync a specific retailer only

Response:


Sync Sessions

Get Latest Sync

Returns the most recent sync session.

Response:

Global Status:

Status
Meaning

syncing

At least one retailer is still syncing

normal

All retailers finished (or no active sync)

Get Sync By ID

Returns a specific sync batch. Same response shape as latest.

Per-Retailer Sync Statuses (in retailerSyncSessions[].syncStatus):

Status
Description

queued

Waiting to start

connecting

Authenticating with retailer

scanning

Fetching orders

processing

Analyzing data

completed

Done

error

Failed

timed_out

Connection timed out

userintervention

MFA required

Submit MFA

Submit an MFA response during sync. Required when a retailer's syncStatus is userintervention.

Note: The SDK widget handles MFA automatically. Use this endpoint only if building a custom sync UI.

Request Body (choose method):

Request Body (enter code):

Field
Type
Required
Description

eventType

string

Yes

choose (select method) or enter (code)

reqId

string

Yes

MFA request ID from sync session events

selectedOption

string

choose

MFA method to use (e.g., sms, email)

otpValue

string

enter

Verification code entered by user

Response:


Credential Encryption

Get TOTP

Returns a time-based token for encrypting retailer credentials before calling POST /sync/connections/connect.

Note: The SDK widget handles credential encryption automatically. Use this endpoint only if building a custom connection UI.

Response:

Use token to encrypt credentials client-side. Pass currentStamp back when connecting.


User Profile

Get Profile

Returns the authenticated user's profile.

Response:

Phone number is masked for privacy (last 4 digits only).


OAuth Endpoints

Authorization

SDK handles this automatically. Permissions are configured per-client during onboarding.

Token Exchange

SDK handles this automatically.

Revoke Token

User Info (OIDC)

Standard OIDC endpoint. Returns user claims.

Response:


Errors

All errors follow this format:

Status Codes:

Code
Meaning

400

Bad request (missing or invalid parameters)

401

Unauthorized (missing or invalid token)

403

Forbidden (insufficient permissions)

404

Not found

429

Rate limit exceeded

502

Upstream service error (retry with backoff)

Rate Limits

  • 100 requests/minute per user

  • 10 syncs/hour per retailer

Discovery

OIDC discovery document:

JWKS for token validation:

Last updated

Was this helpful?