OpenObserve Templates API

The Templates API from OpenObserve — 3 operation(s) for templates.

OpenAPI Specification

openobserve-templates-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: openobserve Actions Templates API
  description: OpenObserve API documents [https://openobserve.ai/docs/](https://openobserve.ai/docs/)
  contact:
    name: OpenObserve
    url: https://openobserve.ai/
    email: hello@zinclabs.io
  license:
    name: AGPL-3.0
    identifier: AGPL-3.0
  version: 0.90.0
tags:
- name: Templates
paths:
  /api/{org_id}/alerts/templates:
    get:
      tags:
      - Templates
      summary: List alert templates
      description: Retrieves a list of all alert notification templates configured for an organization. Returns template names, types, and basic metadata to help administrators manage notification formatting options. Templates provide reusable formatting configurations that ensure consistent alert notifications across different channels and destinations.
      operationId: ListTemplates
      parameters:
      - name: org_id
        in: path
        description: Organization name
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    body:
                      type: string
                    isDefault:
                      type:
                      - boolean
                      - 'null'
                    name:
                      type: string
                    title:
                      type: string
                    type:
                      $ref: '#/components/schemas/DestinationType'
                      description: 'Indicates whether the body is

                        http or email body'
        '400':
          description: Error
          content:
            application/json:
              schema:
                default: null
      security:
      - Authorization: []
      x-o2-ratelimit:
        module: Templates
        operation: list
      x-o2-mcp:
        description: List all alert templates
        category: alerts
        summary_fields:
        - name
        - type
        - isDefault
        - title
    post:
      tags:
      - Templates
      summary: Create alert template
      description: 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.
      operationId: CreateTemplate
      parameters:
      - name: org_id
        in: path
        description: Organization name
        required: true
        schema:
          type: string
      requestBody:
        description: Template data
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                isDefault:
                  type:
                  - boolean
                  - 'null'
                name:
                  type: string
                title:
                  type: string
                type:
                  $ref: '#/components/schemas/DestinationType'
                  description: 'Indicates whether the body is

                    http or email body'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Error
          content:
            application/json:
              schema:
                default: null
      security:
      - Authorization: []
      x-o2-mcp:
        description: Create alert template
        category: alerts
      x-o2-ratelimit:
        module: Templates
        operation: create
  /api/{org_id}/alerts/templates/system/prebuilt:
    get:
      tags:
      - Templates
      summary: Get system prebuilt templates
      description: Retrieves all system-defined prebuilt templates. These templates are provided by OpenObserve for common notification destinations like Slack, Microsoft Teams, Email, PagerDuty, etc. System templates are read-only and serve as the foundation for prebuilt alert destinations. This endpoint returns the complete template configurations including body, type, and metadata. Requires LIST permission on templates.
      operationId: GetSystemTemplates
      parameters:
      - name: org_id
        in: path
        description: Organization name
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    body:
                      type: string
                    isDefault:
                      type:
                      - boolean
                      - 'null'
                    name:
                      type: string
                    title:
                      type: string
                    type:
                      $ref: '#/components/schemas/DestinationType'
                      description: 'Indicates whether the body is

                        http or email body'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                default: null
        '500':
          description: Error
          content:
            application/json:
              schema:
                default: null
      security:
      - Authorization: []
      x-o2-ratelimit:
        module: Templates
        operation: list
      x-o2-mcp:
        description: Get system prebuilt templates
        category: alerts
  /api/{org_id}/alerts/templates/{template_name}:
    get:
      tags:
      - Templates
      summary: Get alert template
      description: Retrieves the configuration and content of a specific alert notification template. Returns the template structure including message format, variable definitions, styling options, and other formatting parameters. Used for reviewing existing templates and understanding notification formats before making modifications.
      operationId: GetTemplate
      parameters:
      - name: org_id
        in: path
        description: Organization name
        required: true
        schema:
          type: string
      - name: template_name
        in: path
        description: Template name
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  body:
                    type: string
                  isDefault:
                    type:
                    - boolean
                    - 'null'
                  name:
                    type: string
                  title:
                    type: string
                  type:
                    $ref: '#/components/schemas/DestinationType'
                    description: 'Indicates whether the body is

                      http or email body'
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                default: null
      security:
      - Authorization: []
      x-o2-mcp:
        description: Get template details
        category: alerts
      x-o2-ratelimit:
        module: Templates
        operation: get
    put:
      tags:
      - Templates
      summary: Update alert template
      description: Updates an existing alert notification template. Allows modification of template content, formatting, variable placeholders, and styling options. Changes to templates will apply to all future alert notifications that use this template, providing a centralized way to update notification formats across multiple alerts and destinations.
      operationId: UpdateTemplate
      parameters:
      - name: org_id
        in: path
        description: Organization name
        required: true
        schema:
          type: string
      - name: template_name
        in: path
        description: Template name
        required: true
        schema:
          type: string
      requestBody:
        description: Template data
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                isDefault:
                  type:
                  - boolean
                  - 'null'
                name:
                  type: string
                title:
                  type: string
                type:
                  $ref: '#/components/schemas/DestinationType'
                  description: 'Indicates whether the body is

                    http or email body'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Error
          content:
            application/json:
              schema:
                default: null
      security:
      - Authorization: []
      x-o2-ratelimit:
        module: Templates
        operation: update
      x-o2-mcp:
        description: Update alert template
        category: alerts
    delete:
      tags:
      - Templates
      summary: Delete alert template
      description: Removes an alert notification template from the organization. The template must not be in use by any active destinations before deletion. Once deleted, any destinations previously using this template will need to be updated with alternative templates to continue formatting notifications properly.
      operationId: DeleteAlertTemplate
      parameters:
      - name: org_id
        in: path
        description: Organization name
        required: true
        schema:
          type: string
      - name: template_name
        in: path
        description: Template name
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                default: null
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                default: null
        '500':
          description: Failure
          content:
            application/json:
              schema:
                default: null
      security:
      - Authorization: []
      x-o2-mcp:
        description: Delete alert template
        category: alerts
        requires_confirmation: true
      x-o2-ratelimit:
        module: Templates
        operation: delete
components:
  schemas:
    DestinationType:
      type: string
      enum:
      - http
      - email
      - sns
      - action
  securitySchemes:
    Authorization:
      type: apiKey
      in: header
      name: Authorization
    BasicAuth:
      type: http
      scheme: basic