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

# Update a scenario

> The body is the whole document, not a patch: steps and targets are ordered. Every save records a version.



## OpenAPI

````yaml /0.16/openapi.json post /api/v1/scenarios/{id}
openapi: 3.0.3
info:
  title: 2501 Public API
  version: v1
  description: >-
    The stable, versioned HTTP API for driving 2501 as code. See the API
    Overview for authentication, the org_id rule, cursor pagination, and the
    error envelope.
servers:
  - url: https://{command_center_host}
    variables:
      command_center_host:
        default: your-command-center-host
        description: Your Command Center host
security:
  - bearerAuth: []
paths:
  /api/v1/scenarios/{id}:
    post:
      tags:
        - Scenarios
      summary: Update a scenario
      description: >-
        The body is the whole document, not a patch: steps and targets are
        ordered. Every save records a version.
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  minLength: 1
                description:
                  type: string
                  default: ''
                tags:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  default: []
                hosts:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  default: []
                agents:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  default: []
                vars:
                  type: object
                  additionalProperties:
                    type: string
                  default: {}
                ticket_title:
                  type: string
                  default: ''
                ticket_body:
                  type: string
                  default: ''
                prepare:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          name:
                            type: string
                            minLength: 1
                          'on':
                            type: string
                            minLength: 1
                          run:
                            type: string
                            minLength: 1
                        required:
                          - run
                        additionalProperties: false
                      - type: object
                        properties:
                          name:
                            type: string
                            minLength: 1
                          'on':
                            type: string
                            minLength: 1
                          write:
                            type: string
                            minLength: 1
                          content:
                            type: string
                          sudo:
                            type: boolean
                        required:
                          - write
                          - content
                        additionalProperties: false
                  default: []
                validation:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          label:
                            type: string
                            minLength: 1
                          required:
                            type: boolean
                          validator:
                            type: string
                            enum:
                              - pattern_match
                          pattern:
                            type: string
                            minLength: 1
                          where:
                            type: string
                            enum:
                              - task_summary
                              - task_description
                              - executed_commands
                              - write_file
                              - update_file
                              - use_mcp_tool
                              - tool_calls
                              - agent_messages
                              - operational_rules
                              - task_plan
                              - job_resolution
                              - job_plan
                              - gateway_messages
                              - gateway_summary
                          negate:
                            type: boolean
                        required:
                          - label
                          - validator
                          - pattern
                          - where
                        additionalProperties: false
                      - type: object
                        properties:
                          label:
                            type: string
                            minLength: 1
                          required:
                            type: boolean
                          validator:
                            type: string
                            enum:
                              - task_count
                          min:
                            type: integer
                            minimum: 0
                          max:
                            type: integer
                            minimum: 0
                        required:
                          - label
                          - validator
                        additionalProperties: false
                      - type: object
                        properties:
                          label:
                            type: string
                            minLength: 1
                          required:
                            type: boolean
                          validator:
                            type: string
                            enum:
                              - job_resolution_status
                          statuses:
                            type: array
                            items:
                              type: string
                              enum:
                                - success
                                - partial
                                - no_action
                                - agentic_failure
                                - hard_failure
                            minItems: 1
                        required:
                          - label
                          - validator
                          - statuses
                        additionalProperties: false
                      - type: object
                        properties:
                          label:
                            type: string
                            minLength: 1
                          required:
                            type: boolean
                          validator:
                            type: string
                            enum:
                              - host_state
                          run:
                            type: string
                            minLength: 1
                          'on':
                            type: string
                            minLength: 1
                          exit_code:
                            type: integer
                        required:
                          - label
                          - validator
                          - run
                        additionalProperties: false
                      - type: object
                        properties:
                          name:
                            type: string
                            minLength: 1
                          run:
                            type: string
                            minLength: 1
                          'on':
                            type: string
                            minLength: 1
                          exit_code:
                            type: integer
                        required:
                          - run
                        additionalProperties: false
                  default: []
                restore:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          name:
                            type: string
                            minLength: 1
                          'on':
                            type: string
                            minLength: 1
                          run:
                            type: string
                            minLength: 1
                        required:
                          - run
                        additionalProperties: false
                      - type: object
                        properties:
                          name:
                            type: string
                            minLength: 1
                          'on':
                            type: string
                            minLength: 1
                          write:
                            type: string
                            minLength: 1
                          content:
                            type: string
                          sudo:
                            type: boolean
                        required:
                          - write
                          - content
                        additionalProperties: false
                  default: []
                status:
                  type: string
                  enum:
                    - draft
                    - published
                    - disabled
                  default: draft
                id:
                  type: string
                agent_hosts:
                  type: object
                  additionalProperties:
                    type: string
                agent_info:
                  type: object
                  additionalProperties:
                    type: object
                    properties: {}
                    additionalProperties:
                      nullable: true
                org_id:
                  type: string
                tenant_id:
                  type: string
                created_at:
                  anyOf:
                    - type: string
                    - type: string
                      format: date-time
                updated_at:
                  anyOf:
                    - type: string
                    - type: string
                      format: date-time
              required:
                - title
              additionalProperties: false
      responses:
        '200':
          description: The updated scenario
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Scenario'
        '400':
          description: >-
            Bad request - a field is missing, malformed, or not allowed
            (VALIDATION_FAILED, BAD_REQUEST, INVALID_CURSOR)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            No credentials, or a key that is invalid, revoked, or expired
            (UNAUTHORIZED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Authenticated but not allowed (FORBIDDEN, ORG_ACCESS_DENIED,
            STEP_UP_REFUSED, TWO_FACTOR_ENROLLMENT_REQUIRED,
            LICENSE_CAP_REACHED, LICENSE_EXPIRED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such row that this caller can see (NOT_FOUND)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The write conflicts with existing data (CONFLICT, DUPLICATE_KEY,
            FOREIGN_KEY_VIOLATION, RESOURCE_IN_USE)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Scenario:
      type: object
      properties:
        id:
          type: string
          example: scn_af30b030-...
        title:
          type: string
          example: nginx down
        description:
          type: string
        tags:
          type: array
          items:
            type: string
        ticket_title:
          type: string
        ticket_body:
          type: string
        vars:
          type: object
          additionalProperties:
            type: string
        prepare:
          type: array
          items:
            type: object
            additionalProperties:
              nullable: true
          description: >-
            Ordered shell commands, each `{ run, on? }`, in the shape `POST
            /api/v1/scenarios` accepts.
        restore:
          type: array
          items:
            type: object
            additionalProperties:
              nullable: true
          description: >-
            Ordered shell commands, each `{ run, on? }`, in the shape `POST
            /api/v1/scenarios` accepts.
        validation:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  label:
                    type: string
                    minLength: 1
                  required:
                    type: boolean
                  validator:
                    type: string
                    enum:
                      - pattern_match
                  pattern:
                    type: string
                    minLength: 1
                  where:
                    type: string
                    enum:
                      - task_summary
                      - task_description
                      - executed_commands
                      - write_file
                      - update_file
                      - use_mcp_tool
                      - tool_calls
                      - agent_messages
                      - operational_rules
                      - task_plan
                      - job_resolution
                      - job_plan
                      - gateway_messages
                      - gateway_summary
                  negate:
                    type: boolean
                required:
                  - label
                  - validator
                  - pattern
                  - where
                additionalProperties: false
              - type: object
                properties:
                  label:
                    type: string
                    minLength: 1
                  required:
                    type: boolean
                  validator:
                    type: string
                    enum:
                      - task_count
                  min:
                    type: integer
                    minimum: 0
                  max:
                    type: integer
                    minimum: 0
                required:
                  - label
                  - validator
                additionalProperties: false
              - type: object
                properties:
                  label:
                    type: string
                    minLength: 1
                  required:
                    type: boolean
                  validator:
                    type: string
                    enum:
                      - job_resolution_status
                  statuses:
                    type: array
                    items:
                      type: string
                      enum:
                        - success
                        - partial
                        - no_action
                        - agentic_failure
                        - hard_failure
                    minItems: 1
                required:
                  - label
                  - validator
                  - statuses
                additionalProperties: false
              - type: object
                properties:
                  label:
                    type: string
                    minLength: 1
                  required:
                    type: boolean
                  validator:
                    type: string
                    enum:
                      - host_state
                  run:
                    type: string
                    minLength: 1
                  'on':
                    type: string
                    minLength: 1
                  exit_code:
                    type: integer
                required:
                  - label
                  - validator
                  - run
                additionalProperties: false
              - type: object
                properties:
                  name:
                    type: string
                    minLength: 1
                  run:
                    type: string
                    minLength: 1
                  'on':
                    type: string
                    minLength: 1
                  exit_code:
                    type: integer
                required:
                  - run
                additionalProperties: false
        status:
          type: string
          enum:
            - draft
            - published
            - disabled
        hosts:
          type: array
          items:
            type: string
          example:
            - web-01
        agents:
          type: array
          items:
            type: string
          example:
            - agent-linux-1
        agent_hosts:
          type: object
          additionalProperties:
            type: string
          description: Agent name to the host it is attached to
        agent_info:
          type: object
          additionalProperties:
            type: object
            properties:
              host:
                type: string
                nullable: true
              specialty:
                type: string
                nullable: true
            required:
              - host
              - specialty
        org_id:
          type: string
          example: org_460b541c-...
        tenant_id:
          type: string
          example: ten_115bea44-...
        created_at:
          type: string
          format: date-time
          example: '2026-08-26T10:00:26.380Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-08-26T10:00:26.380Z'
      required:
        - id
        - title
        - description
        - tags
        - ticket_title
        - ticket_body
        - vars
        - prepare
        - restore
        - validation
        - status
        - hosts
        - agents
        - agent_hosts
        - agent_info
        - org_id
        - tenant_id
        - created_at
        - updated_at
    Error:
      type: object
      properties:
        code:
          type: string
          example: VALIDATION_FAILED
        message:
          type: string
          example: Validation failed
        request_id:
          type: string
          example: req_3702b7e7-...
        field:
          type: string
          description: Set when one input is at fault
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
            required:
              - field
              - message
          description: Set when several inputs are at fault
        details:
          type: object
          additionalProperties:
            nullable: true
      required:
        - code
        - message
        - request_id
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key minted in Command Center (Settings -> API Keys), sent as
        `Authorization: Bearer 2501_ak_...`. A Command Center session cookie is
        also accepted.

````

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