---
title: "Schema"
description: "<p>Manage how data sources populate profile fields.</p>"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/schema"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-10"
---

# Schema

Manage how data sources populate profile fields.

## List tables

### List tables

**GET** `/v2/schema`

List tables with schema.

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "draft_id": "string",
      "draft_version": 0,
      "live_id": "string",
      "table": "string"
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Schema Bulk Upsert

### Schema Bulk Upsert

**POST** `/v2/schema/bulk`

Schema bulk upsert creates/updates multiple schema objects. It does not delete any existing schema objects.

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "diff": [
      {
        "diff": [
          {
            "from_val": null,
            "property": "string",
            "to_val": null
          }
        ],
        "id": "string",
        "subject": "mapping",
        "verb": "created"
      }
    ],
    "from": {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    },
    "to": {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    }
  },
  "request_id": "string",
  "status": 0
}
```

## Schema Bulk Upsert

### Schema Bulk Upsert

**PUT** `/v2/schema/bulk`

Schema bulk upsert creates/updates multiple schema objects. It does not delete any existing schema objects.

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "diff": [
      {
        "diff": [
          {
            "from_val": null,
            "property": "string",
            "to_val": null
          }
        ],
        "id": "string",
        "subject": "mapping",
        "verb": "created"
      }
    ],
    "from": {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    },
    "to": {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    }
  },
  "request_id": "string",
  "status": 0
}
```

## Evaluate Expression

### Evaluate Expression

**POST** `/v2/schema/expression/evaluate`

Evaluate an adhoc mapping expression against a single event

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

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

## Update schema with LQL query

### Update schema with LQL query

**POST** `/v2/schema/lql`

Upload LQL query to update schema with corresponding fields and mappings.

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "fields": [
      {
        "assertions": {
          "email": true,
          "filter": [
            "string"
          ],
          "format": "alpha",
          "length": {
            "max": 0,
            "min": 0
          }
        },
        "capacity": 0,
        "created": "2019-08-24T14:15:22Z",
        "disable_indexing": true,
        "edit_status": "string",
        "id": "string",
        "id_config": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        },
        "is_identifier": true,
        "is_pii": true,
        "keep_days": 0,
        "keep_duration": "string",
        "longdesc": "string",
        "managed_by": "string",
        "mergeop": "string",
        "modified": "string",
        "shortdesc": "string",
        "tags": [
          "string"
        ],
        "type": "string"
      }
    ],
    "mappings": [
      {
        "created": "2019-08-24T14:15:22Z",
        "edit_status": "string",
        "expr": "string",
        "field": "string",
        "guard_expr": "string",
        "id": "string",
        "managed_by": "string",
        "modified": "2019-08-24T14:15:22Z",
        "stream": "string"
      }
    ]
  },
  "request_id": "string",
  "status": 0
}
```

## Get schema

### Get schema

**GET** `/v2/schema/{table}`

Retrieve current schema fields, mappings and ranks

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "created": "2019-08-24T14:15:22Z",
    "created_by": "string",
    "description": "string",
    "draft_status": "string",
    "fields": [
      {
        "assertions": {
          "email": true,
          "filter": [
            "string"
          ],
          "format": "alpha",
          "length": {
            "max": 0,
            "min": 0
          }
        },
        "capacity": 0,
        "created": "2019-08-24T14:15:22Z",
        "disable_indexing": true,
        "edit_status": "string",
        "id": "string",
        "id_config": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        },
        "is_identifier": true,
        "is_pii": true,
        "keep_days": 0,
        "keep_duration": "string",
        "longdesc": "string",
        "managed_by": "string",
        "mergeop": "string",
        "modified": "string",
        "shortdesc": "string",
        "tags": [
          "string"
        ],
        "type": "string"
      }
    ],
    "id": "string",
    "is_patch": true,
    "mappings": [
      {
        "created": "2019-08-24T14:15:22Z",
        "edit_status": "string",
        "expr": "string",
        "field": "string",
        "guard_expr": "string",
        "id": "string",
        "managed_by": "string",
        "modified": "2019-08-24T14:15:22Z",
        "stream": "string"
      }
    ],
    "modified": "2019-08-24T14:15:22Z",
    "parent_id": "string",
    "published_by": "string",
    "ranks": {
      "id_config": [
        {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        }
      ],
      "id_ranks": {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "created": "string",
        "edit_status": "string",
        "fields": [
          "string"
        ],
        "modified": "string"
      }
    },
    "retention_settings": {
      "capacity": 0,
      "created": "string",
      "edit_status": "string",
      "keep_days": 0,
      "modified": "string"
    },
    "status": "live",
    "table": "string",
    "tag": "string",
    "version_number": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Get schema comparison

### Get schema comparison

**GET** `/v2/schema/{table}/compare`

Get a diff of two schema versions

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)
- **compare_id** (optional)
  Comparison Schema Version (defaults to previous)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "diff": [
      {
        "diff": [
          {
            "from_val": null,
            "property": "string",
            "to_val": null
          }
        ],
        "id": "string",
        "subject": "mapping",
        "verb": "created"
      }
    ],
    "from": {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    },
    "to": {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    }
  },
  "request_id": "string",
  "status": 0
}
```

