SDK Reference
The @atrope-ai/api-client package ships two factory functions — one for the IMS API and one for the AI tools API. Both are written in TypeScript with full type coverage.
createImsApiClient(options)
Creates a client for the Atrope IMS API.
import { createImsApiClient } from "@atrope-ai/api-client";
const ims = createImsApiClient({
baseUrl: "https://api.atrope.dev",
fetcher: authenticatedFetch, // optional
});
Options
| Property | Type | Required | Description |
|---|---|---|---|
baseUrl | string | Yes | Base URL of the IMS API, without a trailing path |
fetcher | typeof fetch | No | Custom fetch implementation. Defaults to the global fetch |
Methods
getHealth()
Returns the current health status of the API.
const health = await ims.getHealth();
Returns: Promise<ServiceHealth>
interface ServiceHealth {
service: string;
status: "healthy" | "degraded";
version: string;
timestamp: string; // ISO 8601
}
getInventorySummary()
Returns high-level inventory KPIs derived from live item and availability data.
const summary = await ims.getInventorySummary();
Returns: Promise<InventorySummary>
interface InventorySummary {
activeSkus: number; // items with isActive = true
lowStockSkus: number; // items with zero available quantity
pendingReceipts: number; // open purchase order lines awaiting receipt
fulfillmentRate: number; // percentage (0–100)
}
getInventoryItems()
Returns a flat list of inventory items with their available quantities and locations.
const items = await ims.getInventoryItems();
Returns: Promise<InventoryItem[]>
interface InventoryItem {
id: string; // UUID
sku: string; // item number (e.g. "TBL-NOTE-08")
name: string;
availableUnits: number; // quantity in base UOM
reorderPoint: number;
location: string; // location code
}
createAiApiClient(options)
Creates a client for the Atrope AI tools API.
import { createAiApiClient } from "@atrope-ai/api-client";
const ai = createAiApiClient({
baseUrl: "https://api.atrope.dev",
fetcher: authenticatedFetch,
});
Accepts the same options shape as createImsApiClient.
Methods
getHealth()
Returns the health status of the AI service.
const health = await ai.getHealth();
Returns: Promise<ServiceHealth> — same shape as IMS health.
getTools()
Returns the list of AI tools available for this tenant.
const tools = await ai.getTools();
Returns: Promise<AiTool[]>
interface AiTool {
id: string;
name: string;
category: string;
status: "online" | "preview";
}
Error handling
All methods throw if the HTTP response is not 2xx. Wrap calls in try/catch:
try {
const items = await ims.getInventoryItems();
} catch (err) {
// err.message includes the HTTP status code
console.error(err.message); // e.g. "Request failed with status 401"
}
The raw Response is not exposed by the SDK. If you need status codes or headers, call the REST API directly.
TypeScript
All types are exported from the package root:
import type {
ServiceHealth,
InventorySummary,
InventoryItem,
AiTool,
} from "@atrope-ai/api-client";