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

# Labby AI Tables

> Pull the tables you saved in Labby AI into your own reports, BI tools or spreadsheets, for any date range.

Build a table once in Labby AI — "doctor-wise revenue", "pending dues by B2B centre", anything you asked for in chat — save it, and read it from your own systems through two endpoints:

```mermaid theme={null}
flowchart TB
    A[POST /client/auth/token]
    B[GET /client/aiTables<br/>pick a tableID]
    C[GET /client/aiTables/:tableID<br/>with gte and lte dates]
    A --> B
    B --> C
```

> [card] [List Saved Tables](https://developer.flabslis.com/labby-tables/endpoint/list_tables.md)
>
> Every table saved on your account, with its `tableID`.

> [card] [Get Table Data](https://developer.flabslis.com/labby-tables/endpoint/get_table_data.md)
>
> Re-run one table for a date range and get its rows.

## Before you start

* **Labby AI** must be enabled on the labs the table reads. Labs without it are skipped; if none are left, the call returns `403`.
* **Credentials** are the same Client ID and Client Secret as every other Flabs API ([Authentication](https://developer.flabslis.com/auth/introduction.md)). You can also find a table's ID and your Client ID under **Get API** on the table in Labby AI. The secret comes from Flabs support.

> [!WARNING]
>
> The client secret is one key for your whole account: it works on **every** Flabs API enabled
> for you, not only tables. Keep it on your server. Never put it in a browser, a mobile app, or
> a spreadsheet you share. If you hand it to a BI tool, that tool can call the other APIs too.

## How a call works

* **Always the latest version.** Each call re-runs the table's current saved recipe. Edit the table in Labby AI (add a column, a formula, a filter) and the next API call returns the new shape. Read your columns from `data.columns` on every call; don't hard-code them.
* **Dates are IST.** `gte=2026-11-01&lte=2026-11-30` means 1 Nov 00:00 IST to 30 Nov 23:59:59.999 IST. You can also pass full ISO 8601 timestamps. One call covers at most **30 days**, both ends included (1–30 Nov is allowed, 1 Nov–1 Dec is not); for a longer period, call once per month and combine.
* **Labs.** By default a table reads the labs it was saved with. Pass `labIDs` to narrow a multi-lab table to some of them, or to switch a single-lab table to another of your labs.
* **Up to 5,000 rows per call.** When a range holds more, `data.truncated` is set and only the first 5,000 rows come back. Split the range.
* **Formula columns** you added in Labby AI are computed for you and come back like any other column. A formula that can't be computed for a row is `null`.
* **Tables built from an uploaded document** (`refreshable: false`) can't be re-run for a date range; their data call returns `409`.

## Rate limits

| Endpoint | Limit |
| - | - |
| `GET /client/aiTables` | 30 calls per minute per account |
| `GET /client/aiTables/{tableID}` | 20 calls per minute per account, shared by all your tables |
| Both, per IP address | 60 calls per minute |

Each data call runs a fresh query over your lab data, so refresh on a schedule (for example every hour) rather than on every page view. If you refresh many tables at once, spread the calls out: the 20-per-minute limit is for the whole account.

## Errors and retries

Errors use the [standard Flabs error format](https://developer.flabslis.com/introduction.md#error-handling); the reason is in `error.details`.

| Status | Meaning | What to do |
| - | - | - |
| `400` | `gte` / `lte` missing, not a date, in the wrong order or more than 30 days apart; or bad `labIDs` | Fix the request |
| `401` | Token missing, invalid or expired (tokens last 10 minutes) | Get a new token, then retry once |
| `403` | Labby AI is not enabled on the table's labs, or `labIDs` names a lab you can't read | Don't retry |
| `404` | No saved table with this ID on your account | Don't retry; check the ID with `GET /client/aiTables` |
| `409` | The table was built from an uploaded document | Don't retry |
| `422` | The table can't be built for this range or these labs (often: too much data to load in time) | Use a shorter range. Retrying the same request gives the same result |
| `429` | Rate limit hit | Wait the seconds given in `error.details`, then retry |
| `503` | Temporary failure | Retry after a short wait (for example 30 s, then 60 s) |

> [!NOTE]
>
> Never retry `422` or `429` in a tight loop. A `422` usually means the query is heavy, and
> re-sending it only adds load; a `429` keeps failing until the minute resets.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.