---
title: "Update schema with LQL query"
method: POST
path: "/schema/lql"
tags: ["Schema"]
---

# Update schema with LQL query

`POST /schema/lql`

## Request

- Base URL: `https://api.lytics.io/v2`
- URL: `https://api.lytics.io/v2/schema/lql`
- Auth: API key in header `Authorization`

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

## Query parameters

- `account_id` string

## Request body `application/text`

- string

## Response `200`

Upserted fields and mappings

- object
  - `_meta` object: Response Metadata
  - `data` object: Response Payload
    - `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
    - `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
  - `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/lql/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)
