---
title: "Create alert template"
method: POST
path: "/api/{org_id}/alerts/templates"
tags: ["Templates"]
---

# Create alert template

`POST /api/{org_id}/alerts/templates`

## 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}/alerts/templates`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/alerts/templates/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new alert notification template for an organization. Templates define the format and content of alert notifications, including message structure, variable substitutions, and styling options. Templates can be reused across multiple alert destinations to maintain consistent notification formatting and branding across different channels.

## Path parameters

- `org_id` string, required

## Request body

- object
  - `applies_to` string[], nullable: Kinds the template is meant for; [] is every kind. Absent on update keeps the stored list.
  - `body` string
  - `isDefault` boolean, nullable
  - `isPrebuilt` boolean: True for system-managed prebuilt templates (those whose name starts with `prebuilt_`). The public API refuses updates and deletes for these, so the UI should render them as read-only.
  - `kind` string, nullable: Template kind: "custom" (default) or "content". Absent on write means "unspecified" — create defaults to custom, update preserves the stored kind (sticky-kind rule, design §6.2).
  - `name` string
  - `title` string
  - `type` 'http' | 'email' | 'sns' | 'slack_app'

## Response `200`

Success

- HttpResponse: HTTP response code 200 is success code 400 is error code 404 is not found code 500 is internal server error code 503 is service unavailable code >= 1000 is custom error code message is the message or error message
  - `code` integer, required
  - `error_detail` string, nullable
  - `hint` string, nullable: One-line guidance on how to fix the error (agent self-correction, D4).
  - `id` string, nullable
  - `message` string, required
  - `name` string, nullable
  - `suggestions` string[], nullable: Closest valid alternatives for a mistyped field/function name.
  - `trace_id` string, nullable
  - `warnings` string[], nullable: Problems with a request that succeeded anyway. Distinct from `hint`, which explains a failure: these accompany a 200, and the caller is entitled to have meant it.

## Other responses

- `400`: 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)