## Evaluate Schema

### Evaluate Schema

**POST** `/v2/schema/{table}/evaluate`

Evaluate a schema against test events. Defaults to the draft; pass version\_id for a specific version, or patch\_id to evaluate a patch merged onto the live schema.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema version to evaluate. Defaults to the draft.
- **patch_id** (optional)
  Patch to evaluate, merged onto the live schema before evaluation. Alias of version\_id; if both are set, version\_id wins.

#### Headers

- **Authorization** (optional)

#### Sample Response

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

## Get fields

### Get fields

**GET** `/v2/schema/{table}/field`

Retrieve current fields

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **baccount_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)
- **filter** (optional)
  Types of field to return

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "assertions": {
        "email": true,
        "filter": [
          "string"
        ],
        "format": "alpha",
        "length": {
          "max": 0,
          "min": 0
        }
      },
      "capacity": 0,
      "created": "2019-08-24T14:15:22Z",
      "disable_indexing": true,
      "edit_status": "string",
      "id": "string",
      "id_config": {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "compact_after_days": 0,
        "compact_over": 0,
        "created": "string",
        "edit_status": "string",
        "field": "string",
        "many_to": [
          "string"
        ],
        "modified": "string"
      },
      "is_identifier": true,
      "is_pii": true,
      "keep_days": 0,
      "keep_duration": "string",
      "longdesc": "string",
      "managed_by": "string",
      "mergeop": "string",
      "modified": "string",
      "shortdesc": "string",
      "tags": [
        "string"
      ],
      "type": "string"
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Post field

### Post field

**POST** `/v2/schema/{table}/field`

Upsert a field in draft schema.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "assertions": {
      "email": true,
      "filter": [
        "string"
      ],
      "format": "alpha",
      "length": {
        "max": 0,
        "min": 0
      }
    },
    "capacity": 0,
    "created": "2019-08-24T14:15:22Z",
    "disable_indexing": true,
    "edit_status": "string",
    "id": "string",
    "id_config": {
      "changes": {
        "diff": [
          {
            "from_val": null,
            "property": "string",
            "to_val": null
          }
        ],
        "id": "string",
        "subject": "mapping",
        "verb": "created"
      },
      "compact_after_days": 0,
      "compact_over": 0,
      "created": "string",
      "edit_status": "string",
      "field": "string",
      "many_to": [
        "string"
      ],
      "modified": "string"
    },
    "is_identifier": true,
    "is_pii": true,
    "keep_days": 0,
    "keep_duration": "string",
    "longdesc": "string",
    "managed_by": "string",
    "mergeop": "string",
    "modified": "string",
    "shortdesc": "string",
    "tags": [
      "string"
    ],
    "type": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Get a field

### Get a field

**GET** `/v2/schema/{table}/field/{field_id}`

Retrieve a field by its ID

#### URL Parameters

- **table** (required)
  The table (e.g. user)
