---
title: "Reference Tables"
description: "Reference Tables"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/reference-tables"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-05"
---

# Reference Tables

## List reference tables

### List reference tables

**GET** `/v2/reftable`

Lists the account's reference tables with their health and live row count.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "author_id": "string",
      "columns": [
        {
          "name": "string",
          "type": "string"
        }
      ],
      "connection_id": "string",
      "created": "string",
      "description": "string",
      "generation": 0,
      "health": "pending",
      "id": "string",
      "last_sync": {
        "at": "string",
        "bytes": 0,
        "error": "string",
        "generation": 0,
        "rows": 0,
        "scanned": 0,
        "skipped_duplicate_key": 0,
        "skipped_missing_key": 0
      },
      "lookup_key": "string",
      "name": "string",
      "row_count": 0,
      "schedule": {
        "day_of_week": "string",
        "run_frequency": "Hourly",
        "time_of_day": "string",
        "timezone": "string"
      },
      "slug": "string",
      "sql": "string",
      "sql_dialect": "string",
      "sync_enabled": true,
      "updated": "string",
      "used_by": 0,
      "work_id": "string"
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Create reference table

### Create reference table

**POST** `/v2/reftable`

Creates a reference table from a connection and SQL query. The slug defaults from the name and is immutable; when sync\_enabled is true the sync work is scheduled right away.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "author_id": "string",
    "columns": [
      {
        "name": "string",
        "type": "string"
      }
    ],
    "connection_id": "string",
    "created": "string",
    "description": "string",
    "generation": 0,
    "health": "pending",
    "id": "string",
    "last_sync": {
      "at": "string",
      "bytes": 0,
      "error": "string",
      "generation": 0,
      "rows": 0,
      "scanned": 0,
      "skipped_duplicate_key": 0,
      "skipped_missing_key": 0
    },
    "lookup_key": "string",
    "name": "string",
    "row_count": 0,
    "schedule": {
      "day_of_week": "string",
      "run_frequency": "Hourly",
      "time_of_day": "string",
      "timezone": "string"
    },
    "slug": "string",
    "sql": "string",
    "sql_dialect": "string",
    "sync_enabled": true,
    "updated": "string",
    "used_by": 0,
    "work_id": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Get reference table

### Get reference table

**GET** `/v2/reftable/{id}`

undefined

#### URL Parameters

- **id** (required)
  Reference table ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "author_id": "string",
    "columns": [
      {
        "name": "string",
        "type": "string"
      }
    ],
    "connection_id": "string",
    "created": "string",
    "description": "string",
    "generation": 0,
    "health": "pending",
    "id": "string",
    "last_sync": {
      "at": "string",
      "bytes": 0,
      "error": "string",
      "generation": 0,
      "rows": 0,
      "scanned": 0,
      "skipped_duplicate_key": 0,
      "skipped_missing_key": 0
    },
    "lookup_key": "string",
    "name": "string",
    "row_count": 0,
    "schedule": {
      "day_of_week": "string",
      "run_frequency": "Hourly",
      "time_of_day": "string",
      "timezone": "string"
    },
    "slug": "string",
    "sql": "string",
    "sql_dialect": "string",
    "sync_enabled": true,
    "updated": "string",
    "used_by": 0,
    "work_id": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Update reference table

### Update reference table

**PUT** `/v2/reftable/{id}`

Updates a reference table. A field left out keeps its stored value. The slug is immutable; a changed query, key or column set takes effect on the next sync.

#### URL Parameters

- **id** (required)
  Reference table ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "author_id": "string",
    "columns": [
      {
        "name": "string",
        "type": "string"
      }
    ],
    "connection_id": "string",
    "created": "string",
    "description": "string",
    "generation": 0,
    "health": "pending",
    "id": "string",
    "last_sync": {
      "at": "string",
      "bytes": 0,
      "error": "string",
      "generation": 0,
      "rows": 0,
      "scanned": 0,
      "skipped_duplicate_key": 0,
      "skipped_missing_key": 0
    },
    "lookup_key": "string",
    "name": "string",
    "row_count": 0,
    "schedule": {
      "day_of_week": "string",
      "run_frequency": "Hourly",
      "time_of_day": "string",
      "timezone": "string"
    },
    "slug": "string",
    "sql": "string",
    "sql_dialect": "string",
    "sync_enabled": true,
    "updated": "string",
    "used_by": 0,
    "work_id": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Delete reference table

### Delete reference table

**DELETE** `/v2/reftable/{id}`

Deletes a reference table, its rows and its sync work.

#### URL Parameters

- **id** (required)
  Reference table ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {},
  "request_id": "string",
  "status": 0
}
```

## Look up a reference table row

### Look up a reference table row

**GET** `/v2/reftable/{id}/row/{key}`

Returns the live row for one lookup key.

#### URL Parameters

- **id** (required)
  Reference table ID
- **key** (required)
  Lookup key value

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "data": {},
    "key": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Browse reference table rows

### Browse reference table rows

**GET** `/v2/reftable/{id}/rows`

Pages through the live rows in key order.

#### URL Parameters

- **id** (required)
  Reference table ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **limit** (optional)
  Rows per page, at most 500
- **offset** (optional)
  Rows to skip

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "limit": 0,
    "offset": 0,
    "rows": [
      {
        "data": {},
        "key": "string"
      }
    ],
    "total": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Sync reference table now

### Sync reference table now

**POST** `/v2/reftable/{id}/sync`

Runs one sync immediately, creating the sync work if the table has none.

#### URL Parameters

- **id** (required)
  Reference table ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "author_id": "string",
    "columns": [
      {
        "name": "string",
        "type": "string"
      }
    ],
    "connection_id": "string",
    "created": "string",
    "description": "string",
    "generation": 0,
    "health": "pending",
    "id": "string",
    "last_sync": {
      "at": "string",
      "bytes": 0,
      "error": "string",
      "generation": 0,
      "rows": 0,
      "scanned": 0,
      "skipped_duplicate_key": 0,
      "skipped_missing_key": 0
    },
    "lookup_key": "string",
    "name": "string",
    "row_count": 0,
    "schedule": {
      "day_of_week": "string",
      "run_frequency": "Hourly",
      "time_of_day": "string",
      "timezone": "string"
    },
    "slug": "string",
    "sql": "string",
    "sql_dialect": "string",
    "sync_enabled": true,
    "updated": "string",
    "used_by": 0,
    "work_id": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Templates using a reference table

### Templates using a reference table

**GET** `/v2/reftable/{id}/usedby`

Lists the templates that declare the table in reference\_tables.

#### URL Parameters

- **id** (required)
  Reference table ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "author_id": "string",
      "created": "string",
      "description": "string",
      "desired_format": "string",
      "field_filter": [
        "string"
      ],
      "id": "string",
      "lytics_managed": true,
      "name": "string",
      "reference_tables": [
        "string"
      ],
      "target": "string",
      "type": "string",
      "updated": "string"
    }
  ],
  "request_id": "string",
  "status": 0
}
```