---
title: "Schema Bulk Upsert"
method: PUT
path: "/schema/bulk"
tags: ["Schema"]
---

# Schema Bulk Upsert

`PUT /schema/bulk`

## Request

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

Schema bulk upsert creates/updates multiple schema objects. It does not delete any existing schema objects.

## Query parameters

- `account_id` string

## Request body

- ModelsSchemaResponse
  - `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

## Response `200`

Schema Version Diff

- object
  - `_meta` object: Response Metadata
  - `data` object: Response Payload
    - `diff` 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'
    - `from` ModelsSchemaResponse
      - `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".
              - …
            - `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".
              - …
            - `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".
              - …
            - `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
    - `to` ModelsSchemaResponse
      - `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".
              - …
            - `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".
              - …
            - `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".
              - …
            - `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
- `500`: Internal Server Error

## Changes

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

[Operation history](https://skmtc.dev/lytics/apis/lytics-api/changes/schema/bulk/put.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)
