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

# Update an Event Domain

> Update an existing event domain, replacing its events and components.



## OpenAPI

````yaml https://api.hightouch.io/api/swagger.json patch /events/domains/{domainId}
openapi: 3.0.0
info:
  title: Hightouch API
  version: 1.0.0
  description: Hightouch Public Rest API to access syncs, models, sources and destinations
  contact:
    name: Hightouch
    url: https://hightouch.com
servers:
  - url: https://api.hightouch.com/api/v1
security: []
paths:
  /events/domains/{domainId}:
    patch:
      summary: Update an Event Domain
      description: Update an existing event domain, replacing its events and components.
      operationId: UpdateDomain
      parameters:
        - description: The domain's id
          in: path
          name: domainId
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventDomainUpdate'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/EventDomain'
                  - $ref: '#/components/schemas/ValidateErrorJSON'
                  - $ref: '#/components/schemas/InternalServerError'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
        '422':
          description: Validation Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateErrorJSON'
        '500':
          description: Something went wrong
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    EventDomainUpdate:
      description: The input for updating a Domain
      properties:
        name:
          type: string
          description: The domain's name
        slug:
          type: string
          description: The domain's slug. If not specified, one will be generated.
        description:
          type: string
          description: The domain's description
        onUndeclaredSchema:
          type: string
          enum:
            - ALLOW_EVENT
            - BLOCK_EVENT
          description: >-
            What happens to events that aren't defined in the domain.

            One of ALLOW_EVENT or BLOCK_EVENT. Optional, defaults to
            ALLOW_EVENT.
        events:
          items:
            properties:
              schema:
                properties: {}
                additionalProperties: {}
                type: object
                description: >-
                  The JSON schema that validates the event. Required. May
                  contain component `$ref`s.
              onUndeclaredFields:
                type: string
                enum:
                  - ALLOW_EVENT
                  - BLOCK_EVENT
                  - OMIT_FIELDS
                description: >-
                  What happens to events that contain fields not in the schema.

                  One of ALLOW_EVENT, BLOCK_EVENT, or OMIT_FIELDS. Optional,
                  defaults to OMIT_FIELDS.
              onSchemaViolation:
                type: string
                enum:
                  - ALLOW_EVENT
                  - BLOCK_EVENT
                description: >-
                  What happens to events that violate the schema.

                  One of ALLOW_EVENT or BLOCK_EVENT. Optional, defaults to
                  BLOCK_EVENT.
              version:
                type: string
                description: >-
                  The event version. Defaults to "default", optional. You
                  probably don't need to set this.
              slug:
                type: string
                description: The event's slug. If not specified, one will be generated.
              name:
                type: string
                description: The event's name. Required for track events.
              type:
                type: string
                enum:
                  - track
                  - identify
                  - page
                  - screen
                  - group
                description: >-
                  The event's type. One of track, identify, page, screen, or
                  group. Required.
            required:
              - schema
              - type
            type: object
          type: array
          description: The definitions for the events in the domain.
        components:
          items:
            $ref: '#/components/schemas/EventDomainComponent'
          type: array
          description: The reusable components defined in the domain.
      type: object
      additionalProperties: false
    EventDomain:
      description: A collection of event and component schemas used for validating events.
      properties:
        id:
          type: string
          description: The domain's id
        name:
          type: string
          description: The domain's name
        slug:
          type: string
          description: The domain's slug. If not specified, one will be generated.
        description:
          type: string
          description: The domain's description
        onUndeclaredSchema:
          type: string
          enum:
            - ALLOW_EVENT
            - BLOCK_EVENT
          description: >-
            What happens to events that aren't defined in the domain.

            One of ALLOW_EVENT or BLOCK_EVENT. Optional, defaults to
            ALLOW_EVENT.
        schemaVersionPath:
          items:
            type: string
          type: array
          description: >-
            Path into the event payload where the schema version is
            read/written.

            Used by codegen wrappers to inject the version they were generated
            from.
        events:
          items:
            properties:
              schema:
                properties: {}
                additionalProperties: {}
                type: object
                description: >-
                  The JSON schema that validates the event. Required. May
                  contain component `$ref`s.
              onUndeclaredFields:
                type: string
                enum:
                  - ALLOW_EVENT
                  - BLOCK_EVENT
                  - OMIT_FIELDS
                description: >-
                  What happens to events that contain fields not in the schema.

                  One of ALLOW_EVENT, BLOCK_EVENT, or OMIT_FIELDS. Optional,
                  defaults to OMIT_FIELDS.
              onSchemaViolation:
                type: string
                enum:
                  - ALLOW_EVENT
                  - BLOCK_EVENT
                description: >-
                  What happens to events that violate the schema.

                  One of ALLOW_EVENT or BLOCK_EVENT. Optional, defaults to
                  BLOCK_EVENT.
              version:
                type: string
                description: >-
                  The event version. Defaults to "default", optional. You
                  probably don't need to set this.
              slug:
                type: string
                description: The event's slug. If not specified, one will be generated.
              name:
                type: string
                description: The event's name. Required for track events.
              type:
                type: string
                enum:
                  - track
                  - identify
                  - page
                  - screen
                  - group
                description: >-
                  The event's type. One of track, identify, page, screen, or
                  group. Required.
            required:
              - schema
              - type
            type: object
          type: array
          description: The definitions for the events in the domain.
        components:
          items:
            $ref: '#/components/schemas/EventDomainComponent'
          type: array
          description: The reusable components defined in the domain.
        workspaceId:
          type: number
          format: double
          description: The id of the workspace that the domain belongs to
        createdAt:
          type: string
          format: date-time
          description: The timestamp when the domain was created
        updatedAt:
          type: string
          format: date-time
          description: The timestamp when the domain was last updated
        eventSources:
          items:
            properties:
              name:
                type: string
              id:
                type: string
            required:
              - name
              - id
            type: object
          type: array
          description: The Event Sources linked to the Domain.
      required:
        - id
        - name
        - workspaceId
        - createdAt
        - updatedAt
        - eventSources
      type: object
      additionalProperties: false
    ValidateErrorJSON:
      properties:
        message:
          type: string
          enum:
            - Validation failed
          nullable: false
        details:
          properties: {}
          additionalProperties: {}
          type: object
      required:
        - message
        - details
      type: object
      additionalProperties: false
    InternalServerError:
      type: string
      enum:
        - Internal Server Error
      nullable: false
    EventDomainComponent:
      description: Reusable schema fragments that can be imported by event schemas.
      properties:
        id:
          type: string
          description: >-
            The component's id. Omit when creating. On update, a component
            matches an existing one by id when supplied, otherwise by (name,
            version); include the id to rename a component in place.
        slug:
          type: string
          description: >-
            The component's slug. Optional when creating; generated from the
            name if omitted. Immutable after creation; an update that sends a
            different slug for an existing component is rejected.
        name:
          type: string
          description: The component's name. Required.
        version:
          type: string
          description: >-
            The component's version. Defaults to "default", optional. On update,
            an omitted version keeps the stored value when the component is
            matched by id; without an id, an omitted version only matches the
            stored "default" version, and the request is rejected if the name
            exists only under other versions.
        description:
          type: string
          description: >-
            The component's description. On update, an omitted description keeps
            the stored value; send an empty string to clear it.
        schema:
          properties: {}
          additionalProperties: {}
          type: object
          description: The JSON schema fragment the component contributes. Required.
        imports:
          items:
            type: string
          type: array
          description: >-
            Read-only: the slugs of the components this component imports
            (derived from its `$ref`s).
      required:
        - name
        - schema
      type: object
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer

````