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

> Update an existing event contract

Patch an event contract based on its Hightouch ID



## OpenAPI

````yaml https://api.hightouch.io/api/swagger.json patch /events/contracts/{contractId}
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/contracts/{contractId}:
    patch:
      summary: Update an Event Contract
      description: |-
        Update an existing event contract

        Patch an event contract based on its Hightouch ID
      operationId: UpdateContract
      parameters:
        - in: path
          name: contractId
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventContractUpdate'
            example:
              events:
                - type: track
                  name: Checked Out
                  onUndeclaredFields: BLOCK_EVENT
                  onSchemaViolation: BLOCK_EVENT
                  schema:
                    type: object
                    properties:
                      properties:
                        type: object
                        required:
                          - total
                        properties:
                          total:
                            type: number
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/EventContractUpdate'
                  - $ref: '#/components/schemas/ValidateErrorJSON'
                  - $ref: '#/components/schemas/InternalServerError'
              examples:
                Example 1:
                  value:
                    id: '1'
                    name: My Contract
                    workspaceId: 1
                    events:
                      - type: track
                        name: Checked Out
                        slug: track-checked-out
                        version: default
                        schema:
                          type: object
                          required:
                            - req
                          properties:
                            req:
                              type: string
                          description: ''
                        onSchemaViolation: ALLOW_EVENT
                        onUndeclaredFields: BLOCK_EVENT
                    onUndeclaredSchema: BLOCK_EVENT
                    eventSources:
                      - id: '1'
                        name: Marketing Site
                    createdAt: '2022-02-16T21:37:58.510Z'
                    updatedAt: '2022-02-16T21:37:58.510Z'
        '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:
    EventContractUpdate:
      description: The input for updating a Contract
      properties:
        name:
          type: string
          description: The contract's name
        slug:
          type: string
          description: The contract's slug. If not specified, one will be generated.
        description:
          type: string
          description: The contract's description
        onUndeclaredSchema:
          type: string
          enum:
            - ALLOW_EVENT
            - BLOCK_EVENT
          description: >-
            What happens to events that aren't defined in the contract.

            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.
              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 contract.
      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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer

````