---
title: "Revert schema changes"
method: POST
path: "/schema/{table}/revert"
tags: ["Schema"]
---

# Revert schema changes

`POST /schema/{table}/revert`

## Request

- Base URL: `https://api.lytics.io/v2`
- URL: `https://api.lytics.io/v2/schema/{table}/revert`
- Auth: API key in header `Authorization`

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

## Path parameters

- `table` string, required

## Query parameters

- `account_id` string
- `version_id` string

## Response `200`

OK

- object
  - `_meta` object: Response Metadata
  - `data` object: Response Payload
    - `created` string, date-time
    - `created_by` string
    - `description` string
    - `draft_status` string
    - `fields` ModelsField[]
      - `assertions` ModelsAssertions
        - `email` boolean: Asserts that the field is an email address
        - `filter` string[]: []string is the type of v2schema.Filter
        - `format` 'alpha' | 'alphanumeric' | 'uuid' | 'base64' | 'hex' | 'int' | 'any': Asserts the format of string fields. If this is set to any value other than "any", the incoming data will be validated against the specified format for all mappings to this field. If the format does not match, the mapping will ignore the input.
        - `length` object
          - `max` integer: Maximum length of the field
          - `min` integer: Minimum length of the field
      - `capacity` integer: Specifies the capacity for fields of type set or map
      - `created` string, date-time
      - `disable_indexing` boolean
      - `edit_status` string
      - `id` string: ID, or name of field
      - `id_config` ModelsIDConfig
        - `changes` V2schemadiffSchemaChange
          - `diff` V2schemadiffDiff[]: Diff will be empty if verb is "created" or "removed".
            - `from_val` unknown
            - `property` string: Property can be field type, mapping expression, etc.
            - `to_val` unknown
          - `id` string: ID will be field name, mapping ID, rank setting field, or empty for "rank" source type.
          - `subject` 'mapping' | 'field' | 'rank' | 'rank_setting'
          - `verb` 'created' | 'removed' | 'modified'
        - `compact_after_days` integer
        - `compact_over` integer
        - `created` string
        - `edit_status` string
        - `field` string
        - `many_to` string[]
        - `modified` string
      - `is_identifier` boolean
      - `is_pii` boolean
      - `keep_days` integer: TTL for fields of type set or map, in days
      - `keep_duration` string: TTL for field of type set or map, must match keep_days if both are defined ie: 7d
      - `longdesc` string
      - `managed_by` string
      - `mergeop` string
      - `modified` string
      - `shortdesc` string
      - `tags` string[]
      - `type` string
    - `id` string: UUID for this schema version
    - `is_patch` boolean
    - `mappings` ModelsMapping[]
      - `created` string, date-time
      - `edit_status` string
      - `expr` string: The LQL expression for the mapping
      - `field` string, required: The target field of the mapping
      - `guard_expr` string: The LQL Guard expression for the mapping
      - `id` string: The ID of the mapping
      - `managed_by` string
      - `modified` string, date-time
      - `stream` string: The stream associated with the mapping
    - `modified` string, date-time
    - `parent_id` string
    - `published_by` string
    - `ranks` ModelsRanks
      - `id_config` ModelsIDConfig[]
        - `changes` V2schemadiffSchemaChange
          - `diff` V2schemadiffDiff[]: Diff will be empty if verb is "created" or "removed".
            - `from_val` unknown
            - `property` string: Property can be field type, mapping expression, etc.
            - `to_val` unknown
          - `id` string: ID will be field name, mapping ID, rank setting field, or empty for "rank" source type.
          - `subject` 'mapping' | 'field' | 'rank' | 'rank_setting'
          - `verb` 'created' | 'removed' | 'modified'
        - `compact_after_days` integer
        - `compact_over` integer
        - `created` string
        - `edit_status` string
        - `field` string
        - `many_to` string[]
        - `modified` string
      - `id_ranks` ModelsRankList
        - `changes` V2schemadiffSchemaChange
          - `diff` V2schemadiffDiff[]: Diff will be empty if verb is "created" or "removed".
            - `from_val` unknown
            - `property` string: Property can be field type, mapping expression, etc.
            - `to_val` unknown
          - `id` string: ID will be field name, mapping ID, rank setting field, or empty for "rank" source type.
          - `subject` 'mapping' | 'field' | 'rank' | 'rank_setting'
          - `verb` 'created' | 'removed' | 'modified'
        - `created` string
        - `edit_status` string
        - `fields` string[]
        - `modified` string
    - `retention_settings` ModelsRetentionSettings
      - `capacity` integer
      - `created` string
      - `edit_status` string
      - `keep_days` integer
      - `modified` string
    - `status` 'live' | 'draft' | 'archived'
    - `table` string
    - `tag` string
    - `version_number` integer
  - `request_id` string
  - `status` integer: HTTP Status Code

## Other responses

- `400`: Bad Request
- `404`: Not Found
- `500`: Internal Server Error

## Changes

- **2026-11-03** `d8e975057aec`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/lytics/apis/lytics-api/changes/schema/:table/revert/post.md)

---

[API](https://skmtc.dev/lytics/apis/lytics-api.md) - [All operations](https://skmtc.dev/lytics/apis/lytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lytics/apis/lytics-api/revisions/d8e975057aec?raw)
