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

# Create an alert route

> Save where one service's alerts open in Slack, and which on-call schedule (if any) is mentioned in the thread when one opens. Upserts on the service, so a service that already has a route has its row edited rather than a second one grown; the save describes the route's WHOLE state, so an edit that omits oncall_schedule_id clears a schedule a previous save set, the same way it would if it omitted target. The service is read from an alert's service label, then job, app, namespace; the channel must be a Slack channel like #checkout-alerts. A route takes effect for alerts that open a new thread: an alert already holding a thread keeps it, and so does its mention.



## OpenAPI

````yaml /api-reference/openapi.json post /alert_routes
openapi: 3.1.0
info:
  description: >-
    A resource-shaped endpoint onto the same tool surface the MCP server
    (/api/mcp) reaches. Every gate, refusal and audit row a caller sees here is
    the exact one the MCP endpoint answers for the same tool. Authenticated with
    an API key holding the api:admin scope, or the read-only api:config_read
    scope for GET alone.
  title: SRE Agent configuration API
  version: 1.0.0
servers:
  - url: https://sreagent.app/api/v1/config
security:
  - apiKey: []
tags:
  - name: ai_providers
  - name: ai_settings
  - name: alert_mutes
  - name: alert_routes
  - name: aws_external_id
  - name: certificate_monitors
  - name: change_notifications
  - name: compliance_periods
  - name: connectors
  - name: data_sources
  - name: deploy_policies
  - name: export
  - name: github_settings
  - name: image_targets
  - name: notification_settings
  - name: organization_settings
  - name: outbound_configs
  - name: outbound_rules
  - name: overseer_settings
  - name: prompt_templates
  - name: repo_settings
  - name: service_bindings
  - name: slack
  - name: slis
  - name: slos
  - name: status_page_components
  - name: status_page_incidents
  - name: status_page_settings
  - name: synthetic_checks
  - name: team_members
  - name: teams
  - name: ticket_import_rules
  - name: ticket_integrations
paths:
  /alert_routes:
    post:
      tags:
        - alert_routes
      summary: Create an alert route
      description: >-
        Save where one service's alerts open in Slack, and which on-call
        schedule (if any) is mentioned in the thread when one opens. Upserts on
        the service, so a service that already has a route has its row edited
        rather than a second one grown; the save describes the route's WHOLE
        state, so an edit that omits oncall_schedule_id clears a schedule a
        previous save set, the same way it would if it omitted target. The
        service is read from an alert's service label, then job, app, namespace;
        the channel must be a Slack channel like #checkout-alerts. A route takes
        effect for alerts that open a new thread: an alert already holding a
        thread keeps it, and so does its mention.
      operationId: createAlertRoute
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              properties:
                enabled:
                  description: >-
                    Whether the route is in force. Omitted leaves the state
                    alone: true on a new route, unchanged on an edit, so saving
                    a paused route does not bring it back into force. Pass false
                    to pause it, true to resume it.
                  type: boolean
                oncall_schedule_id:
                  description: >-
                    The schedule (by its uuid, as list_oncall_schedules answers
                    it) to mention in the thread when this service's alert opens
                    one. It must belong to this same organization. Passing null,
                    or omitting the field, means no mention, and clears one a
                    previous save set, since this call always describes the
                    route's whole state.
                  type:
                    - string
                    - 'null'
                service:
                  description: The service to route, as an alert names it.
                  type: string
                target:
                  description: The Slack channel this service's alerts open in.
                  type: string
              required:
                - service
                - target
              type: object
        required: true
      responses:
        '201':
          description: Created.
        '409':
          description: A row already matches this resource's natural key.
        '422':
          description: The tool refused the request's shape or content.
        default:
          description: The request failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      description: The body of every failed request.
      properties:
        error:
          type: string
          description: >-
            A short machine-readable code such as forbidden, conflict or
            read_only_key.
        message:
          type: string
          description: A sentence that says what to change.
      required:
        - error
        - message
      additionalProperties: true
  securitySchemes:
    apiKey:
      description: >-
        An sre_ak_* API key holding the api:admin scope (or api:config_read,
        which every write refuses with read_only_key).
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.