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

## Changes

- **2024-05-27** `2b8be460ec6a` — 2 info
  - added the new optional request property `filterFields`
  - added the optional property `filterFields` to the response with the `200` status
- **2024-03-01** `6fb940b0dad9` — 2 info
  - added the new optional request property `eventIdTemplate`
  - added the optional property `eventIdTemplate` to the response with the `200` status
- **2023-10-06** `4d0b22a4b65c` — 1 info
  - added the optional property `eventLevelRevenue` to the response with the `200` status
- **2023-09-02** `6b13f6f47735` — 5 warning
  - removed the request property `eventIdTemplate`
  - removed the request property `filterFields`
  - removed the optional property `eventIdTemplate` from the response with the `200` status
  - removed the optional property `eventLevelRevenue` from the response with the `200` status
  - …1 more

[Change history](https://skmtc.dev/togaihq/apis/togai-apis/changes/event_schema/:event_schema_name/patch.md)

---

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