---
updatedAt: 2026-08-07T20:28:07.000Z
agentTools:
  projectIndex: https://docs.lytics.com/llms.txt
---

# Get schema patch

Retrieves a specific patch for the schema with diff information.

# OpenAPI definition

```json
{
  "components": {
    "schemas": {
      "lioerrors.ApiV2ErrorOut": {
        "properties": {
          "code": {
            "description": "Lytics Error Code",
            "enum": [
              "UNKNOWN-000",
              "BADREQ-001",
              "JOB-BADREQ-002",
              "NOTFOUND-003",
              "JOB-NOTFOUND-004",
              "WF-NOTFOUND-005",
              "AUTH-NOTFOUND-006",
              "AUTHTYPE-NOTFOUND-007",
              "AUTH-BADREQ-008",
              "TABLE-NOTFOUND-009",
              "SCHEMA-NOTFOUND-010",
              "SCHEMAVERSION-NOTFOUND-011",
              "ENTITY-NOTFOUND-012",
              "QUERY-NOTFOUND-013",
              "STREAM-NOTFOUND-014",
              "PROVIDER-BADREQ-015",
              "PROVIDER-NOTFOUND-016",
              "UNAUTHORIZED-017",
              "SCHEMA-INVALID-018",
              "INTERNAL-019",
              "ROUTERULE-NOTFOUND-020",
              "ACCOUNT-NOTFOUND-021",
              "JOB-FAULT-022",
              "USER-NOTFOUND-023",
              "USER-BADREQ-024",
              "JSON-BADREQ-025",
              "FORBIDDEN-026"
            ],
            "type": "string"
          },
          "level": {
            "description": "When the error was generated",
            "type": "string"
          },
          "message": {
            "description": "A description of the error that occurred",
            "type": "string"
          },
          "timestamp": {
            "description": "The time the error occurred",
            "format": "date-time",
            "type": "string"
          }
        },
        "type": "object"
      },
      "models.ApiErrorResponse": {
        "properties": {
          "errors": {
            "description": "Lytics API Errors",
            "items": {
              "$ref": "#/components/schemas/lioerrors.ApiV2ErrorOut"
            },
            "type": "array"
          },
          "request_id": {
            "type": "string"
          },
          "status": {
            "description": "HTTP Status Code",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "models.ApiResponse": {
        "properties": {
          "_meta": {
            "additionalProperties": true,
            "description": "Response Metadata",
            "type": "object"
          },
          "data": {
            "description": "Response Payload",
            "type": "object"
          },
          "request_id": {
            "type": "string"
          },
          "status": {
            "description": "HTTP Status Code",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "models.Assertions": {
        "properties": {
          "email": {
            "description": "Asserts that the field is an email address",
            "type": "boolean"
          },
          "filter": {
            "description": "[]string is the type of v2schema.Filter",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "format": {
            "description": "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.",
            "enum": [
              "alpha",
              "alphanumeric",
              "uuid",
              "base64",
              "hex",
              "int",
              "any"
            ],
            "type": "string"
          },
          "length": {
            "properties": {
              "max": {
                "description": "Maximum length of the field",
                "type": "integer"
              },
              "min": {
                "description": "Minimum length of the field",
                "type": "integer"
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "models.FieldWithChanges": {
        "properties": {
          "assertions": {
            "$ref": "#/components/schemas/models.Assertions"
          },
          "capacity": {
            "description": "Specifies the capacity for fields of type set or map",
            "type": "integer"
          },
          "changes": {
            "$ref": "#/components/schemas/models.SchemaChange"
          },
          "configuration_error": {
            "description": "ConfigurationError carries a per-item validation error string for fields\nin a patch context. Empty when the field is valid (or unmodified — unmodified\nitems inherit from live and are not re-validated). Set by enrichPatchWithDiff\nwhen it re-runs ValidateUpsert against the merged schema at GET time.",
            "type": "string"
          },
          "created": {
            "format": "date-time",
            "type": "string"
          },
          "disable_indexing": {
            "type": "boolean"
          },
          "edit_status": {
            "type": "string"
          },
          "id": {
            "description": "ID, or name of field",
            "type": "string"
          },
          "id_config": {
            "$ref": "#/components/schemas/models.IDConfig"
          },
          "is_identifier": {
            "type": "boolean"
          },
          "is_pii": {
            "type": "boolean"
          },
          "keep_days": {
            "description": "TTL for fields of type set or map, in days",
            "type": "integer"
          },
          "keep_duration": {
            "description": "TTL for field of type set or map, must match keep_days if both are defined ie: 7d",
            "type": "string"
          },
          "longdesc": {
            "type": "string"
          },
          "managed_by": {
            "type": "string"
          },
          "mergeop": {
            "type": "string"
          },
          "modified": {
            "type": "string"
          },
          "shortdesc": {
            "type": "string"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "models.IDConfig": {
        "properties": {
          "changes": {
            "$ref": "#/components/schemas/v2schemadiff.SchemaChange"
          },
          "compact_after_days": {
            "type": "integer"
          },
          "compact_over": {
            "type": "integer"
          },
          "created": {
            "type": "string"
          },
          "edit_status": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "many_to": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "modified": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "models.MappingWithChanges": {
        "properties": {
          "changes": {
            "$ref": "#/components/schemas/models.SchemaChange"
          },
          "configuration_error": {
            "description": "ConfigurationError carries a per-item validation error string for mappings\nin a patch context. Empty when the mapping is valid (or unmodified). Set by\nenrichPatchWithDiff when it re-runs ValidateUpsert against the merged schema\nat GET time.",
            "type": "string"
          },
          "created": {
            "format": "date-time",
            "type": "string"
          },
          "edit_status": {
            "type": "string"
          },
          "expr": {
            "description": "The LQL expression for the mapping",
            "type": "string"
          },
          "field": {
            "description": "The target field of the mapping",
            "type": "string"
          },
          "guard_expr": {
            "description": "The LQL Guard expression for the mapping",
            "type": "string"
          },
          "id": {
            "description": "The ID of the mapping",
            "type": "string"
          },
          "managed_by": {
            "type": "string"
          },
          "modified": {
            "format": "date-time",
            "type": "string"
          },
          "stream": {
            "description": "The stream associated with the mapping",
            "type": "string"
          }
        },
        "required": [
          "field"
        ],
        "type": "object"
      },
      "models.RankList": {
        "properties": {
          "changes": {
            "$ref": "#/components/schemas/v2schemadiff.SchemaChange"
          },
          "created": {
            "type": "string"
          },
          "edit_status": {
            "type": "string"
          },
          "fields": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "modified": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "models.Ranks": {
        "properties": {
          "id_config": {
            "items": {
              "$ref": "#/components/schemas/models.IDConfig"
            },
            "type": "array"
          },
          "id_ranks": {
            "$ref": "#/components/schemas/models.RankList"
          }
        },
        "type": "object"
      },
      "models.RetentionSettings": {
        "properties": {
          "capacity": {
            "type": "integer"
          },
          "created": {
            "type": "string"
          },
          "edit_status": {
            "type": "string"
          },
          "keep_days": {
            "type": "integer"
          },
          "modified": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "models.SchemaChange": {
        "properties": {
          "diff": {
            "description": "Diff will be empty if verb is \"created\" or \"removed\".",
            "items": {
              "$ref": "#/components/schemas/v2schemadiff.Diff"
            },
            "type": "array"
          },
          "id": {
            "description": "ID will be field name, mapping ID, rank setting\n field, or empty for \"rank\" source type.",
            "type": "string"
          },
          "subject": {
            "enum": [
              "mapping",
              "field",
              "rank",
              "rank_setting"
            ],
            "type": "string"
          },
          "verb": {
            "enum": [
              "created",
              "removed",
              "modified"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "models.SchemaPatchResponse": {
        "properties": {
          "created": {
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "draft_status": {
            "type": "string"
          },
          "fields": {
            "items": {
              "$ref": "#/components/schemas/models.FieldWithChanges"
            },
            "type": "array"
          },
          "id": {
            "description": "UUID for this schema version",
            "type": "string"
          },
          "is_patch": {
            "type": "boolean"
          },
          "mappings": {
            "items": {
              "$ref": "#/components/schemas/models.MappingWithChanges"
            },
            "type": "array"
          },
          "modified": {
            "format": "date-time",
            "type": "string"
          },
          "parent_id": {
            "type": "string"
          },
          "published_by": {
            "type": "string"
          },
          "ranks": {
            "$ref": "#/components/schemas/models.Ranks"
          },
          "retention_settings": {
            "$ref": "#/components/schemas/models.RetentionSettings"
          },
          "status": {
            "enum": [
              "live",
              "draft",
              "archived"
            ],
            "type": "string"
          },
          "table": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "version_number": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "v2schemadiff.Diff": {
        "properties": {
          "from_val": {},
          "property": {
            "description": "Property can be field type, mapping expression, etc.",
            "type": "string"
          },
          "to_val": {}
        },
        "type": "object"
      },
      "v2schemadiff.SchemaChange": {
        "properties": {
          "diff": {
            "description": "Diff will be empty if verb is \"created\" or \"removed\".",
            "items": {
              "$ref": "#/components/schemas/v2schemadiff.Diff"
            },
            "type": "array"
          },
          "id": {
            "description": "ID will be field name, mapping ID, rank setting\n field, or empty for \"rank\" source type.",
            "type": "string"
          },
          "subject": {
            "enum": [
              "mapping",
              "field",
              "rank",
              "rank_setting"
            ],
            "type": "string"
          },
          "verb": {
            "enum": [
              "created",
              "removed",
              "modified"
            ],
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "contact": {
      "email": "support@lytics.com",
      "name": "Lytics Support",
      "url": "https://support.lytics.com/hc/en-us"
    },
    "description": "Version 2 of the Lytics API",
    "termsOfService": "https://www.lytics.com/terms-of-service/",
    "title": "Lytics API",
    "version": "2.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/schema/patch/{table}/{id}": {
      "get": {
        "description": "Retrieves a specific patch for the schema with diff information.",
        "parameters": [
          {
            "description": "The account ID. Defaults to the user's default account.",
            "in": "query",
            "name": "account_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Table name",
            "in": "path",
            "name": "table",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Patch ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/models.ApiResponse"
                    },
                    {
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/models.SchemaPatchResponse"
                        }
                      },
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Patch with diff information"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/models.ApiErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/models.ApiErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/models.ApiErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/models.ApiErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get schema patch",
        "tags": [
          "Schema Patches"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://api.lytics.io/v2"
    }
  ],
  "tags": [
    {
      "description": "Stage, review, and apply versioned changes to a table's schema.",
      "name": "Schema Patches"
    }
  ]
}
```