> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedreach.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Schema

> Updates an existing schema definition. The update can take up to 3 mins to take effect.



## OpenAPI

````yaml POST /partner/schema-definitions/{schemaIdOrName}
openapi: 3.0.0
info:
  title: Reach API
  version: 1.0.0
  description: API documentation for Reach platform
servers:
  - url: https://api.embedreach.com
    description: Production server
security: []
paths:
  /partner/schema-definitions/{schemaIdOrName}:
    post:
      tags:
        - Schema Definitions
      summary: Update Schema
      description: >-
        Updates an existing schema definition. The update can take up to 3 mins
        to take effect.
      parameters:
        - schema:
            type: string
            description: The ID or name of the schema definition to update
          required: true
          description: The ID or name of the schema definition to update
          name: schemaIdOrName
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                description:
                  type: string
                  description: The description of the schema
                schema:
                  type: object
                  properties: {}
                  description: The JSONSchema schema definition for the resource
                fieldsToExpose:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        description: The name of the field
                      description:
                        type: string
                        description: The description of the field
                      jsonPath:
                        type: string
                        description: >-
                          The JSON path to the field in the custom resource
                          (e.g. .user.rewards.points for the json { "user": {
                          "rewards": { "points": 100 } } })
                      exposure:
                        type: array
                        items:
                          type: string
                          enum:
                            - segments
                            - merge-fields
                        description: >-
                          How to expose this field, is it available in segments,
                          email builder, etc.
                    required:
                      - name
                      - jsonPath
                      - exposure
                  description: The fields to expose on the segment builder or merge fields.
                exposeNameJsonPath:
                  type: string
                  description: >-
                    The JSON path to the field in the schema that will be used
                    to expose the resource to the user. If not provided, the
                    resource will not be exposed to the user.
                external_id_field:
                  type: string
                  description: >-
                    [Deprecated] Please use externalIdField instead. The field
                    in the schema that is used as the unique ID in the partner
                    system.
                externalIdField:
                  type: string
                  description: >-
                    The field in the schema that is used as the unique ID in the
                    partner system.
                category:
                  type: string
                  enum:
                    - contacts_schema
                    - transactions_schema
                    - custom_schema
                    - combined_schema
                    - locations_schema
                    - customer_fields
                  description: >-
                    The category of the schema. Cannot be changed if it is used
                    in active schema mappings.
              additionalProperties: false
      responses:
        '200':
          description: Status 200 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Unique identifier for the schema definition
                      platform_id:
                        type: string
                        format: uuid
                        description: Platform ID this schema belongs to
                      name:
                        type: string
                        description: Name of the schema
                      plural_name:
                        type: string
                        description: >-
                          [Deprecated] Please use pluralName instead. Plural
                          name of the schema
                      pluralName:
                        type: string
                        description: Plural name of the schema
                      description:
                        type: string
                        nullable: true
                        description: Description of the schema
                      category:
                        type: string
                        enum:
                          - contacts_schema
                          - transactions_schema
                          - custom_schema
                          - combined_schema
                          - locations_schema
                          - customer_fields
                        description: Schema category
                      version_number:
                        type: number
                        description: >-
                          [Deprecated] Please use versionNumber instead. Schema
                          version number
                      versionNumber:
                        type: number
                        description: Schema version number
                      dataConnectionId:
                        type: string
                        format: uuid
                        description: Data connection ID for the schema
                      source_query:
                        type: string
                        description: >-
                          [Deprecated] Please use sourceQuery instead. Source
                          query for the schema
                      sourceQuery:
                        type: string
                        description: Source query for the schema
                      reference_schemas:
                        type: array
                        nullable: true
                        items:
                          type: string
                        description: >-
                          [Deprecated] Please use referenceSchemas instead.
                          References to other schemas
                      referenceSchemas:
                        type: array
                        nullable: true
                        items:
                          type: string
                        description: References to other schemas
                      schema:
                        type: object
                        additionalProperties:
                          nullable: true
                        description: The actual JSON schema definition
                      external_id_field:
                        type: string
                        description: >-
                          [Deprecated] Please use externalIdField instead. Field
                          used for external ID references
                      externalIdField:
                        type: string
                        description: Field used for external ID references
                      deactivated_at:
                        type: string
                        nullable: true
                        description: >-
                          [Deprecated] Please use deactivatedAt instead. When
                          this schema was deactivated
                      deactivatedAt:
                        type: string
                        nullable: true
                        description: When this schema was deactivated
                      created_at:
                        type: string
                        description: >-
                          [Deprecated] Please use createdAt instead. Creation
                          timestamp
                      createdAt:
                        type: string
                        description: Creation timestamp
                      updated_at:
                        type: string
                        description: >-
                          [Deprecated] Please use updatedAt instead. Last update
                          timestamp
                      updatedAt:
                        type: string
                        description: Last update timestamp
                      fieldsToExpose:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              description: The name of the field
                            description:
                              type: string
                              description: The description of the field
                            jsonPath:
                              type: string
                              description: >-
                                The JSON path to the field in the custom
                                resource (e.g. .user.rewards.points for the json
                                { "user": { "rewards": { "points": 100 } } })
                            exposure:
                              type: array
                              items:
                                type: string
                                enum:
                                  - segments
                                  - merge-fields
                              description: >-
                                How to expose this field, is it available in
                                segments, email builder, etc.
                          required:
                            - name
                            - jsonPath
                            - exposure
                        description: Fields to expose
                      exposeNameJsonPath:
                        type: string
                        description: >-
                          The JSON path to the field in the schema that will be
                          used to expose the resource to the user. If not
                          provided, the resource will not be exposed to the
                          user.
                    required:
                      - id
                      - platform_id
                      - name
                      - plural_name
                      - pluralName
                      - description
                      - category
                      - version_number
                      - versionNumber
                      - reference_schemas
                      - referenceSchemas
                      - schema
                      - external_id_field
                      - externalIdField
                      - created_at
                      - createdAt
                      - updated_at
                      - updatedAt
                      - fieldsToExpose
                required:
                  - success
        '400':
          description: Bad Request - Validation or request error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    default: false
                  message:
                    type: string
                    description: Error message describing what went wrong
                  errors:
                    type: array
                    items:
                      type: string
                    description: Optional array of specific validation errors
                required:
                  - message
        '409':
          description: Status 409 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        enum:
                          - >-
                            Cannot remove fields that are in use by existing
                            resources
                        description: Error title
                      message:
                        type: string
                        description: Explanation of the error and potential solutions
                      conflicts:
                        type: array
                        items:
                          type: object
                          properties:
                            field:
                              type: string
                              description: The field being removed that contains data
                            resourceExternalIds:
                              type: array
                              items:
                                type: string
                              description: External IDs of resources with this field in use
                          required:
                            - field
                            - resourceExternalIds
                        description: Details of field conflicts
                    required:
                      - error
                      - message
                      - conflicts
                required:
                  - success

````