Build an app end to end
From an API key to a live, reviewed app, worked through as a crosslister that syncs a creator's products, stock and orders.
This guide builds one real app from start to finish: a crosslister. It lists a creator's Linky Hub products on other marketplaces, keeps stock in step when something sells elsewhere, and pulls Linky Hub orders in so the creator can fulfil them in one place. Creators connect their Linky Hub shop to it with OAuth.
Every endpoint below is in the OpenAPI document. Code samples use $LINKHUB_URL for https://linkyhub.net.
1. Get access
You need an OAuth app (a client id and secret) owned by a Linky Hub account. Usually the account owner is the person who commissioned the app, and you are the developer.
The account owner creates a personal API key: Dashboard → Developers → API keys, with apps:write (and apps:read) ticked, and a short expiry. They hand the key (ak_…) to you over a secure channel. apps:read and apps:write are only ever granted to personal keys; no OAuth token can carry them.
You register the app with it. The account needs a confirmed email address.
curl -X POST "$LINKHUB_URL/api/v3/apps" \
-H "Authorization: Bearer $LINKHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "ListEverywhere",
"slug": "listeverywhere",
"tagline": "List your products on every marketplace and keep stock in step",
"homepageUrl": "https://listeverywhere.example",
"redirectUris": ["https://listeverywhere.example/oauth/linkhub/callback"],
"category": "commerce",
"scopes": ["products:read", "products:write", "inventory:write", "orders:read", "orders:write"],
"acceptTerms": true
}'{ "id": "clx…", "clientId": "…", "clientSecret": "…" }Store clientId and clientSecret in your secret manager straight away. The secret is in this response only. If you lose it, POST /api/v3/apps/{id}/rotate-secret issues a new one (the old one keeps working for 24 hours). The full field list is in Personal API keys.
The owner can do the same thing without a key: Dashboard → Developers → Register app, as described in Register an app.
A new app starts in development. It works end to end, but only the account that owns it can authorise it. Build and test against that account. When you are ready for other creators, submit it for review (see Going live); once a Linky Hub admin approves it, anyone can connect it.
2. Connect a creator with OAuth
Linky Hub's authorization server is at https://linkyhub.net/atlas. Its discovery document is at $LINKHUB_URL/.well-known/oauth-authorization-server/atlas, and the API's protected-resource metadata is at $LINKHUB_URL/.well-known/oauth-protected-resource/api/v3.
Issuer |
|
Authorize |
|
Token |
|
Revoke |
|
Resource (audience) |
|
Flow | Authorization code with PKCE, |
Send the creator to authorize
Generate a PKCE verifier and a state, keep both in the user's session, and redirect:
import { createHash, randomBytes } from 'node:crypto';
const LINKHUB_URL = process.env.LINKHUB_URL!; // Linky Hub's address
const CLIENT_ID = process.env.LINKHUB_CLIENT_ID!;
const CLIENT_SECRET = process.env.LINKHUB_CLIENT_SECRET!;
const REDIRECT_URI = 'https://listeverywhere.example/oauth/linkhub/callback';
const SCOPES = ['openid', 'offline_access', 'products:read', 'products:write', 'inventory:write', 'orders:read', 'orders:write'];
const base64url = (bytes: Buffer) => bytes.toString('base64url');
export function startConnect(session: { verifier?: string; state?: string }) {
const verifier = base64url(randomBytes(32));
const state = base64url(randomBytes(16));
session.verifier = verifier;
session.state = state;
const url = new URL('/atlas/oauth2/authorize', LINKHUB_URL);
url.search = new URLSearchParams({
response_type: 'code',
client_id: CLIENT_ID,
redirect_uri: REDIRECT_URI, // exactly as registered
scope: SCOPES.join(' '), // openid is required; offline_access gets you a refresh token
resource: 'urn:linkhub:api', // the Linky Hub API
state,
code_challenge: base64url(createHash('sha256').update(verifier).digest()),
code_challenge_method: 'S256',
}).toString();
return url.toString(); // redirect the browser here
}Parameter | Value |
|---|---|
|
|
| Your |
| One of your registered redirect URIs, matched exactly |
| Space-separated. |
|
|
| A random value you check on the way back |
| Base64url SHA-256 of the verifier |
|
|
The consent screen
The creator signs in to Linky Hub and sees your app's name and every scope you asked for, in plain words. They can untick any scope except openid. A creator may well let you read products but not change them. So never assume you got what you asked for: read scope from the token response, store it with the connection, and switch features off in your UI when a scope is missing.
The creator is then sent back to your redirect_uri with code and state (or with error=access_denied if they declined). The code lasts 60 seconds.
Exchange the code
Authenticate with your client secret using HTTP Basic (client_secret_basic) and send the verifier:
type TokenResponse = {
access_token: string;
token_type: 'Bearer';
expires_in: number; // seconds; 3600
refresh_token?: string; // only with offline_access
id_token?: string;
scope: string; // what the creator actually granted
};
const basic = 'Basic ' + Buffer.from(`${encodeURIComponent(CLIENT_ID)}:${encodeURIComponent(CLIENT_SECRET)}`).toString('base64');
async function token(params: Record<string, string>): Promise<TokenResponse> {
const response = await fetch(`${LINKHUB_URL}/atlas/oauth2/token`, {
method: 'POST',
headers: { Authorization: basic, 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams(params),
});
if (!response.ok) throw new Error(`token ${response.status}: ${await response.text()}`);
return response.json();
}
export async function finishConnect(query: URLSearchParams, session: { verifier?: string; state?: string }) {
if (query.get('error')) throw new Error(`creator declined: ${query.get('error')}`);
if (!session.state || query.get('state') !== session.state) throw new Error('state mismatch');
const tokens = await token({
grant_type: 'authorization_code',
code: query.get('code')!,
redirect_uri: REDIRECT_URI,
code_verifier: session.verifier!,
resource: 'urn:linkhub:api',
});
const granted = new Set(tokens.scope.split(' '));
// Save tokens.refresh_token (encrypted), the expiry and `granted` against your user.
return { tokens, granted, canFulfil: granted.has('orders:write') };
}The access token is a JWT for the audience urn:linkhub:api and lasts one hour (expires_in: 3600). Send it as Authorization: Bearer … on every API call.
Refresh
With offline_access you get a refresh token. It lasts up to 30 days, and expires sooner if it goes unused for 30 days. Refresh shortly before the access token expires, or once when the API answers 401 invalid_token:
export async function refresh(refreshToken: string) {
const tokens = await token({ grant_type: 'refresh_token', refresh_token: refreshToken, resource: 'urn:linkhub:api' });
// If the response carries a new refresh_token, store it and drop the old one.
return tokens;
}If refreshing fails with invalid_grant, the creator has disconnected you or the token has expired: mark the connection broken and ask them to connect again.
Revoke
When the creator disconnects inside your app, revoke the refresh token (that ends the grant) and delete what you stored:
export async function disconnect(refreshToken: string) {
await fetch(`${LINKHUB_URL}/atlas/oauth2/revoke`, {
method: 'POST',
headers: { Authorization: basic, 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ token: refreshToken, token_type_hint: 'refresh_token' }),
});
}Creators can also disconnect you from Apps in their Linky Hub dashboard. Their tokens stop working at once, and if your webhook subscribes to grant.revoked you are told (see Webhooks). Stop syncing that creator when it arrives.
The full OAuth reference, including the device flow for apps with no browser, is in Connect with OAuth.
3. Choose scopes
Ask for the fewest scopes the app needs. Every scope is a line the creator reads on the consent screen, and a short, obviously justified list gets approved by creators and by Linky Hub's review. For a crosslister:
Scope | Why the crosslister needs it |
|---|---|
| Required. Identifies the creator. |
| A refresh token, so syncing keeps working after the first hour. |
| Read products, variants, images, prices and stock to list them elsewhere. Also needed for the |
| Only if your app creates or edits Linky Hub products (for example importing a listing from another marketplace). |
| Set stock when an item sells elsewhere. It changes stock and nothing else, so a sync-only app does not need |
| Read Linky Hub sales so you can decrement stock elsewhere and show orders. Also needed for the |
| Only if your app fulfils orders (marks them shipped, with tracking), or to make test orders while you build. |
| Sensitive. Buyers' names, emails and shipping addresses. Ask only if your app prints labels or ships; without it, orders come back without a |
| Sensitive; approved apps only. Refunds. Leave it out unless refunds are a core feature. |
Least privilege in practice: a crosslister that only pushes Linky Hub listings outward and keeps stock in step needs products:read inventory:write orders:read. Add products:write for importing, orders:write for fulfilment, and orders:read_customer only when you actually ship. Because the creator can untick anything except openid, design each feature to degrade cleanly when its scope is missing.
Scopes are fixed in the app registration (scopes on POST /apps). You can only ask creators for scopes the app registered, and an approved app cannot add scopes. Every scope is described in Scopes.
4. The crosslister flows
All calls go to $LINKHUB_URL/api/v3 with Authorization: Bearer $ACCESS_TOKEN. Money is always in the smallest currency unit (cents), and timestamps are ISO 8601.
A small helper used below:
async function api<T>(accessToken: string, path: string, init: RequestInit = {}): Promise<T> {
const response = await fetch(`${LINKHUB_URL}/api/v3${path}`, {
...init,
headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', ...init.headers },
});
if (response.status === 429) {
const wait = Number(response.headers.get('retry-after') ?? '1');
await new Promise((resolve) => setTimeout(resolve, wait * 1000));
return api(accessToken, path, init);
}
const body = await response.json();
if (!response.ok) throw Object.assign(new Error(body.message), { code: body.error, status: response.status });
return body as T;
}List products, with variants and images
GET /products (products:read) returns products newest first, each with its images (cover first), variants, stock and sales count. Page with limit (default 50, max 200) and cursor. Filter with updatedSince (ISO 8601: products changed at or after it, a variant's change included) and externalId (the product you tagged with that id).
curl "$LINKHUB_URL/api/v3/products?limit=100" -H "Authorization: Bearer $ACCESS_TOKEN"{
"data": [
{
"id": "cm3prod1",
"blockId": "cm3block1",
"kind": "DIGITAL_DOWNLOAD",
"name": "Logo hoodie",
"description": "Heavyweight cotton.",
"images": [{ "id": "cm3img1", "url": "https://…/hoodie.jpg", "alt": "Black hoodie, front", "position": 0 }],
"priceCents": 4500,
"compareAtCents": null,
"currency": "USD",
"isActive": true,
"soldOut": false,
"inventory": null,
"variants": [
{ "id": "cm3var1", "name": "M / Black", "sku": "HOOD-M-BLK", "priceCents": null, "compareAtCents": null, "inventory": 12, "position": 0, "isActive": true },
{ "id": "cm3var2", "name": "L / Black", "sku": "HOOD-L-BLK", "priceCents": 4800, "compareAtCents": null, "inventory": 3, "position": 1, "isActive": true }
],
"salesCount": 41,
"source": "block",
"editableInPlace": false,
"externalId": "crossly-8812",
"url": "https://linkyhub.net/ada#block-cm3block1",
"updatedAt": "2026-11-20T14:02:11.000Z"
}
],
"products": ["… the same array, deprecated …"],
"nextCursor": "cm3prod1"
}The list is in data. The same array also comes under products for older integrations; that key is deprecated, so read data.
A variant with
priceCents: nulluses the product's price. A variant withinventory: nullis untracked; a product withinventory: nullis unlimited.Use the variant
skuto match listings on other marketplaces.sourcetells you who owns the product:block(sold from the creator's page),shopifyorprint-on-demand(owned by that sync; do not fight it), orexternal.externalIdis your own id for the product, as you set it. Only your app sees it; for any other app it isnull.urllinks to the product on the creator's public page (an anchor on its block), or isnullwhen no block sells it.updatedAtis the latest change to the product or any of its variants. For an incremental sync, keep the time you last started one and ask for?updatedSince=that time.
GET /products/{productId} returns one product in the same shape.
Create and update a product
POST /products (products:write) creates a product and the block that sells it on the creator's page. It is live immediately. name and priceCents are required. Images must already be at a URL; to host one on Linky Hub, upload it first with POST /media (media:write, multipart/form-data with a file part) and use the url it returns.
curl -X POST "$LINKHUB_URL/api/v3/products" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{
"name": "Logo hoodie",
"description": "Heavyweight cotton.\nRuns large.",
"priceCents": 4500,
"currency": "USD",
"externalId": "crossly-8812",
"images": [{ "url": "https://cdn.example/hoodie.jpg", "alt": "Black hoodie, front" }],
"variants": [
{ "name": "M / Black", "sku": "HOOD-M-BLK", "inventory": 12 },
{ "name": "L / Black", "sku": "HOOD-L-BLK", "inventory": 3, "priceCents": 4800 }
]
}'It answers 201 with the product, in the shape above. Other optional fields: compareAtCents, soldOut, inventory (for a product without variants), allowCustomAmount and minimumCents, and pageId (defaults to the main page).
descriptionis plain text up to 5,000 characters. Line breaks are kept, and a long one shows a "Read more" on the page.externalId(up to 255 characters) is your id for the product, unique per creator for your app: a second product with the same one is409 conflict. Set or change it onPATCHtoo, clear it withnull, and find the product again withGET /products?externalId=.Send an
Idempotency-Keyheader (up to 200 characters) so a retry is safe: see Idempotency.
For shipped goods, send "isPhysical": true on create (or on a PATCH later). Checkout then collects the buyer's shipping address, and the product's orders come back with isPhysical: true and the address under orders:read_customer. Leave it off for downloads.
PATCH /products/{productId} changes only the fields you send. images replaces the whole gallery. isActive: false hides a product without deleting it; DELETE /products/{productId} works only on a product that has never sold.
curl -X PATCH "$LINKHUB_URL/api/v3/products/cm3prod1" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{ "priceCents": 3900, "compareAtCents": 4500 }'Variants have their own endpoints: POST /products/{productId}/variants adds one (name required; sku, priceCents, compareAtCents, inventory, isActive optional), PATCH /variants/{variantId} changes one, and DELETE /variants/{variantId} removes one.
Set stock
This is the call a crosslister makes most. It needs only inventory:write, and it sets an absolute count (not a delta), so a retry is harmless.
For a product without variants, PUT /products/{productId}/inventory. 0 marks it sold out; a positive number un-sells it; null means unlimited.
curl -X PUT "$LINKHUB_URL/api/v3/products/cm3prod1/inventory" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{ "inventory": 7 }'For one variant, PUT /variants/{variantId}/inventory, where null means untracked:
curl -X PUT "$LINKHUB_URL/api/v3/variants/cm3var2/inventory" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{ "inventory": 2 }'The product endpoint answers with the updated product; the variant endpoint with the updated variant.
// Something sold on another marketplace: read the current Linky Hub count, then set it.
async function soldElsewhere(accessToken: string, productId: string, variantId: string, quantity: number) {
const product = await api<{ variants: { id: string; inventory: number | null }[] }>(accessToken, `/products/${productId}`);
const current = product.variants.find((variant) => variant.id === variantId)?.inventory;
if (current == null) return; // untracked: nothing to keep in step
await api(accessToken, `/variants/${variantId}/inventory`, {
method: 'PUT',
body: JSON.stringify({ inventory: Math.max(0, current - quantity) }),
});
}Because writes are absolute, keep one source of truth for the count in your app and avoid read-modify-write races between workers for the same SKU (one queue per creator works well).
List and read orders
GET /orders (orders:read) returns sales newest first. Filter with status (PENDING, PAID, FULFILLED, REFUNDED, PARTIALLY_REFUNDED, FAILED, CANCELED), productId, since (ISO 8601: orders created at or after it) and updatedSince (orders changed at or after it: paid, fulfilled, tracking edited, refunded), and page with limit and cursor.
For incremental sync, keep the newest updatedAt you have seen and ask for updatedSince that instant next time. Page through every result: the order is still newest-created first, not by update time.
curl "$LINKHUB_URL/api/v3/orders?status=PAID&since=2026-11-01T00:00:00Z" -H "Authorization: Bearer $ACCESS_TOKEN"{
"orders": [
{
"id": "cm3ord1",
"status": "PAID",
"amountCents": 4800,
"subtotalCents": 4800,
"discountCents": 0,
"currency": "USD",
"productId": "cm3prod1",
"productName": "Logo hoodie",
"variantId": "cm3var2",
"variantName": "L / Black",
"quantity": 1,
"isPhysical": false,
"provider": "STRIPE",
"paidAt": "2026-11-21T09:15:42.000Z",
"refundedCents": 0,
"refundedAt": null,
"createdAt": "2026-11-21T09:15:30.000Z",
"updatedAt": "2026-11-21T09:15:42.000Z",
"test": false,
"fulfilledAt": null,
"trackingNumber": null,
"carrier": null,
"trackingUrl": null,
"platformFeeCents": 0,
"processingFeeCents": null,
"netCents": null,
"shippingCents": 0,
"taxCents": 0,
"buyer": { "email": "sam@example.com", "name": "Sam Lee", "shippingAddress": null }
}
],
"nextCursor": null
}Each order is one unit of one product (
quantityis always1).buyeris present only when the token was grantedorders:read_customer. Without it the field is absent, not empty.test: truemarks a test order. Leave those out of anything that counts real sales.
GET /orders/{orderId} returns one order in the same shape.
Fees
Linky Hub takes no cut of any sale, on any plan. Checkout charges on the creator's own Stripe or PayPal account with no application fee, so:
platformFeeCentsis always0.processingFeeCentsis what Stripe or PayPal kept. Linky Hub does not record it on the order, so it isnull(the creator sees it in their Stripe or PayPal dashboard). It is0on a test order.netCentsisamountCentsminus both fees, so it isnullwheneverprocessingFeeCentsis.shippingCentsandtaxCentsare0: checkout adds no separate shipping or tax line. The product price is what the buyer pays.
Physical goods
Set "isPhysical": true on a product (create or PATCH). From then on:
Checkout collects a shipping address. Stripe and PayPal validate it.
Paid orders come back with
isPhysical: trueand stayPAIDuntil you fulfil them. Nothing flips them on its own, unlike a download.With
orders:read_customer,buyer.shippingAddresshas the address in one shape, whichever provider took the payment:
{
"name": "Sam Lee",
"line1": "1 Main St",
"line2": null,
"city": "Springfield",
"state": "IL",
"postalCode": "62701",
"country": "US",
"phone": null
}country is ISO 3166-1 alpha-2. Any field the buyer or provider did not give is null, and phone usually is. shippingAddress itself is null for a digital order.
Ship it, then call fulfil with the tracking (below).
Mark an order fulfilled
POST /orders/{orderId}/fulfil (orders:write) marks a PAID order FULFILLED, sets fulfilledAt, and answers { "ok": true }. Calling it on an order that is already fulfilled also succeeds, so a retry is safe. Any other status is refused with 400 invalid_request.
All the body fields are optional:
Field | |
|---|---|
| Up to 100 characters. |
| Up to 50 characters, such as |
| An http(s) URL. |
|
|
curl -X POST "$LINKHUB_URL/api/v3/orders/cm3ord1/fulfil" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{ "carrier": "USPS", "trackingNumber": "9400111899223344556677", "trackingUrl": "https://tools.usps.com/go/TrackConfirmAction?tLabels=9400111899223344556677", "notifyBuyer": true }'To correct the tracking, call it again. If you send any of the three tracking fields, all three are replaced, and a field you leave out becomes null. fulfilledAt keeps the first time. GET /orders/{orderId} returns trackingNumber, carrier, trackingUrl and fulfilledAt. order.fulfilled fires once per order, on the first fulfil. The creator can do the same from Dashboard → Orders → Mark shipped.
Refunds
POST /orders/{orderId}/refunds needs orders:refund, which is granted only to approved apps (it moves money). It refunds on the creator's own payment account, in full or in part:
curl -X POST "$LINKHUB_URL/api/v3/orders/cm3ord1/refunds" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: refund-ebay-1234567890" \
-d '{ "amountCents": 1000, "reason": "Returned on another marketplace" }'{ "id": "cm3ref1", "orderId": "cm3ord1", "amountCents": 1000, "reason": "Returned on another marketplace", "status": "succeeded", "createdAt": "2026-11-22T10:00:00.000Z" }Leave out
amountCentsto refund everything not yet refunded. You cannot refund more than was paid.The order becomes
PARTIALLY_REFUNDEDorREFUNDED. OnlyPAID,FULFILLEDandPARTIALLY_REFUNDEDorders can be refunded; anything else is409 conflict.statusissucceeded,pendingorfailed.PayPal orders cannot be refunded through the API (
409); the creator refunds them from PayPal.GET /orders/{orderId}/refunds(orders:read) lists refunds on an order as{ "refunds": [...] }.
Test mode
While your app is in development (not yet approved), you can make test orders on your own account. You can also make them with a personal API key. Test orders let you run the whole flow before any real sale: order.paid, fulfil and refund.
POST /test/orders (orders:write) creates a PAID order on one of the creator's products, flagged "test": true, and fires order.paid through the same code a real sale uses. It answers 201 with the order.
curl -X POST "$LINKHUB_URL/api/v3/test/orders" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{ "productId": "cm3prod1", "variantId": "cm3var2", "buyer": { "email": "you@example.com", "name": "Test Buyer" } }'variantIdis required when the product has variants. The price is the variant's, or the product's.buyeris optional (email,name,shippingAddressin the shape above). A physical product gets a sample US address if you leave it out.Only for an OAuth token from an app that is not approved yet, acting for the app's owner, or for a personal API key. Anything else gets
403 forbidden. Once your app is approved, make test orders with a personal key.No money moves and nothing is charged. The buyer is never emailed, and stock and
salesCountdo not change. Test orders are left out of earnings, analytics, payouts and affiliate commission. They show in Dashboard → Orders with a "test" label.order.paid,order.fulfilledandorder.refundedpayloads carry"test": truefor a test order.
Fulfil a test order with POST /orders/{orderId}/fulfil as usual. To refund one, call POST /test/orders/{orderId}/refunds (orders:write, the same body as a real refund, Idempotency-Key optional). This works before your app is approved for orders:refund. Nothing goes through Stripe. The order becomes REFUNDED or PARTIALLY_REFUNDED and order.refunded fires. Only test orders can be refunded this way. An approved app holding orders:refund can also refund a test order through the normal endpoint, and it skips Stripe the same way.
Pagination
Every list returns its items under data, with a nextCursor. Pass it back as ?cursor= for the next page; null means you have everything. Lists also repeat the items under a key named after them (products, orders); those keys are deprecated, so read data.
async function allProducts(accessToken: string) {
const products = [];
let cursor: string | null = null;
do {
const page: { data: unknown[]; nextCursor: string | null } =
await api(accessToken, `/products?limit=200${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}`);
products.push(...page.data);
cursor = page.nextCursor;
} while (cursor);
return products;
}For an incremental order sync, page GET /orders?since= from the time of your last successful sync, and rely on webhooks for anything sooner.
Idempotency
Two writes take an Idempotency-Key header. Derive the key from something stable in your system, such as the marketplace's listing or return id.
Refunds require one. Sending the same key again returns the first refund instead of making a second; reusing a key for a different order is
409 conflict.POST /productstakes one optionally. Within 24 hours, the same key returns the first product (still201) instead of creating a second; the same key with a different body is409 conflict. After 24 hours the key can be used again.
The other writes are safe to retry by design: stock is set absolutely, fulfilling twice is a no-op, and PATCH sets fields to values.
Errors
Every error is JSON with a stable error code to branch on and a message to show a person:
{ "error": "insufficient_scope", "message": "This token was not granted products:write." }Status |
| What to do |
|---|---|---|
400 |
| The input is wrong; |
401 |
| No bearer token. |
401 |
| Expired or revoked. Refresh once and retry; if refreshing fails, the creator must reconnect. |
403 |
| The creator did not grant the scope this call needs (the |
403 |
| Not allowed for this account. |
404 |
| No such thing, or it is not this creator's. |
405 |
| Wrong method for this path. |
409 |
| The state does not allow it (for example refunding a fully refunded order). |
413 |
| Body over 256 KB. |
429 |
| Wait |
500 |
| Ours. Retry later with backoff. |
503 |
| Temporarily unavailable. Retry later. |
Rate limits
600 requests a minute per app and creator. Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds until the window resets), so you can slow down before you hit it. Over it you get 429 rate_limited with a Retry-After header in seconds: wait that long, then retry. Each creator has their own budget, so one large shop does not slow the others, but a full catalogue sync for one creator should page at limit=200 and spread its stock writes out.
5. Webhooks
Polling is the fallback; webhooks are how a crosslister hears about a Linky Hub sale fast enough to stop overselling elsewhere.
Each app has one webhook URL, with the events you want. Set it on the app's page under Dashboard → Developers, or from your deploy script with a personal API key that holds apps:write. The URL must be https on a public host. The signing secret is shown once, when the webhook is first created.
curl -X PUT "$LINKHUB_URL/api/v3/apps/$APP_ID/webhook" \
-H "Authorization: Bearer $LINKHUB_API_KEY" -H "content-type: application/json" \
-d '{"url":"https://example.com/api/webhooks/linkyhub","events":["order.paid","order.fulfilled","order.refunded","product.updated","inventory.low","grant.revoked"]}'
# → { "url": "…", "events": [...], "secret": "whsec_…", "createdAt": "…" }
curl -X POST "$LINKHUB_URL/api/v3/apps/$APP_ID/webhook/test" -H "Authorization: Bearer $LINKHUB_API_KEY"GET on the same path reads the webhook back without its secret, and DELETE removes it. POST …/webhook/rotate-secret returns a new secret, and the old one keeps verifying for 24 hours. See Webhooks.
You receive an event only for creators who connected your app and granted the scope it needs:
Event | Needs | Use in a crosslister |
|---|---|---|
|
| A sale on Linky Hub: decrement stock on other marketplaces. |
|
| Mark it shipped in your app. |
|
| Reflect the refund. |
|
| Re-read the product and update your listings. |
|
| Stock is at or below 5. |
| none | The creator disconnected your app: stop syncing and delete their tokens. |
| none | The creator's Linky Hub sign-in account changed or was deleted. |
subscriber.created (audience:read) and event.registration (events:read) exist too, but a crosslister has no use for them.
The body is JSON: { id, type, timestamp, creator: { id }, data }. creator.id is the sub of the access token you hold for that creator, on every event type, so look up the connection by it. (If a delivery has no top-level creator, read data.creator.id, or data.user_id for grant.revoked and user.*.) data carries ids rather than full records; for example order.paid carries orderId, amountCents, currency, productId, productName and variantId. Treat the payload as a nudge and fetch the current state from the API before acting.
Verifying
Deliveries are signed with the Standard Webhooks headers webhook-id, webhook-timestamp and webhook-signature. Verify the signature against the raw body before trusting anything in it, and reject timestamps more than five minutes old. The standardwebhooks library does both:
import { Webhook } from 'standardwebhooks';
const webhook = new Webhook(process.env.LINKHUB_WEBHOOK_SECRET!);
export async function POST(request: Request) {
const body = await request.text(); // raw body: do not parse before verifying
let event: { type: string; creator: { id: string } | null; data: Record<string, unknown> };
try {
event = webhook.verify(body, Object.fromEntries(request.headers)) as typeof event;
} catch {
return new Response('bad signature', { status: 400 });
}
const deliveryId = request.headers.get('webhook-id')!;
await queue.add({ deliveryId, event }); // answer fast, work later; skip ids you have already seen
return new Response(null, { status: 204 });
}Delivery
Answer 2xx within a few seconds and do the work afterwards. Failed deliveries are retried with backoff. Deliveries can arrive more than once and out of order: deduplicate on webhook-id, and re-read the order or product from the API when order matters. More in Webhooks.
6. MCP
The same API is a Model Context Protocol server at https://linkyhub.net/api/mcp, so an assistant can run the same flows as tools (products_list, inventory_set, orders_fulfil and so on), filtered to the scopes the creator granted. It takes OAuth tokens and registers its own client, so a crosslister does not need it; it is useful for an AI assistant inside your app. See Connect an assistant (MCP).
7. Going live
Submit for review
When the app works for your own account, submit it:
curl -X POST "$LINKHUB_URL/api/v3/apps/$APP_ID/submit" -H "Authorization: Bearer $LINKHUB_API_KEY"(or request review from the app's page in the dashboard). A Linky Hub admin reviews it, and the owner gets an email when it is approved or suspended. Once approved, any creator can connect it, and scopes marked "approved apps only", such as orders:refund, become grantable. An approved app cannot add scopes. An app that breaks the developer terms can be suspended, and its tokens stop working.
Before you submit, make sure name, tagline, description, homepageUrl and category are filled in (PATCH /api/v3/apps/{id}): they are what creators and reviewers see.
Security checklist
The client secret, refresh tokens and webhook secret live in a secret manager or encrypted at rest, never in a browser, mobile app, log or git repository.
PKCE (
S256) and a randomstateon every authorization, andstatechecked on return.Redirect URIs are exact, https, and only the ones you use.
Scopes are the minimum, and
orders:read_customeronly if you ship.You read the granted
scopefrom every token response and handle a missing scope.A
401triggers one refresh, not a loop; a failed refresh marks the connection broken.Disconnecting in your app revokes the refresh token and deletes the creator's data you no longer need;
grant.revokeddoes the same.Webhook signatures and timestamps are verified on the raw body, and deliveries are deduplicated on
webhook-id.Retry-Afteris honoured on429.Refunds always carry a stable
Idempotency-Key.Buyer details, if you have them, are used only to fulfil orders, and deleted when you no longer need them.
The personal API key used to register the app has a short expiry, and is revoked when development is done.
You can rotate the client secret (
POST /api/v3/apps/{id}/rotate-secret) and redeploy within its 24-hour overlap.
Support
Ask in the Developers category of the community, and watch the changelog for API changes and the status page for incidents.