---
title: "Update an event schema"
method: PATCH
path: "/event_schema/{event_schema_name}"
tags: ["Event Schemas"]
---

# Update an event schema

`PATCH /event_schema/{event_schema_name}`

Update an event schema and add new attributes and dimensions

Once an event schema is activated, you cannot update or delete existing attributes and dimensions however you can add new attributes and dimensions and update event schema description.
    operationId: updateEventSchema

## Path parameters

- `event_schema_name` string, required

## Request body

- UpdateEventSchemaRequest — Request to update event schema
  - `description` string — Description of the event
  - `attributes` EventAttributeSchema[]
    - `name` string, required — Name of the event attribute.
    - `defaultUnit` string — Unit for the attribute
  - `dimensions` DimensionsSchema[]
    - `name` string, required — Name of the event dimension
  - `enrichments` Enrichments
    - `dependencies` Dependency[]
      - `type` 'SETTING', required
      - `key` string, required
      - `name` string, required
    - `fields` Field[], required
      - `name` string, required
      - `type` 'ATTRIBUTE' | 'DIMENSION', required
      - `enrichmentType` 'VALUE' | 'JSON_LOGIC' | 'JSON_LOGIC_FROM_DEPENDENCY', required
      - `value` string, required
      - `order` integer, required
  - `filterFields` string[] — List of fields that can be used for filtering in usage meter
  - `eventIdTemplate` string — Template used to generate event id based on event payload

## Response `200`

Response for Create and Get event schema requests

- EventSchema — Structure of an event schema
  - `name` string, required — Name of the event. Must be unique for an organization.
  - `description` string — Description of the event
  - `version` integer, required — Version of event schema
  - `status` 'DRAFT' | 'ACTIVE' | 'INACTIVE' | 'ARCHIVED' — Status of event schema * DRAFT - Schema is in draft state * ACTIVE - Schema is currently active * INACTIVE - Schema is currently inactive * ARCHIVED - Older version of event schema
  - `attributes` EventAttributeSchema[]
    - `name` string, required — Name of the event attribute.
    - `defaultUnit` string — Unit for the attribute
  - `dimensions` DimensionsSchema[]
    - `name` string, required — Name of the event dimension
  - `filterFields` string[]
  - `featureDetails` FeatureDetails — details of feature associated with event schema with attribute name
    - `featureId` string, required
    - `attributeName` string, required
  - `enrichments` Enrichments
    - `dependencies` Dependency[]
      - `type` 'SETTING', required
      - `key` string, required
      - `name` string, required
    - `fields` Field[], required
      - `name` string, required
      - `type` 'ATTRIBUTE' | 'DIMENSION', required
      - `enrichmentType` 'VALUE' | 'JSON_LOGIC' | 'JSON_LOGIC_FROM_DEPENDENCY', required
      - `value` string, required
      - `order` integer, required
  - `eventIdTemplate` string — Template used to generate event id based on event payload
  - `eventLevelRevenue` boolean
  - `createdAt` string, date-time
  - `updatedAt` string, date-time

## Other responses

- `400` — Error response
- `401` — Error response
- `403` — Error response
- `404` — Error response
- `429` — Error response
- `default` — Error response

---

[API](https://skmtc.net/togaihq/apis/togai-apis.md) · [All operations](https://skmtc.net/togaihq/apis/togai-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/togaihq/togai-apis/revisions/442f5d8f4aa0/schema)
