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

# Create a resource alert

> Fires (an email/Discord notification) when the metric stays over threshold for alert_minutes minutes straight.



## OpenAPI

````yaml /api-reference/openapi.json post /project/{project_id}/alerts
openapi: 3.0.0
info:
  title: Shard Cloud API
  description: >-
    API reference for Shard Cloud's authenticated management endpoints — Apps,
    Databases, VMs, Custom Docker Images, and project-level Alerts & Backups.
    Every endpoint on this page requires a JWT bearer token (see Authentication
    below). CDN endpoints have their own reference under the CDN tab.
  version: 2.0.0
servers:
  - url: https://shardcloud.app/api
    description: API base path
security: []
tags:
  - name: Databases
    description: PostgreSQL, MySQL, MongoDB, and Redis database services.
  - name: Apps
    description: Web application deployment, files, domains, and configuration.
  - name: VMs
    description: Full Linux virtual machines with SSH access.
  - name: Custom Images
    description: User-built Docker images, deployable straight to an App.
  - name: Project
    description: >-
      Resource alerts and backups — shared across App, Database, and VM
      projects.
paths:
  /project/{project_id}/alerts:
    post:
      tags:
        - Project
      summary: Create a resource alert
      description: >-
        Fires (an email/Discord notification) when the metric stays over
        threshold for alert_minutes minutes straight.
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAlertRequest'
      responses:
        '201':
          description: Alert created
          content:
            application/json:
              schema:
                type: object
                properties:
                  alert:
                    $ref: '#/components/schemas/Alert'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No valid subscription
      security:
        - JWTAuth: []
components:
  schemas:
    CreateAlertRequest:
      type: object
      required:
        - alert_metric
        - alert_minutes
        - alert_threshold_mb
      properties:
        alert_metric:
          type: string
          enum:
            - ram
            - vcpu
            - network_received
            - network_sent
            - network_total
        alert_minutes:
          type: integer
        alert_threshold_mb:
          type: integer
    Alert:
      type: object
      properties:
        id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        user_id:
          type: string
          format: uuid
        alert_metric:
          type: string
          enum:
            - ram
            - vcpu
            - network_received
            - network_sent
            - network_total
        alert_minutes:
          type: integer
          description: >-
            Sustained window, in minutes, the metric must stay over threshold
            before the alert fires.
        alert_threshold_mb:
          type: integer
        project_type:
          type: string
          enum:
            - app
            - database
            - virtual_machine
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    JWTAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Send your API token (Dashboard → Settings → API Token) as
        `Authorization: Bearer <token>`.

````