TBBNMerchantDocs
API

Seller account linking

Linking connects a seller on your store to their TBBN account. Once linked, the items you send to TBBN for that seller show under their name with your store's logo, they can trade them, and their trades build one reputation across every store they sell through.

This guide is everything you need to build it: what to register, where to send the seller, what comes back, what your server sends to TBBN, and the webhook that confirms it.

You don't have to link anyone before listing. A listing's sellerId is optional: list your whole catalogue first, and link sellers whenever they're ready. Their items follow them when they do — see Listing before your sellers link.

Ways a seller gets onto TBBN through your store

SituationUse
Your store's own stock — no individual sellerNothing: leave sellerId out of the listing
A customer's items, before they have (or link) a TBBN accountsellerRef on the listing — your own reference for them
The seller already has a TBBN account, or is happy to make oneOAuth account linking (this guide, steps 1–5)
The seller has no TBBN account and you've verified their email and phonePOST /merchant/sellers/verify (step 6)
You trade for someone who won't have a TBBN accountA headless seller, POST /merchant/sellers/headless (step 6)

Send listings with whichever of these fits the item:

On the listingWhose item it is on TBBN
NeitherYour store's own, shown under your store's name
sellerRefYour customer's. Until they link their TBBN account it's shown under your store's name; once they link with the same reference, it's theirs
sellerIdThe linked (or headless) seller with that TBBN seller id

sellerRef is your own reference for the customer — any stable value you choose. It never has to be your customer id: a random id, or a hash of your id, works as well. TBBN never shows it publicly. Use the same value as merchant_seller_ref when that customer links (step 2), and every item you sent with it moves to their TBBN account straight away — including items listed months earlier. References beginning tbbn: are TBBN's own.

In a catalogue feed, put the reference — or, once you have it, the TBBN seller id — in the external_seller_id column (see the catalog feed guide).

What you need

  • A Merchant account and a session for its Owner, an Admin or a Developer (OAuth clients), or an API key (the token exchange uses your client secret, not a key).
  • Optionally, your own reference for each customer (merchant_seller_ref) — the same one you send as sellerRef on their listings. Without one, TBBN keys the link by the TBBN seller id it gives you back, and you store that instead.
  • A page on your site to send sellers back to (the redirect URI), served over https.

1. Register an OAuth client (once)

In the Merchant dashboard (merchants.tbbnetwork.com → Account linking), enter your redirect URIs and select Register client. Or with the API:

curl -X POST https://api.tbbnetwork.com/v1/oauth-clients \
  -H "Authorization: Bearer <session or API key>" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "<your merchant id>",
    "redirectUris": ["https://your-store.example/tbbn/callback"]
  }'

The response includes clientId (public, e.g. mc_ab12cd34ef56ab78) and clientSecret. The secret is shown only once; keep it on your server. POST /v1/oauth-clients/{id}/rotate-secret issues a new one; DELETE /v1/oauth-clients/{id} revokes the client (links it made stay).

2. Send the seller to TBBN

Make a fresh state and a PKCE pair for each attempt, and store them against the seller's session.

If you link with merchant_seller_ref, send the request from your server first, so the seller's browser can't change which customer the link is for:

curl -X POST https://api.tbbnetwork.com/v1/link/oauth/par \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "mc_ab12cd34ef56ab78",
    "client_secret": "<your client secret>",
    "redirect_uri": "https://your-store.example/tbbn/callback",
    "scope": "link:seller",
    "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
    "code_challenge_method": "S256",
    "merchant_seller_ref": "store-user-77"
  }'

The answer has a request_uri that works once, for expires_in seconds. Redirect the browser to:

https://account.tbbnetwork.com/link/authorize
  ?client_id=mc_ab12cd34ef56ab78
  &request_uri=urn%3Atbbn%3Alink%3A9f2c...
  &state=Xh3k9Q...

Or put everything on the link, and confirm the reference from your server in step 4:

https://account.tbbnetwork.com/link/authorize
  ?client_id=mc_ab12cd34ef56ab78
  &redirect_uri=https%3A%2F%2Fyour-store.example%2Ftbbn%2Fcallback
  &scope=link:seller
  &state=Xh3k9Q...
  &merchant_seller_ref=store-user-77
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
ParameterRequiredWhat to send
client_idYesYour client's clientId
redirect_uriYesOne of your registered redirect URIs, character for character, URL-encoded
scopeYeslink:seller
merchant_seller_refOptionalYour reference for this customer — the sellerRef on their listings. Not necessarily your customer id
stateYesA random value you check when the seller comes back (protects against forged requests)
code_challengeYesPKCE: base64url(SHA-256(code_verifier)), no padding. code_verifier is 43–128 random characters you keep
code_challenge_methodYesS256

A link with no code_challenge works until February 3, 2027, and is refused with PKCE_REQUIRED after that.

What the seller sees

  1. If they aren't signed in, the tbbnetwork.com sign-in page, where they can also create an account. They come straight back afterwards.
  2. A consent screen naming your store, with Approve and Deny.

If the redirect URI isn't one you registered, they see "This link looks malformed" and nothing is sent back.

3. Handle the redirect back

TBBN redirects the seller's browser to your redirect URI:

  • Approved: https://your-store.example/tbbn/callback?code=4f1c...&state=Xh3k9Q...
  • Denied: https://your-store.example/tbbn/callback?error=access_denied&state=Xh3k9Q...

Check state matches what you stored. Then, from your server, exchange the code.

4. Exchange the code (server to server)

The code works once and only for 5 minutes.

