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

# Execute a playbook

> Executes a playbook for a single point in time when a production issue took place.
The request can either provide a message link to a Slack message describing the issue,
or provide its details directly.
Alternatively, if bookName is specified, the playbook is identified by name and messageLink/title are optional.




## OpenAPI

````yaml POST /playbook/execution
openapi: 3.0.3
info:
  title: Wild Moose Execution API
  description: >-
    API for running playbook-based debugging agents to investigate production
    issues
  version: 1.0.0
servers:
  - url: https://api.wildmoose.ai
    description: Production server
security:
  - bearerAuth: []
paths:
  /playbook/execution:
    post:
      tags:
        - Playbook Execution
      summary: Execute a playbook
      description: >
        Executes a playbook for a single point in time when a production issue
        took place.

        The request can either provide a message link to a Slack message
        describing the issue,

        or provide its details directly.

        Alternatively, if bookName is specified, the playbook is identified by
        name and messageLink/title are optional.
      operationId: runPlaybook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaybookExecutionInput'
            examples:
              messageLink:
                summary: Execute with message link
                value:
                  messageLink: https://slack.com/archives/C1234567890/p1234567890123456
                  liveRun: false
                  channelId: C1234567890
              details:
                summary: Execute with directly specified details
                value:
                  title: CPU Utilization is too high - avg idle time below 20%
                  time: '2025-01-15T10:30:00Z'
                  attributes:
                    host: web-server-01
                    environment: production
                    severity: high
                  details: CPU usage has been above 80% for the past 15 minutes
                  liveRun: true
                  channelId: C1234567890
              bookNameWithMessageLink:
                summary: Execute specific playbook with message link
                value:
                  bookName: perf-checks
                  messageLink: https://slack.com/archives/C1234567890/p1234567890123456
              bookNameWithTime:
                summary: Execute specific playbook with time only
                value:
                  bookName: perf-checks
                  time: '2025-01-15T10:30:00Z'
              bookNameWithFullDetails:
                summary: Execute specific playbook with full details
                value:
                  bookName: perf-checks
                  title: CPU Utilization is too high - avg idle time below 20%
                  time: '2025-01-15T10:30:00Z'
                  attributes:
                    host: web-server-01
                    environment: production
                  details: CPU usage has been above 80% for the past 15 minutes
      responses:
        '200':
          description: Playbook execution completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlaybookExecutionResult'
              example:
                highlights: >-
                  Root cause: Database connection pool exhaustion. The CPU spike
                  correlates with increased database queries from the
                  application layer. Immediate action: Scale database connection
                  pool from 20 to 50 connections.
                gadgetsHighlights: []
                enrichmentLink: https://slack.com/archives/C1234567890/p6543210987654321
                actionResults:
                  - title: Check system metrics
                    shortAnswer: CPU usage is at 85%
                    mostImportantLink: https://grafana.example.com/dashboard/cpu
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized - Invalid or missing JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - API not enabled for organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Client ID not configured for organization
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    PlaybookExecutionInput:
      type: object
      description: >
        Playbook execution input. Either messageLink or time must be provided to
        specify when

        the issue occurred. If bookName is not provided, either messageLink or
        title must be

        specified to identify which playbook to run.
      oneOf:
        - $ref: '#/components/schemas/BookNameInput'
        - $ref: '#/components/schemas/MessageLinkInput'
        - $ref: '#/components/schemas/AlertDetailsInput'
    PlaybookExecutionResult:
      type: object
      properties:
        error:
          type: string
          description: Error message if the playbook execution failed
          example: 'Failed to execute playbook: timeout'
        highlights:
          type: string
          description: >-
            Bottom-line summary containing root cause analysis, conclusions, and
            key insights derived from the playbook execution
          example: >-
            Root cause: Database connection pool exhaustion. The CPU spike
            correlates with increased database queries from the application
            layer. Immediate action: Scale database connection pool from 20 to
            50 connections.
        gadgetsHighlights:
          type: array
          description: Array of gadget highlight results
          items:
            $ref: '#/components/schemas/GadgetHighlights'
        enrichmentLink:
          type: string
          description: >-
            Link to the Slack message thread where enrichment results were
            posted (only present when channelId was specified)
          example: https://slack.com/archives/C1234567890/p6543210987654321
        actionableMitigations:
          type: array
          description: Array of actionable mitigations
          items:
            $ref: '#/components/schemas/ActionableMitigation'
        actionResults:
          type: array
          description: Array of action execution results
          items:
            $ref: '#/components/schemas/ActionResult'
    ValidationError:
      oneOf:
        - type: object
          properties:
            error:
              type: array
              description: Array of validation issue objects
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    example:
                      - body
                      - messageLink
                  message:
                    type: string
                    example: Required
        - type: object
          properties:
            error:
              type: string
              description: Validation error message
              example: Invalid input format
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Internal server error
    BookNameInput:
      allOf:
        - $ref: '#/components/schemas/ExecutionTargetParams'
        - type: object
          required:
            - bookName
          properties:
            bookName:
              type: string
              description: |
                Name of the playbook to run.
              example: perf-checks
            time:
              type: string
              format: date-time
              description: >
                The time when the issue occurred (ISO 8601 datetime). Optional,
                defaults to now.
              example: '2025-01-15T10:30:00Z'
    MessageLinkInput:
      allOf:
        - $ref: '#/components/schemas/ExecutionTargetParams'
        - type: object
          required:
            - messageLink
          properties:
            bookName:
              type: string
              description: |
                Name of the playbook to run.
              example: perf-checks
            messageLink:
              type: string
              description: >
                The link to a Slack message describing the issue (e.g., an alert
                or incident message). If bookName is provided - used to extract
                issue details and time.
              example: https://slack.com/archives/C1234567890/p1234567890123456
    AlertDetailsInput:
      allOf:
        - $ref: '#/components/schemas/ExecutionTargetParams'
        - type: object
          properties:
            time:
              type: string
              format: date-time
              description: >
                The time when the issue occurred (ISO 8601 datetime). Optional,
                defaults to now.
              example: '2025-01-15T10:30:00Z'
            attributes:
              type: object
              additionalProperties:
                type: string
              description: >-
                Attributes of the issue as key-value pairs, used to scope the
                issue and parameterize execution
              example:
                host: web-server-01
                environment: production
                severity: high
            details:
              type: string
              description: Additional details about the issue
              example: CPU usage has been above 80% for the past 15 minutes
          anyOf:
            - properties:
                bookName:
                  type: string
                  description: |
                    Name of the playbook to run.
                  example: perf-checks
              required:
                - bookName
            - properties:
                title:
                  type: string
                  description: >
                    The title of the alert/issue. Optional if bookName is
                    provided (used as issue context).
                  example: CPU Utilization is too high - avg idle time below 20%
              required:
                - title
    GadgetHighlights:
      type: object
      required:
        - title
      properties:
        title:
          type: string
          description: The title of the gadget
        args:
          type: object
          description: Arguments sent to the gadget
        highlights:
          type: string
          description: >-
            Summary containing conclusions and key insights derived from the
            gadget execution
          example: The high error rate is driven by latency across multiple regions.
    ActionableMitigation:
      type: object
      required:
        - toolName
      properties:
        toolName:
          type: string
          description: The name of the tool
        customName:
          type: string
          description: A custom name for the tool (optional)
        url:
          type: string
          description: A url target for the tool
        action:
          type: object
          description: An action target for the tool
    ActionResult:
      type: object
      properties:
        title:
          type: string
          description: Title of the action
          example: Check system metrics
        shortAnswer:
          type: string
          description: Short answer summary from the action
          example: CPU usage is at 85%
        mostImportantLink:
          type: string
          description: >-
            Key link to view raw action results in the original observability
            tool
          example: https://grafana.example.com/dashboard/cpu
    ExecutionTargetParams:
      type: object
      properties:
        liveRun:
          type: boolean
          description: If true, sends enrichment results to the incident management tool
          default: false
        channelId:
          type: string
          description: A Slack channel ID where results should be posted
          example: C1234567890
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token obtained from Auth0

````