- **field_id** (required)
  ID of the Field

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "assertions": {
      "email": true,
      "filter": [
        "string"
      ],
      "format": "alpha",
      "length": {
        "max": 0,
        "min": 0
      }
    },
    "capacity": 0,
    "created": "2019-08-24T14:15:22Z",
    "disable_indexing": true,
    "edit_status": "string",
    "id": "string",
    "id_config": {
      "changes": {
        "diff": [
          {
            "from_val": null,
            "property": "string",
            "to_val": null
          }
        ],
        "id": "string",
        "subject": "mapping",
        "verb": "created"
      },
      "compact_after_days": 0,
      "compact_over": 0,
      "created": "string",
      "edit_status": "string",
      "field": "string",
      "many_to": [
        "string"
      ],
      "modified": "string"
    },
    "is_identifier": true,
    "is_pii": true,
    "keep_days": 0,
    "keep_duration": "string",
    "longdesc": "string",
    "managed_by": "string",
    "mergeop": "string",
    "modified": "string",
    "shortdesc": "string",
    "tags": [
      "string"
    ],
    "type": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Delete field

### Delete field

**DELETE** `/v2/schema/{table}/field/{field_id}`

Soft-delete a schema field from this draft, or hard-delete it if new.

#### URL Parameters

- **table** (required)
  The table (e.g. user)
- **field_id** (required)
  The field 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
}
```

## List all identity config

### List all identity config

**GET** `/v2/schema/{table}/idconfig`

List graph compaction and many-to-one merging configuration for all identity fields.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "changes": {
        "diff": [
          {
            "from_val": null,
            "property": "string",
            "to_val": null
          }
        ],
        "id": "string",
        "subject": "mapping",
        "verb": "created"
      },
      "compact_after_days": 0,
      "compact_over": 0,
      "created": "string",
      "edit_status": "string",
      "field": "string",
      "many_to": [
        "string"
      ],
      "modified": "string"
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Post ID config

### Post ID config

**POST** `/v2/schema/{table}/idconfig`

Create or update configuration for a single identity field.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "changes": {
      "diff": [
        {
          "from_val": null,
          "property": "string",
          "to_val": null
        }
      ],
      "id": "string",
      "subject": "mapping",
      "verb": "created"
    },
    "compact_after_days": 0,
    "compact_over": 0,
    "created": "string",
    "edit_status": "string",
    "field": "string",
    "many_to": [
      "string"
    ],
    "modified": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Get identity field config

### Get identity field config

**GET** `/v2/schema/{table}/idconfig/{field_id}`

Get graph compaction and many-to-one merging configuration for a single identity field.

#### URL Parameters

- **table** (required)
  The table (e.g. user)
- **field_id** (required)
  ID of the Identity Field

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "changes": {
      "diff": [
        {
          "from_val": null,
          "property": "string",
          "to_val": null
        }
      ],
      "id": "string",
      "subject": "mapping",
      "verb": "created"
    },
    "compact_after_days": 0,
    "compact_over": 0,
    "created": "string",
    "edit_status": "string",
    "field": "string",
    "many_to": [
      "string"
    ],
    "modified": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Delete ID Settings

### Delete ID Settings

**DELETE** `/v2/schema/{table}/idconfig/{field_id}`

Soft-delete graph compaction and many-to-one merging config from a single schema field, or hard-delete them if new.

#### URL Parameters

- **table** (required)
  The table (e.g. user)
- **field_id** (required)
  The field 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
}
```

## Get mappings

### Get mappings

**GET** `/v2/schema/{table}/mapping`

Retrive current mappings

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "created": "2019-08-24T14:15:22Z",
      "edit_status": "string",
      "expr": "string",
      "field": "string",
      "guard_expr": "string",
      "id": "string",
      "managed_by": "string",
      "modified": "2019-08-24T14:15:22Z",
      "stream": "string"
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Post mapping

### Post mapping

**POST** `/v2/schema/{table}/mapping`

Upsert a mapping in draft schema.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "created": "2019-08-24T14:15:22Z",
    "edit_status": "string",
    "expr": "string",
    "field": "string",
    "guard_expr": "string",
    "id": "string",
    "managed_by": "string",
    "modified": "2019-08-24T14:15:22Z",
    "stream": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Get a mapping

### Get a mapping

**GET** `/v2/schema/{table}/mapping/{mapping_id}`

Retrieve a mapping by ID

#### URL Parameters

- **table** (required)
  The table (e.g. user)
- **mapping_id** (required)
  ID of the Mapping

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "created": "2019-08-24T14:15:22Z",
    "edit_status": "string",
    "expr": "string",
    "field": "string",
    "guard_expr": "string",
    "id": "string",
    "managed_by": "string",
    "modified": "2019-08-24T14:15:22Z",
    "stream": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Delete mapping

