---
title: "Schema Patches"
description: "<p>Stage, review, and apply versioned changes to a table's schema.</p>"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/schema-patches"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-05"
---

# Schema Patches

Stage, review, and apply versioned changes to a table's schema.

## Migrate drafts to patches

### Migrate drafts to patches

**POST** `/v2/schema/patch/migrate`

Captures each table's existing draft delta as a new patch titled "Migrated Draft Changes" and enables schema patches on the account.

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "enable_schema_patches": true,
    "patches": [
      {
        "patch_id": "string",
        "table": "string"
      }
    ]
  },
  "request_id": "string",
  "status": 0
}
```

## List schema patches

### List schema patches

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

Retrieves all patches for the specified table with diff information.

#### URL Parameters

- **table** (required)
  Table name

#### 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,
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "configuration_error": "string",
          "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": [
        {
          "changes": {
            "diff": [
              {
                "from_val": null,
                "property": "string",
                "to_val": null
              }
            ],
            "id": "string",
            "subject": "mapping",
            "verb": "created"
          },
          "configuration_error": "string",
          "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
}
```

## Create schema patch

### Create schema patch

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

Creates a new patch for the table. Tag and description are optional; a tag is required later, at apply time. Tag is capped at 264 characters.

#### URL Parameters

- **table** (required)
  Table name

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```

## Revert schema to a version (as a patch)

### Revert schema to a version (as a patch)

**POST** `/v2/schema/patch/{table}/revert-to-version`

Creates a patch that reverts the live schema to the given published version, for the user to review and publish. Non-destructive until published.

#### URL Parameters

- **table** (required)
  Table name

#### Query Parameters

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

#### Headers

- **Authorization** (optional)

#### Sample Response

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

## Get schema patch

### Get schema patch

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

Retrieves a specific patch for the schema with diff information.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```

## Update schema patch

### Update schema patch

**POST** `/v2/schema/patch/{table}/{id}`

Updates an existing patch with fields and mappings. If the patch ID does not exist, a new patch is created; tag and description are optional. Tag is capped at 264 characters. On update, sending a field as an empty string clears it, while omitting the field leaves it unchanged.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```

## Delete schema patch

### Delete schema patch

**DELETE** `/v2/schema/patch/{table}/{id}`

Deletes a patch. The patch must not be locked (applied) to be deleted.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch 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
}
```

## Apply schema patch

### Apply schema patch

**POST** `/v2/schema/patch/{table}/{id}/apply`

Applies (publishes) a patch to make it the live schema. Once applied, the patch becomes locked. A tag is required, capped at 264 characters: supply one via the optional VersionCommit body, otherwise the patch's stored tag is used; applying with neither returns 400.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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
}
```

## Batch discard patch fields and mappings

### Batch discard patch fields and mappings

**POST** `/v2/schema/patch/{table}/{id}/discard`

Reverts the listed field and mapping deltas to their live definitions in one atomic (all-or-nothing) request, matching the single-item discard per item. An id not present in the patch is a no-op. A still-published identifier keeps its rank-list membership; a net-new identifier added in the patch is removed from the rank list along with its field.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```

## Create patch field

### Create patch field

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

Creates or updates a field in a patch.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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 patch field

### Get patch field

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

Retrieves a specific field from a patch. If the field is not in the patch, retrieves it from the live schema.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID
- **field_id** (required)
  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": {
    "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
}
```

## Update, remove, or delete patch field

### Update, remove, or delete patch field

**POST** `/v2/schema/patch/{table}/{id}/field/{field_id}`

Updates an existing field, removes a field from a patch (remove=true), or marks a field for deletion when the patch is applied (delete=true).

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID
- **field_id** (required)
  Field ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **remove** (optional)
  Remove field from patch (undo changes)
- **delete** (optional)
  Mark field for deletion when patch is applied

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```

## Create patch mapping

### Create patch mapping

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

Creates or updates a mapping in a patch.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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 patch mapping

### Get patch mapping

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

Retrieves a specific mapping from a patch. If the mapping is not in the patch, retrieves it from the live schema.

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID
- **mapping_id** (required)
  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": {
    "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
}
```

## Update, remove, or delete patch mapping

### Update, remove, or delete patch mapping

**POST** `/v2/schema/patch/{table}/{id}/mapping/{mapping_id}`

Updates an existing mapping, removes a mapping from a patch (remove=true), or marks a mapping for deletion when the patch is applied (delete=true).

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID
- **mapping_id** (required)
  Mapping ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **remove** (optional)
  Remove mapping from patch (undo changes)
- **delete** (optional)
  Mark mapping for deletion when patch is applied

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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 patch rank list

### Get patch rank list

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

Retrieves the identifier rank list for a patch, returned within the full patch (with diff information).

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```

## Set patch rank list

### Set patch rank list

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

Sets the identifier rank list for a patch, or removes it (remove=true).

#### URL Parameters

- **table** (required)
  Table name
- **id** (required)
  Patch ID

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **remove** (optional)
  Remove the rank list from the patch

#### 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,
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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": [
      {
        "changes": {
          "diff": [
            {
              "from_val": null,
              "property": "string",
              "to_val": null
            }
          ],
          "id": "string",
          "subject": "mapping",
          "verb": "created"
        },
        "configuration_error": "string",
        "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
}
```