> ## Documentation Index
> Fetch the complete documentation index at: https://docs.warrn.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Alert

> Create an alert using OpsGenie API v2 format.

Create an alert using the OpsGenie request format. Warrn transforms the payload to its native shape, so existing OpsGenie integrations work without code changes.

A few mappings worth knowing:

* `message` → alert name (truncated past 255 chars; the full string lands in metadata).
* `priority` → severity: `P1` → critical, `P2` → high, `P3` → medium, `P4`/`P5` → low.
* `responders[0]` (where `type: "team"`) → resolved to a Warrn team by name.
* `entity` → resolved to a service by name match.
* `details` → alert metadata.
* An `opsgenie-migrated` tag is added automatically.


## OpenAPI

````yaml POST /v2/alerts/
openapi: 3.0.3
info:
  title: Warrn API
  version: '1.0'
  description: |
    Public REST API for Warrn. All endpoints are authenticated with an API key
    issued from Settings → API Keys in the Warrn dashboard.
servers:
  - url: https://api.warrn.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Alerts
    description: Native Warrn alert endpoints.
  - name: OpsGenie Compatible
    description: Drop-in OpsGenie Alert API v2 compatibility layer.
paths:
  /v2/alerts/:
    post:
      tags:
        - OpsGenie Compatible
      summary: Create Alert (OpsGenie)
      description: >-
        Create an alert using the OpsGenie request format. Warrn transforms the
        payload to its native format.
      operationId: opsgenieCreateAlert
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpsgenieCreateRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpsgenieAck'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    OpsgenieCreateRequest:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          maxLength: 255
          description: Alert message. Maps to alert name in Warrn.
        alias:
          type: string
          description: Stable alias for deduplication and later lookup.
        description:
          type: string
        priority:
          type: string
          enum:
            - P1
            - P2
            - P3
            - P4
            - P5
          default: P3
          description: P1→critical, P2→high, P3→medium, P4/P5→low.
        responders:
          type: array
          items:
            $ref: '#/components/schemas/OpsgenieResponder'
        tags:
          type: array
          items:
            type: string
        details:
          type: object
          additionalProperties: true
        entity:
          type: string
          description: Resolved to a service by name match.
        source:
          type: string
    OpsgenieAck:
      type: object
      properties:
        result:
          type: string
          example: Request will be processed
        took:
          type: number
          example: 0
        requestId:
          type: string
          format: uuid
    OpsgenieResponder:
      type: object
      properties:
        type:
          type: string
          enum:
            - team
            - user
        name:
          type: string
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: warrn_xxx
      description: Bearer token using your Warrn API key.

````