TanqoryDocs

Make your first API call

Create an app, install it on your development store, get an access token and read the store with the Admin API.

This guide takes about ten minutes. You need a partner organization and a development store. The code runs on your computer; nothing needs to be deployed yet.

1. Create the app

  1. In the partner dashboard, open Apps and select Create app.
  2. Fill in App name. Handle is optional: it is made from the name and becomes the app's address in the store dashboard.
  3. Select Create app. A dialog, Save your client secret, shows the Client ID and the Client secret. The secret is shown only this once: put it in your secret store now, then select I saved the secret.
The Create an app dialog with App name filled in, the optional Handle left empty, and the Create app button.The Create an app dialog with App name filled in, the optional Handle left empty, and the Create app button.
The Save your client secret dialog: the Client ID and the Client secret, blurred in this picture, each with a Copy button, and I saved the secret.The Save your client secret dialog: the Client ID and the Client secret, blurred in this picture, each with a Copy button, and I saved the secret.

2. Configure it

Open Configuration:

  1. App URL: the page the store dashboard opens, for example https://example.com/app.
  2. Redirect URLs: where Tanqory sends the merchant back after the install, for example https://example.com/auth/callback. Select Add redirect URL. You can add up to 10.
  3. Access scopes, Required: select Add scope, search for read_products and pick it. Add write_products the same way.
  4. Select Save version.
The URLs section of Configuration: App name, App URL, Open inside the store admin switched on, one redirect URL, and the Version label.The URLs section of Configuration: App name, App URL, Open inside the store admin switched on, one redirect URL, and the Version label.
The Access scopes section of Configuration: read_products and write_products under Required, and an Add scope button under Required and under Optional.The Access scopes section of Configuration: read_products and write_products under Required, and an Add scope button under Required and under Optional.

The app's Home now lists its OAuth endpoints: the authorize address for each of your development stores, the token address and the session keys.

3. Install it on your development store

An install is the OAuth 2.0 authorization code grant with PKCE (RFC 6749, RFC 7636). Make a state value and a code verifier, keep both, and send the merchant (here, you) to the authorize address.

Set these in your shell first:

Shell
export STORE_ID=<the store id from the store dashboard address>
export TANQORY_CLIENT_ID=<your client ID>
export TANQORY_CLIENT_SECRET=<your client secret>
Node.js
// Node.js 18 or later: the values for one install. Keep state and verifier until the callback.
import { createHash, randomBytes } from 'node:crypto';

const state = randomBytes(16).toString('hex');
const verifier = randomBytes(32).toString('base64url');
const challenge = createHash('sha256').update(verifier).digest('base64url');
const url = new URL(`https://admin.tanqory.com/admin/store/${process.env.STORE_ID}/oauth/authorize`);
url.search = new URLSearchParams({
  client_id: process.env.TANQORY_CLIENT_ID,
  scope: 'read_products,write_products',
  redirect_uri: 'https://example.com/auth/callback',
  state,
  code_challenge: challenge,
  code_challenge_method: 'S256',
});
console.log(JSON.stringify({ state, verifier, url: url.href }));

Open the printed url in the browser where you are signed in to the store dashboard. The page Authorize app names your app and organization and lists what the app will be able to do. Select Install app.

The store dashboard's Authorize app page for Docs Sample App: what the app will be able to do, the address the merchant returns to, and the Install app button.The store dashboard's Authorize app page for Docs Sample App: what the app will be able to do, the address the merchant returns to, and the Install app button.

The browser goes to your redirect URL with six query parameters: code, hmac, shop, state, store_id and timestamp. Copy the address from the browser; your page does not need to exist yet.

4. Check the callback and exchange the code

Before you use the code, check that the callback comes from Tanqory: state must be the value you made, and hmac must be the hex HMAC-SHA256 of the other parameters, sorted by name and joined as name=value&name=value, keyed with your client secret.

Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';

// query: the callback's query string, for example new URL(req.url, 'https://example.com').search
export function callbackIsFromTanqory(query, clientSecret) {
  const params = new URLSearchParams(query);
  const message = [...params]
    .filter(([key]) => key !== 'hmac')
    .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
    .map(([key, value]) => `${key}=${value}`)
    .join('&');
  const expected = createHmac('sha256', clientSecret).update(message).digest('hex');
  const given = params.get('hmac') ?? '';
  return given.length === expected.length && timingSafeEqual(Buffer.from(given), Buffer.from(expected));
}

Then exchange the code for an access token. A code works once and only with the verifier of the same install.

Shell
export CODE=<code from the callback>
export CODE_VERIFIER=<verifier from step 3>
curl
curl -X POST "https://api.tanqory.com/v1/stores/$STORE_ID/apps/oauth/token" \
  --data-urlencode "client_id=$TANQORY_CLIENT_ID" \
  --data-urlencode "client_secret=$TANQORY_CLIENT_SECRET" \
  --data-urlencode "grant_type=authorization_code" \
  --data-urlencode "code=$CODE" \
  --data-urlencode "code_verifier=$CODE_VERIFIER" \
  --data-urlencode "redirect_uri=https://example.com/auth/callback"

The answer holds access_token, token_type (Bearer), scope (the granted scopes, separated by spaces) and store_id, and no expiry time. Keep the token on your server, one per store.

5. Call the Admin API

What happens to each Admin API request
  1. Your app server → Tanqory edge POST /admin/<version>/stores/<store id>/graphql with Authorization: Bearer If not: 404 for any other path
  2. Tanqory edge → Admin API To the servers that hold that store
  3. Admin API The version exists If not: 404
  4. Admin API The token is valid for this store If not: 401
  5. Admin API The store exists and the token may use it If not: 404
  6. Admin API The query parses and is valid If not: 400 GRAPHQL_PARSE_FAILED or GRAPHQL_VALIDATION_FAILED
  7. Admin API Every field is within the granted scopes If not: 200 with ACCESS_DENIED
  8. Admin API The query cost fits, and the bucket has enough points If not: 200 with MAX_COST_EXCEEDED or THROTTLED and Retry-After
  9. Admin API Runs the query
  10. Admin API → Your app server data, and extensions.cost with what is left in the bucket
Shell
export TANQORY_ACCESS_TOKEN=<access_token from step 4>
curl
curl -X POST "https://api.tanqory.com/admin/2026-10/stores/$STORE_ID/graphql" \
  -H "Authorization: Bearer $TANQORY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"query": "{ shop { name currencyCode } }"}'

The answer:

JSON
{
  "data": { "shop": { "name": "Docs Writer Store", "currencyCode": "THB" } },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": { "maximumAvailable": 1000, "currentlyAvailable": 999, "restoreRate": 100 }
    }
  }
}

extensions.cost is what the request used from your rate limit; see Rate limits and query cost.

Next

Built from commit c0b3fb3fdef7 · API version 2026-10