---
title: "Update, remove, or delete patch mapping"
method: POST
path: "/schema/patch/{table}/{id}/mapping/{mapping_id}"
tags: ["Schema Patches"]
---

# Update, remove, or delete patch mapping

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

## Request

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

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).

## Path parameters

- `table` string, required
- `id` string, required
- `mapping_id` string, required

## Query parameters

- `account_id` string
- `remove` boolean
- `delete` boolean

## Request body

- 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

## Response `200`

Updated patch with diff information

- object
  - `_meta` object: Response Metadata
  - `data` object: Response Payload
    - `created` string, date-time
    - `created_by` string
    - `description` string
    - `draft_status` string
    - `fields` ModelsFieldWithChanges[]
      - `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
      - `changes` ModelsSchemaChange
        - `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'
      - `configuration_error` string: ConfigurationError carries a per-item validation error string for fields in a patch context. Empty when the field is valid (or unmodified — unmodified items inherit from live and are not re-validated). Set by enrichPatchWithDiff when it re-runs ValidateUpsert against the merged schema at GET time.
      - `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` ModelsMappingWithChanges[]
      - `changes` ModelsSchemaChange
        - `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'
      - `configuration_error` string: ConfigurationError carries a per-item validation error string for mappings in a patch context. Empty when the mapping is valid (or unmodified). Set by enrichPatchWithDiff when it re-runs ValidateUpsert against the merged schema at GET time.
      - `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
- `401`: Unauthorized
- `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/patch/:table/:id/mapping/:mapping_id/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)
