Quickstart
Get from zero to your first authenticated call in a few minutes.
1. Create an API key
In the app, open Settings -> Integrations -> API and create a tenant API key with the smallest scope set your integration needs (for example items:read). The full secret (pk_live_... or pk_test_...) is shown once. Store it in your server-side secret manager or deployment environment, never in client code or version control.
2. Make your first call
curl https://api.fabhub.app/v1 \
-H "X-API-Key: $FABHUB_API_KEY"
GET /v1 returns the capabilities your credential can access. To inspect the credential itself, including scopes, plan and rate-limit tier, call GET /v1/auth/context:
curl https://api.fabhub.app/v1/auth/context \
-H "X-API-Key: $FABHUB_API_KEY"
{
"data": {
"tenant": { "id": "0e2b...c1", "plan": "pro" },
"api_key": {
"id": "key_8f...",
"prefix": "pk_live_8f3a",
"environment": "production",
"scopes": ["items:read", "items:write", "webhooks:write"],
"rate_limit_tier": "standard",
"expires_at": null
}
}
}
3. Install the SDK
npm install @fabhub/sdk
import { FabHubClient } from '@fabhub/sdk';
const fabhub = new FabHubClient({ apiKey: process.env.FABHUB_API_KEY });
// List the first page of items
const items = await fabhub.listItems({ pageSize: 20 });
console.log(items.data.length, 'of', items.pagination.total);
// Read your organization
const { data: organization } = await fabhub.getOrganization();
console.log(organization.name, organization.plan);
4. Create something (with idempotency)
Write calls take an Idempotency-Key so a retried request never creates a duplicate:
const { data: item } = await fabhub.createItem(
{ name: 'Widget', itemType: 'product', salePrice: 19.99 },
{ idempotencyKey: crypto.randomUUID() },
);
5. Handle errors
import { FabHubApiError } from '@fabhub/sdk';
try {
await fabhub.listItems();
} catch (err) {
if (err instanceof FabHubApiError) {
console.error(err.status, err.code, err.message);
}
}
Next steps
- API reference: every endpoint, parameter and response.
- Webhooks: receive signed events instead of polling.
- MCP: a scoped tool surface for AI-agent workflows.