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

# Run Automation rule

> Manually run an Automation rule immediately, outside its schedule.

## Restrictions

| Aspect      | Value                                                      |
| ----------- | ---------------------------------------------------------- |
| Rate limits | **100 requests/minute**; **5 requests/second** per account |
| Permissions | Valid `app_key`; caller must manage the target rule        |

## Usage

* Rate-limited to at most once per minute per rule; a second call within that window returns `429` with `code: "RequestTooFrequently"`.
* Only enabled rules can run manually; a disabled or misconfigured rule fails preflight with a `400` error before any run is created.
* The call returns once the underlying agent session starts, not once the run finishes; the run continues asynchronously — use List Automation runs to check completion status.
* `trigger_kind` is always `manual` for runs started this way, distinguishing them from `schedule`, `http_post`, and `oncall_incident` runs in run history.
* Every call is recorded in the account audit log.


## OpenAPI

````yaml /api-reference/safari.openapi.en.json post /safari/automation/rule/run
openapi: 3.1.0
info:
  title: Flashduty Open API
  description: >-
    Public HTTP API for the Flashduty AI SRE platform — skills, MCP servers
    (connectors), A2A agents, and sessions. Every operation is authenticated
    with an `app_key` query parameter issued from the Flashduty console.
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: AI SRE/Skills
  - name: AI SRE/MCP servers
  - name: AI SRE/A2A agents
  - name: AI SRE/Sessions
  - name: AI SRE/Automations
paths:
  /safari/automation/rule/run:
    post:
      tags:
        - AI SRE/Automations
      summary: Run Automation rule
      description: Manually run an Automation rule immediately, outside its schedule.
      operationId: automation-rule-write-run
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationRuleIDRequest'
            example:
              rule_id: arule_7NnLzY2Qp8xS4kUaV3mR6b
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ManualRunRuleResult'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  rule_id: arule_7NnLzY2Qp8xS4kUaV3mR6b
                  trigger_kind: manual
                  preflight:
                    ok: true
                    checks:
                      - rule_loaded
                      - actor_authorized
                      - app_allowed
                      - runtime_scope_resolved
                      - rule_config_valid
                    scope: team
                    owner_id: 80011
                    team_id: 123
                    app_name: ai-sre
                  run:
                    run_id: trun_5oDvqiG64uur6sBNsTc4u
                    session_id: sess_f8oDvqiG64uur6sBNsTc4u
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - AppKeyAuth: []
components:
  schemas:
    AutomationRuleIDRequest:
      type: object
      properties:
        rule_id:
          type: string
          description: Rule ID.
      required:
        - rule_id
    ResponseEnvelope:
      type: object
      description: >-
        Standard response envelope used by every Flashduty public API. On
        success `data` contains the endpoint-specific payload and `error` is
        absent. On failure `error` is present and `data` is absent. `request_id`
        is always present and is also mirrored in the `Flashcat-Request-Id`
        response header.
      properties:
        request_id:
          type: string
          description: >-
            Unique ID for this request. Mirrored in the Flashcat-Request-Id
            header. Include it when reporting issues.
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
        data:
          description: Endpoint-specific payload. See each operation's 200 response schema.
      required:
        - request_id
    ManualRunRuleResult:
      type: object
      description: Result of manually running an Automation rule outside its schedule.
      properties:
        rule_id:
          type: string
          description: Rule ID that was run.
        trigger_kind:
          type: string
          enum:
            - manual
          description: Always manual for this operation.
        preflight:
          $ref: '#/components/schemas/PreflightResult'
        run:
          $ref: '#/components/schemas/AutomationRunView'
      required:
        - rule_id
        - trigger_kind
        - preflight
    DutyError:
      type: object
      description: >-
        Error payload inside the response envelope. Present only on non-2xx
        responses.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable error message, localized by the caller's
            Accept-Language. May contain field names, IDs, or other context from
            the failing request.
      required:
        - code
        - message
    PreflightResult:
      type: object
      description: Readiness checks computed before a manual run is allowed to start.
      properties:
        ok:
          type: boolean
          description: >-
            Whether all readiness checks passed. Always true in a response that
            reaches the caller — a failed preflight returns a 400/403 error
            instead of a payload with ok=false.
        checks:
          type: array
          items:
            type: string
          description: >-
            Names of the readiness checks performed, in order. Current fixed
            set: rule_loaded, actor_authorized, app_allowed,
            runtime_scope_resolved, rule_config_valid.
        scope:
          type: string
          enum:
            - person
            - team
          description: Resolved run scope for this run; mirrors the rule's run_scope.
        owner_id:
          type: integer
          format: int64
          description: Rule owner person ID.
        team_id:
          type: integer
          format: int64
          description: Rule's scope team ID; 0 means a personal rule.
        app_name:
          type: string
          description: >-
            App the rule is scoped to. Currently always ai-sre; manual runs are
            only supported for that app.
        warnings:
          type: array
          items:
            type: string
          description: >-
            Non-fatal warnings surfaced during preflight. Omitted or empty when
            there are none.
      required:
        - ok
        - checks
        - scope
        - owner_id
        - team_id
        - app_name
    AutomationRunView:
      type: object
      description: Reference to the run started by a manual trigger.
      properties:
        run_id:
          type: string
          description: Run ID, always populated once a run is created.
        session_id:
          type: string
          description: >-
            AI SRE session ID for this run. Always populated in a 200 response,
            since the call only returns after the session has started.
      required:
        - run_id
    ErrorResponse:
      type: object
      description: Response envelope for errors. `error` is required; `data` is absent.
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    ErrorCode:
      type: string
      description: >-
        Flashduty error code enum. Every failed API response sets `error.code`
        to one of these values. The value is a stable wire string — not a
        localized message and not a numeric status. HTTP status is
        informational.
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
  responses:
    BadRequest:
      description: Invalid request — usually a missing or malformed parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              summary: Missing required parameter
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter skill_id is not valid.
    Unauthorized:
      description: Missing or invalid app_key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    Forbidden:
      description: The app_key is valid but lacks permission for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            accessDenied:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: AccessDenied
                  message: Access Denied.
    TooManyRequests:
      description: Rate limit hit. Either the global API limit or a per-account limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: Unexpected server-side error. Include the request_id when reporting.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InternalError
                  message: >-
                    We encountered an internal error, and it has been reported.
                    Please try again later.
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: >-
        App key issued from the Flashduty console. Required on every public API
        call. Keep it secret — it grants the same access as the owning account.

````