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
| Situation | Use |
|---|---|
| Your store's own stock — no individual seller | Nothing: leave sellerId out of the listing |
| A customer's items, before they have (or link) a TBBN account | sellerRef on the listing — your own reference for them |
| The seller already has a TBBN account, or is happy to make one | OAuth account linking (this guide, steps 1–5) |
| The seller has no TBBN account and you've verified their email and phone | POST /merchant/sellers/verify (step 6) |
| You trade for someone who won't have a TBBN account | A headless seller, POST /merchant/sellers/headless (step 6) |
Listing before your sellers link
Send listings with whichever of these fits the item:
| On the listing | Whose item it is on TBBN |
|---|---|
| Neither | Your store's own, shown under your store's name |
sellerRef | Your 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 |
sellerId | The 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 assellerRefon 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
| Parameter | Required | What to send |
|---|---|---|
client_id | Yes | Your client's clientId |
redirect_uri | Yes | One of your registered redirect URIs, character for character, URL-encoded |
scope | Yes | link:seller |
merchant_seller_ref | Optional | Your reference for this customer — the sellerRef on their listings. Not necessarily your customer id |
state | Yes | A random value you check when the seller comes back (protects against forged requests) |
code_challenge | Yes | PKCE: base64url(SHA-256(code_verifier)), no padding. code_verifier is 43–128 random characters you keep |
code_challenge_method | Yes | S256 |
A link with no code_challenge works until February 3, 2027, and is refused with PKCE_REQUIRED
after that.
What the seller sees
- If they aren't signed in, the tbbnetwork.com sign-in page, where they can also create an account. They come straight back afterwards.
- 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.
| Error | Why |
|---|---|
401 Invalid client / client credentials | Wrong client_id or client_secret, or a revoked client |
400 Invalid or expired authorization code | Used already, or older than 5 minutes — start again |
400 redirect_uri does not match | Send exactly the redirect URI used in step 2 |
400 Invalid PKCE code_verifier | The verifier doesn't match the challenge from step 2 |
400 SELLER_REF_UNCONFIRMED | You put merchant_seller_ref on the link but didn't send it here |
400 SELLER_REF_MISMATCH | The reference you sent isn't the one on the code: don't link this customer |
409 SELLER_REF_LINKED_TO_ANOTHER | That 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.
Link codes: when the seller starts on TBBN
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/verifywithname,verifiedEmail,verifiedPhone,merchantSellerRefandmerchantId. 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,requiresConfirmationistrue: knowing someone's email isn't consent, so send them through steps 2–4 instead. - Headless: if your plan allows it,
POST /merchant/sellers/headlesswithmerchantId,merchantSellerRefand an optionalnamecreates a seller tracked only by you, with no TBBN account. If that person later links their TBBN account with the samemerchant_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 theirsellerId— 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_refwhen 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
stateand PKCE verifier per attempt, checked on return - Code exchanged from your server within 5 minutes
-
sellerIdstored against your seller;seller.linkedwebhook subscribed -
error=access_deniedhandled (the seller chose not to link)