curl -X POST https://api.tbbnetwork.com/v1/link/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "authorization_code",
    "code": "4f1c...",
    "client_id": "mc_ab12cd34ef56ab78",
    "client_secret": "<your client secret>",
    "redirect_uri": "https://your-store.example/tbbn/callback",
    "code_verifier": "<the verifier you made in step 2>",
    "merchant_seller_ref": "store-user-77"
  }'

The token endpoint also takes a form-encoded body and client_secret_basic, as standard OAuth libraries send, and GET https://api.tbbnetwork.com/.well-known/oauth-authorization-server describes the handshake.

Response:

{
  "sellerId": "7d0c…",
  "merchantSellerRef": "store-user-77",
  "linked": true,
  "attributedListings": 12
}

Send merchant_seller_ref here whenever you put it on the authorize link: it's the reference your server expects for the customer who's signed in with you. It's optional after a pushed request, and must match if you send it. Items you listed under a reference move to whoever links with it, so never link on a reference only the browser has seen.

Store sellerId against your customer: it's their TBBN seller id, and you can send it as sellerId on their listings from now on (sending sellerRef keeps working too). That's the link: nothing else (no access or refresh token) is issued. If you sent no merchant_seller_ref, merchantSellerRef is one TBBN made from the seller id (it begins tbbn:seller:). If this customer was already linked, you get the same link back.

attributedListings is how many of your listings moved to them with this link: everything you listed with their reference as sellerRef, and everything under the headless seller they replace (step 6). A listing reserved in a trade at that moment moves once the trade ends.

ErrorWhy
401 Invalid client / client credentialsWrong client_id or client_secret, or a revoked client
400 Invalid or expired authorization codeUsed already, or older than 5 minutes — start again
400 redirect_uri does not matchSend exactly the redirect URI used in step 2
400 Invalid PKCE code_verifierThe verifier doesn't match the challenge from step 2
400 SELLER_REF_UNCONFIRMEDYou put merchant_seller_ref on the link but didn't send it here
400 SELLER_REF_MISMATCHThe reference you sent isn't the one on the code: don't link this customer
409 SELLER_REF_LINKED_TO_ANOTHERThat reference is already linked to a different TBBN account — use a reference unique to each customer

5. The seller.linked webhook

Subscribe to seller.linked (see Webhooks) to be told about every new link — useful as a confirmation, or if your callback page failed after the seller approved:

{
  "type": "seller.linked",
  "sellerId": "7d0c…",
  "merchantId": "<your merchant id>",
  "merchantSellerRef": "store-user-77",
  "linkMethod": "OAUTH_AUTHORIZATION",
  "occurredAt": "2026-10-05T14:03:11.000Z"
}

linkMethod is OAUTH_AUTHORIZATION, LINK_CODE (a link code), INITIAL_VERIFICATION (step 6) or HEADLESS_CREATED.

A seller can also start linking from their TBBN account: under Linked stores → Link a store they select Get a link code and get a one-time code like 7Q4K-9M2X (30 minutes, single use). Give them a place in their account on your site to enter it, then redeem it from your server with your own reference for that customer:

curl -X POST https://api.tbbnetwork.com/merchant/sellers/link-code \
  -H "Authorization: Bearer tbbn_sk_live_..." -H "Content-Type: application/json" \
  -d '{"code":"7Q4K-9M2X","merchant_seller_ref":"cust_8821"}'

The answer is the same as the token exchange's: sellerId, merchantSellerRef, linked and attributedListings, and the seller.linked webhook follows with linkMethod: "LINK_CODE". A wrong, used or expired code is 400 LINK_CODE_INVALID; a reference already linked to someone else is 409 SELLER_REF_LINKED_TO_ANOTHER, and the code stays usable so you can retry with the right reference. Every SDK has it as sellers.redeemLinkCode.

To be listed for sellers under Link a store, set the page on your site where customers connect TBBN in your merchant dashboard → Settings → Customer linking (linkAccountUrl). Members follow that link to your page; start the OAuth handshake or ask for a link code there.

6. Sellers without a TBBN account

  • Verified contact details: POST /merchant/sellers/verify with name, verifiedEmail, verifiedPhone, merchantSellerRef and merchantId. Send only details your store has verified. If no TBBN account uses that email or phone, TBBN creates the seller's profile and links it to your store (requiresConfirmation: false). If one already does, requiresConfirmation is true: knowing someone's email isn't consent, so send them through steps 2–4 instead.
  • Headless: if your plan allows it, POST /merchant/sellers/headless with merchantId, merchantSellerRef and an optional name creates a seller tracked only by you, with no TBBN account. If that person later links their TBBN account with the same merchant_seller_ref, the link moves to their account and so do the headless seller's listings; a listing call that still names the headless seller's id is credited to them.

After linking

  • Their items are theirs: everything listed with their reference has already moved. Keep sending their listings with sellerRef, or switch to their sellerId — either works (see the Trade Engine walkthrough). An update that names neither keeps the listing's seller, so re-syncing never takes an item back from them.
  • The seller can unlink your store from their TBBN settings; you can unlink one with POST /v1/sellers/{id}/unlink. Either way, your listings for that seller come down, and unlinking is refused while a trade through your store is in progress.

Checklist

  • Listings sent with sellerRef (your own reference per customer) or no seller for store stock
  • The same reference sent as merchant_seller_ref when that customer links, in a pushed request or at the token exchange
  • OAuth client registered; secret stored server-side only
  • Redirect URI registered exactly as you send it
  • Fresh state and PKCE verifier per attempt, checked on return
  • Code exchanged from your server within 5 minutes
  • sellerId stored against your seller; seller.linked webhook subscribed
  • error=access_denied handled (the seller chose not to link)