### Delete mapping

**DELETE** `/v2/schema/{table}/mapping/{mapping_id}`

Soft-delete a data mapping from this draft, or hard-delete it if new.

#### URL Parameters

- **table** (required)
  The table (e.g. user)
- **mapping_id** (required)
  The mapping 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
}
```

## Publish schema

### Publish schema

**POST** `/v2/schema/{table}/publish`

Publish changes to your schema

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "created": "2019-08-24T14:15:22Z",
    "created_by": "string",
    "description": "string",
    "draft_status": "string",
    "fields": [
      {
        "assertions": {
          "email": true,
          "filter": [
            "string"
          ],
          "format": "alpha",
          "length": {
            "max": 0,
            "min": 0
          }
        },
        "capacity": 0,
        "created": "2019-08-24T14:15:22Z",
        "disable_indexing": true,
        "edit_status": "string",
        "id": "string",
        "id_config": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        },
        "is_identifier": true,
        "is_pii": true,
        "keep_days": 0,
        "keep_duration": "string",
        "longdesc": "string",
        "managed_by": "string",
        "mergeop": "string",
        "modified": "string",
        "shortdesc": "string",
        "tags": [
          "string"
        ],
        "type": "string"
      }
    ],
    "id": "string",
    "is_patch": true,
    "mappings": [
      {
        "created": "2019-08-24T14:15:22Z",
        "edit_status": "string",
        "expr": "string",
        "field": "string",
        "guard_expr": "string",
        "id": "string",
        "managed_by": "string",
        "modified": "2019-08-24T14:15:22Z",
        "stream": "string"
      }
    ],
    "modified": "2019-08-24T14:15:22Z",
    "parent_id": "string",
    "published_by": "string",
    "ranks": {
      "id_config": [
        {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        }
      ],
      "id_ranks": {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "created": "string",
        "edit_status": "string",
        "fields": [
          "string"
        ],
        "modified": "string"
      }
    },
    "retention_settings": {
      "capacity": 0,
      "created": "string",
      "edit_status": "string",
      "keep_days": 0,
      "modified": "string"
    },
    "status": "live",
    "table": "string",
    "tag": "string",
    "version_number": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Get rank

### Get rank

**GET** `/v2/schema/{table}/rank`

Retrieve current identifier rank list.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "changes": {
      "diff": [
        {
          "from_val": null,
          "property": "string",
          "to_val": null
        }
      ],
      "id": "string",
      "subject": "mapping",
      "verb": "created"
    },
    "created": "string",
    "edit_status": "string",
    "fields": [
      "string"
    ],
    "modified": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Post ID rank list

### Post ID rank list

**POST** `/v2/schema/{table}/rank`

Create or update identifier rank list.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "changes": {
      "diff": [
        {
          "from_val": null,
          "property": "string",
          "to_val": null
        }
      ],
      "id": "string",
      "subject": "mapping",
      "verb": "created"
    },
    "created": "string",
    "edit_status": "string",
    "fields": [
      "string"
    ],
    "modified": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Get retention settings

### Get retention settings

**GET** `/v2/schema/{table}/retentionsettings`

Retrieve current retention settings.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "capacity": 0,
    "created": "string",
    "edit_status": "string",
    "keep_days": 0,
    "modified": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Post retention settings

### Post retention settings

**POST** `/v2/schema/{table}/retentionsettings`

Create or update retention settings.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "capacity": 0,
    "created": "string",
    "edit_status": "string",
    "keep_days": 0,
    "modified": "string"
  },
  "request_id": "string",
  "status": 0
}
```

## Revert schema changes

### Revert schema changes

**POST** `/v2/schema/{table}/revert`

