> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tybritelabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# System Status

> Reference for the SystemService class in the Tybrite SDK.

The `SystemService` class provides health checks and basic metadata about the Tybrite API. These methods are public and do not require authentication apart from getStoreInfo.

Access this service via `client.system`.

### `getStoreInfo`

Retrieve comprehensive store metadata, configuration, and catalog statistics in a single API call. This endpoint is specifically optimized for initial data synchronizations, AI agent context setting, and dashboard overviews.

The `store` section includes business context — `name`, `logo_url`, `description`, `website`, `phone`, `email`, and `address` (any of which may be `null`) — alongside currencies, timezone, and creation date. The `catalog.products` block includes a thin `sample` array (at most 10 items, each `{ id, name, category, price, image, featured }`) — a small sample of products for context; use `client.products.listProducts` to browse the full catalog.

* **Caching**: Responses are cached for 5 minutes by default.
* **Selective Loading**: Use the `sections` parameter to tailor the response and reduce payload size by up to 80%.
* **Single-store only**: This endpoint describes one store. A **marketplace operator key** receives `403` — use `client.marketplace.getMarketplaceInfo` for the marketplace's own information, or `getMarketplaceInfo({ storeId })` for one merchant within it.

```typescript theme={null}
// 1. Get full store configuration (all sections)
const fullInfo = await client.system.getStoreInfo();
console.log(`Connected to: ${fullInfo.store.name}`);
console.log(`Currencies supported: ${fullInfo.store.currencies.join(', ')}`);

// 2. Optimized request for AI/Agent context
const { features, catalog } = await client.system.getStoreInfo({
  sections: 'features,catalog'
});

if (features.ai_recommendations) {
  console.log(`AI enabled. Total active products: ${catalog.products.active}`);
}

// 3. Bypass cache for fresh settings
const freshData = await client.system.getStoreInfo({ cache: false });
```

**Available Sections:**

| Section      | Description                                             |
| :----------- | :------------------------------------------------------ |
| `catalog`    | Products, categories, collections, and brand counts.    |
| `pricing`    | Dynamic pricing flags and customer tier configurations. |
| `promotions` | Active discounts and campaign summaries.                |
| `payments`   | Merchant's active payment providers and methods.        |
| `shipping`   | Delivery zones and fee thresholds.                      |
| `cms`        | Number of published posts and lookbooks.                |
| `features`   | Platform capability flags (AI, Currency, etc.).         |

<Note>
  The `store` section (ID, Name, Timezone, Currencies) is **always included** regardless of the filtered sections.
</Note>

The `features` block is a flat set of booleans your storefront can use to show/hide capabilities: `ai_recommendations`, `semantic_search`, `multi_currency`, `dynamic_pricing`, `gift_cards`, `promotions`, `cms` (blog/CMS posts), `lookbooks` (shoppable lookbooks — separate from `cms`), `messaging`, `specifications`, and `collections`.

***

### `getApiInfo`

Retrieve basic information about the API, including the current version and list of available endpoint prefixes.

```typescript theme={null}
const info = await client.system.getApiInfo();

console.log(`Connected to: ${info.name} v${info.version}`);
```

***

### `healthCheck`

Verify the operational status of the Tybrite API. The gateway probes all individual services in parallel and returns a per-service status map alongside an overall rollup. Useful for monitoring integrations, connectivity troubleshooting, or building your own status dashboards.

```typescript theme={null}
const health = await client.system.healthCheck();

if (health.status === 'ok') {
  console.log('All systems operational.');
} else if (health.status === 'degraded') {
  // Find which services are affected
  const affected = Object.entries(health.workers)
    .filter(([, w]) => w.status !== 'ok')
    .map(([name]) => name);
  console.warn(`Partial outage — affected services: ${affected.join(', ')}`);
} else {
  console.error('API is reporting a major outage.');
}
```

**Response shape:**

```typescript theme={null}
{
  status: 'ok' | 'degraded' | 'down';  // overall rollup
  gateway: 'ok';                         // gateway is always ok if you received this response
  latency_ms: number;                    // total probe time in ms
  workers: {
    [serviceName: string]: {
      status: 'ok' | 'error';
      latency_ms: number | null;         // null when the service timed out
    };
  };
  timestamp: string;   // ISO 8601
  version: string;     // API version
}
```

**Status semantics:**

| `status`   | HTTP | Meaning                                                      |
| :--------- | :--- | :----------------------------------------------------------- |
| `ok`       | 200  | All services healthy                                         |
| `degraded` | 207  | One or more services errored or timed out                    |
| `down`     | —    | Gateway unreachable (detected externally, not self-reported) |

Each service probe has a 3-second timeout. A service that exceeds it returns `{ status: 'error', latency_ms: null }`.

***

<Note>
  **Caching:** `getStoreInfo` responses are cached for **5 minutes (300s)**. Repeat calls return quickly from cache. Pass `cache: false` to force a fresh response.
</Note>

## Response Codes

### `getApiInfo` (`GET /`) and `healthCheck` (`GET /v1/health`)

| Code  | Meaning                                         |
| :---- | :---------------------------------------------- |
| `200` | All services operational.                       |
| `207` | Partial outage — one or more services degraded. |

These endpoints are unauthenticated — no `401`, `403`, or `429` is emitted.

### `getStoreInfo` (`GET /v1/store/info`)

Requires authentication. Both **publishable** and **secret** keys are accepted.

| Code  | Meaning                                                                                                                       |
| :---- | :---------------------------------------------------------------------------------------------------------------------------- |
| `200` | Store info returned (possibly served from cache).                                                                             |
| `400` | Invalid `sections` parameter (unknown section name).                                                                          |
| `401` | Invalid or missing API key.                                                                                                   |
| `403` | Forbidden — a marketplace operator key was used (use `getMarketplaceInfo` instead), or the key is disabled / store suspended. |
| `429` | Rate limit exceeded.                                                                                                          |
| `500` | Internal server error.                                                                                                        |
