Skip to main content

Getting Started

Installation​

# SDK (for frontend and Node.js apps)
npm install @tanqory/sdk

# Types (for TypeScript type safety)
npm install @tanqory/types

Quick Start — SDK​

import { createClient } from '@tanqory/sdk'

// 1. Create client
const tanqory = createClient({
apiKey: 'pk_live_your_publishable_key',
})

// 2. Authenticate
const auth = await tanqory.auth.login('[email protected]', 'password')

// 3. List your stores
const stores = await tanqory.stores.list()

// 4. Access store data
const products = await tanqory.products.list(stores[0].id, {
status: 'active',
limit: 20,
})

Quick Start — React​

import { TanqoryProvider } from '@tanqory/sdk/react'
import { createClient } from '@tanqory/sdk'

const client = createClient({ apiKey: 'pk_live_...' })

function App() {
return (
<TanqoryProvider client={client}>
<ProductList />
</TanqoryProvider>
)
}
import { useProducts } from '@tanqory/sdk/react'

function ProductList() {
const { data, isLoading } = useProducts('store-id', { status: 'active' })

if (isLoading) return <div>Loading...</div>

return (
<ul>
{data?.data.map(product => (
<li key={product.id}>{product.title} — {product.price}</li>
))}
</ul>
)
}

Quick Start — Direct API​

# Register
curl -X POST https://api.tanqory.com/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"SecurePass123!","firstName":"John","lastName":"Doe"}'

# Login
curl -X POST https://api.tanqory.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"SecurePass123!"}'

# List products (with JWT)
curl https://app.tanqory.com/api/v1/stores/{storeId}/products \
-H "Authorization: Bearer {accessToken}"

Two hosts, and the second one is the one to remember:

HostAnswers
api.tanqory.comaccount-level calls — register, login, refresh
app.tanqory.comeverything scoped to a store

A store's data lives in one regional cell, and app.tanqory.com is what knows which. It reads the storeId out of the path and forwards the request to that store's cell — /stores/<id>/* to the cell, /auth/*, /stores and /subscriptions/* to the account API.

Never address a cell yourself. Hosts like api-do-sgp1.tanqory.com are internal plumbing: which one a store sits on is our decision, it can change, and a request sent to the wrong one gets a 404 that looks exactly like a missing record.

Type Safety​

import type { Tanqory } from '@tanqory/types'

// All request params and responses are fully typed
const params: Tanqory.Product.CreateParams = {
title: 'iPhone 16 Pro',
price: { amount: 39900, currency: 'THB' },
status: 'DRAFT',
}

const product: Tanqory.Product = await tanqory.products.create(storeId, params)
product.id // string ✅
product.title // string ✅
product.price // { amount: number, currency: string } ✅

Next Steps​