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

# Create Schema

> Creates a new schema definition



## OpenAPI

````yaml POST /partner/schema-definitions
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:
    post:
      tags:
        - Schema Definitions
      summary: Create Schema
      description: Creates a new schema definition
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  pattern: ^[a-zA-Z0-9_-]+$
                  description: >-
                    The name of the schema, can be used in API calls to refer to
                    this schema. Cannot be changed once the schema is created
                plural_name:
                  type: string
                  minLength: 1
                  pattern: ^[a-zA-Z0-9_-]+$
                  description: >-
                    [Deprecated] Please use pluralName instead. The plural name
                    of the schema, can be used in API calls to refer to this
                    schema. Cannot be changed once the schema is created
                pluralName:
                  type: string
                  minLength: 1
                  pattern: ^[a-zA-Z0-9_-]+$
                  description: >-
                    The plural name of the schema, can be used in API calls to
                    refer to this schema. Cannot be changed once the schema is
                    created
                description:
                  type: string
                  minLength: 1
                  description: The description of the schema
                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 once the
                    schema is created. options: contacts_schema,
                    transactions_schema, custom_schema, combined_schema,
                    locations_schema, customer_fields
                external_id_field:
                  type: string
                  minLength: 1
                  description: >-
                    [Deprecated] Please use externalIdField instead. The field
                    in the schema that is used as the unique ID in the partner
                    system. Cannot be changed once the schema is created
                externalIdField:
                  type: string
                  minLength: 1
                  description: >-
                    The field in the schema that is used as the unique ID in the
                    partner system. Cannot be changed once the schema is created
                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.
              required:
                - name
                - description
                - category
                - schema
              additionalProperties: false
      responses:
        '201':
          description: Status 201 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

````