Restore an entire schema version to the state of the current live schema.

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **version_id** (optional)
  Schema Version to revert to. Defaults to the live version.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "created": "2019-08-24T14:15:22Z",
    "created_by": "string",
    "description": "string",
    "draft_status": "string",
    "fields": [
      {
        "assertions": {
          "email": true,
          "filter": [
            "string"
          ],
          "format": "alpha",
          "length": {
            "max": 0,
            "min": 0
          }
        },
        "capacity": 0,
        "created": "2019-08-24T14:15:22Z",
        "disable_indexing": true,
        "edit_status": "string",
        "id": "string",
        "id_config": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        },
        "is_identifier": true,
        "is_pii": true,
        "keep_days": 0,
        "keep_duration": "string",
        "longdesc": "string",
        "managed_by": "string",
        "mergeop": "string",
        "modified": "string",
        "shortdesc": "string",
        "tags": [
          "string"
        ],
        "type": "string"
      }
    ],
    "id": "string",
    "is_patch": true,
    "mappings": [
      {
        "created": "2019-08-24T14:15:22Z",
        "edit_status": "string",
        "expr": "string",
        "field": "string",
        "guard_expr": "string",
        "id": "string",
        "managed_by": "string",
        "modified": "2019-08-24T14:15:22Z",
        "stream": "string"
      }
    ],
    "modified": "2019-08-24T14:15:22Z",
    "parent_id": "string",
    "published_by": "string",
    "ranks": {
      "id_config": [
        {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "compact_after_days": 0,
          "compact_over": 0,
          "created": "string",
          "edit_status": "string",
          "field": "string",
          "many_to": [
            "string"
          ],
          "modified": "string"
        }
      ],
      "id_ranks": {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "created": "string",
        "edit_status": "string",
        "fields": [
          "string"
        ],
        "modified": "string"
      }
    },
    "retention_settings": {
      "capacity": 0,
      "created": "string",
      "edit_status": "string",
      "keep_days": 0,
      "modified": "string"
    },
    "status": "live",
    "table": "string",
    "tag": "string",
    "version_number": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Validate schema

### Validate schema

**GET** `/v2/schema/{table}/validate`

Run validation for schema

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

- **version_id** (optional)
  Schema Version (defaults to latest)

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "has_unpublished_changes": true,
      "id": "string",
      "parent_id": "string",
      "table": "string",
      "validation_errors": [
        "string"
      ],
      "version_number": 0
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Get schema history

### Get schema history

**GET** `/v2/schema/{table}/version`

Get a list of all schema versions in its history

#### URL Parameters

- **table** (required)
  The table (e.g. user)

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "created": "2019-08-24T14:15:22Z",
      "created_by": "string",
      "description": "string",
      "draft_status": "string",
      "fields": [
        {
          "assertions": {
            "email": true,
            "filter": [
              "string"
            ],
            "format": "alpha",
            "length": {
              "max": 0,
              "min": 0
            }
          },
          "capacity": 0,
          "created": "2019-08-24T14:15:22Z",
          "disable_indexing": true,
          "edit_status": "string",
          "id": "string",
          "id_config": {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          },
          "is_identifier": true,
          "is_pii": true,
          "keep_days": 0,
          "keep_duration": "string",
          "longdesc": "string",
          "managed_by": "string",
          "mergeop": "string",
          "modified": "string",
          "shortdesc": "string",
          "tags": [
            "string"
          ],
          "type": "string"
        }
      ],
      "id": "string",
      "is_patch": true,
      "mappings": [
        {
          "created": "2019-08-24T14:15:22Z",
          "edit_status": "string",
          "expr": "string",
          "field": "string",
          "guard_expr": "string",
          "id": "string",
          "managed_by": "string",
          "modified": "2019-08-24T14:15:22Z",
          "stream": "string"
        }
      ],
      "modified": "2019-08-24T14:15:22Z",
      "parent_id": "string",
      "published_by": "string",
      "ranks": {
        "id_config": [
          {
            "changes": {
              "diff": [
                {
                  "from_val": null,
                  "property": "string",
                  "to_val": null
                }
              ],
              "id": "string",
              "subject": "mapping",
              "verb": "created"
            },
            "compact_after_days": 0,
            "compact_over": 0,
            "created": "string",
            "edit_status": "string",
            "field": "string",
            "many_to": [
              "string"
            ],
            "modified": "string"
          }
        ],
        "id_ranks": {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "created": "string",
          "edit_status": "string",
          "fields": [
            "string"
          ],
          "modified": "string"
        }
      },
      "retention_settings": {
        "capacity": 0,
        "created": "string",
        "edit_status": "string",
        "keep_days": 0,
        "modified": "string"
      },
      "status": "live",
      "table": "string",
      "tag": "string",
      "version_number": 0
    }
  ],
  "request_id": "string",
  "status": 0
}
```