> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.labric.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.labric.co/_mcp/server.

# Get the data schema

GET https://platform.labric.co/api/v1/data/schema

Describe the organization's data schema.

Returns every table the agent can target, including its semantic category
(e.g. raw vs. curated), description, and full column definitions with types,
nullability, uniqueness, and foreign-key targets. Each column carries two
names: 'name' is what the read and write tools accept, and 'sql_column_name'
is the physical column for SQL queries (a column holding another row's key
carries an _id suffix).
The org's own tables are followed by the platform tables (core_experiment,
core_instrument, and similar) that SQL queries can join against, ending with
core_user, which holds the org's members; those have no id or semantic
category. This is the map a parser writes into: use it to plan which tables
to populate and how rows link.

Requires an API key with the `read` scope.

Reference: https://docs.labric.co/api-reference/labric-api/data/get-schema

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Response

### 200

OK

- `list of QueryableTableSchema`

## Errors

### 400 Bad Request Error

Bad Request

- `detail` (string, required)

### 401 Unauthorized Error

Unauthorized

- `detail` (string, required)

### 403 Forbidden Error

Forbidden

- `detail` (string, required)

### 404 Not Found Error

Not Found

- `detail` (string, required)

### 422 Unprocessable Entity Error

Unprocessable Content

- `detail` (list of map from string to any, required)

### 500 Internal Server Error

Internal Server Error

- `detail` (string, required)

## Types

### QueryableTableSchema

A table SQL queries can target. Platform tables have no id.

- `name` (string, required)
- `columns` (list of QueryableColumnSchema, required)
- `id` (integer, optional, nullable)
- `description` (string, optional, nullable)
- `semantic_category` (string, optional, nullable)

### QueryableColumnSchema

A column of a queryable table. Platform table columns have no id.

- `name` (string, required)
- `sql_column_name` (string, required)
- `data_type` (string, required)
- `is_primary_key` (boolean, required)
- `is_foreign_key` (boolean, required)
- `is_nullable` (boolean, required)
- `is_unique` (boolean, required)
- `id` (integer, optional, nullable)
- `description` (string, optional, nullable)
- `foreign_key_table_name` (string, optional, nullable)

## Examples

**Response**

```json
[
  {
    "name": "users",
    "columns": [
      {
        "name": "user_id",
        "sql_column_name": "user_id",
        "data_type": "integer",
        "is_primary_key": true,
        "is_foreign_key": false,
        "is_nullable": false,
        "is_unique": true,
        "id": 1,
        "description": "Primary key for the users table",
        "foreign_key_table_name": null
      },
      {
        "name": "email",
        "sql_column_name": "email",
        "data_type": "varchar(255)",
        "is_primary_key": false,
        "is_foreign_key": false,
        "is_nullable": false,
        "is_unique": true,
        "id": 2,
        "description": "User's email address",
        "foreign_key_table_name": null
      },
      {
        "name": "created_at",
        "sql_column_name": "created_at",
        "data_type": "timestamp",
        "is_primary_key": false,
        "is_foreign_key": false,
        "is_nullable": false,
        "is_unique": false,
        "id": 3,
        "description": "Timestamp when the user was created",
        "foreign_key_table_name": null
      }
    ],
    "id": 1,
    "description": "Stores user account information",
    "semantic_category": "curated"
  },
  {
    "name": "orders",
    "columns": [
      {
        "name": "order_id",
        "sql_column_name": "order_id",
        "data_type": "integer",
        "is_primary_key": true,
        "is_foreign_key": false,
        "is_nullable": false,
        "is_unique": true,
        "id": 4,
        "description": "Primary key for the orders table",
        "foreign_key_table_name": null
      },
      {
        "name": "user_id",
        "sql_column_name": "user_id",
        "data_type": "integer",
        "is_primary_key": false,
        "is_foreign_key": true,
        "is_nullable": false,
        "is_unique": false,
        "id": 5,
        "description": "Foreign key referencing users table",
        "foreign_key_table_name": "users"
      },
      {
        "name": "order_date",
        "sql_column_name": "order_date",
        "data_type": "date",
        "is_primary_key": false,
        "is_foreign_key": false,
        "is_nullable": false,
        "is_unique": false,
        "id": 6,
        "description": "Date when the order was placed",
        "foreign_key_table_name": null
      },
      {
        "name": "total_amount",
        "sql_column_name": "total_amount",
        "data_type": "decimal(10,2)",
        "is_primary_key": false,
        "is_foreign_key": false,
        "is_nullable": false,
        "is_unique": false,
        "id": 7,
        "description": "Total amount for the order",
        "foreign_key_table_name": null
      }
    ],
    "id": 2,
    "description": "Contains customer order records",
    "semantic_category": "raw"
  }
]
```

**SDK Code**

```python
import requests

url = "https://platform.labric.co/api/v1/data/schema"

headers = {"Authorization": "Bearer <api_key>"}

response = requests.get(url, headers=headers)

print(response.json())
```