---
title: "Create a named event"
method: POST
path: "/api/{org_id}/rum/analytics/named_events"
tags: ["Product Analytics"]
---

# Create a named event

`POST /api/{org_id}/rum/analytics/named_events`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/rum/analytics/named_events`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/rum/analytics/named_events/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `org_id` string, required

## Query parameters

- `app` string, required

## Request body

- CreateNamedEvent
  - `name` string, required
  - `rules` Rule[], required
    - union: One way a named event matches: a page view, a click, or an error.
      - object
        - `name` string, nullable
        - `onPage` string, nullable
        - `op` 'eq' | 'prefix' | 'regex' | 'param' | 'ref', required
        - `t` 'view', required
        - `value` string, nullable
      - object
        - `onPage` string, nullable
        - `op` 'eq' | 'in' | 'prefix' | 'suffix' | 'contains' | 'regex': How a rule value is compared with a field: `in` lists every value, the rest take one each.
        - `t` 'action', required
        - `targets` string[]
        - `value` string, nullable
      - object
        - `onPage` string, nullable
        - `op` 'eq' | 'in' | 'prefix' | 'suffix' | 'contains' | 'regex', required: How a rule value is compared with a field: `in` lists every value, the rest take one each.
        - `t` 'error', required
        - `value` string, required

## Response `201`

Created

- NamedEvent
  - `app` string, required
  - `createdAt` integer, required
  - `createdBy` string, required
  - `id` string, required
  - `name` string, required
  - `rules` Rule[], required
    - union: One way a named event matches: a page view, a click, or an error.
      - object
        - `name` string, nullable
        - `onPage` string, nullable
        - `op` 'eq' | 'prefix' | 'regex' | 'param' | 'ref', required
        - `t` 'view', required
        - `value` string, nullable
      - object
        - `onPage` string, nullable
        - `op` 'eq' | 'in' | 'prefix' | 'suffix' | 'contains' | 'regex': How a rule value is compared with a field: `in` lists every value, the rest take one each.
        - `t` 'action', required
        - `targets` string[]
        - `value` string, nullable
      - object
        - `onPage` string, nullable
        - `op` 'eq' | 'in' | 'prefix' | 'suffix' | 'contains' | 'regex', required: How a rule value is compared with a field: `in` lists every value, the rest take one each.
        - `t` 'error', required
        - `value` string, required
  - `updatedAt` integer, required
  - `updatedBy` string, required
  - `version` integer, required

## Other responses

- `400`: Invalid body, name, rules or app
- `409`: duplicate_name or limit_reached
- `500`: Internal error

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
