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

# List ScenarioRuns.

> List all ScenarioRuns matching filter.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json get /v1/scenarios/runs
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/scenarios/runs:
    get:
      tags:
        - Scenario
      summary: List ScenarioRuns.
      description: List all ScenarioRuns matching filter.
      operationId: listScenarioRuns
      parameters:
        - name: name
          in: query
          description: Filter by name
          allowEmptyValue: true
          schema:
            type: string
        - name: state
          in: query
          description: Filter by state
          allowEmptyValue: true
          schema:
            type: string
        - name: benchmark_run_id
          in: query
          description: Filter by benchmark run ID
          allowEmptyValue: true
          schema:
            type: string
        - name: scenario_id
          in: query
          description: Filter runs associated to Scenario given ID
          allowEmptyValue: true
          schema:
            type: string
        - name: limit
          in: query
          description: The limit of items to return. Default is 20. Max is 5000.
          allowEmptyValue: true
          schema:
            type: integer
            format: int32
        - name: starting_after
          in: query
          description: >-
            Load the next page of data starting after the item with the given
            ID.
          allowEmptyValue: true
          schema:
            type: string
        - name: include_total_count
          in: query
          description: >-
            If true (default), includes total_count in the response. Set to
            false to skip the count query for better performance on large
            datasets.
          allowEmptyValue: true
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScenarioRunListView'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Runloop from '@runloop/api-client';

            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });

            // Automatically fetches more pages as needed.
            for await (const scenarioRunView of client.scenarios.runs.list()) {
              console.log(scenarioRunView.id);
            }
        - lang: Python
          source: |-
            import os
            from runloop_api_client import Runloop

            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )
            page = client.scenarios.runs.list()
            page = page.runs[0]
            print(page.id)
components:
  schemas:
    ScenarioRunListView:
      type: object
      properties:
        runs:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioRunView'
          description: List of ScenarioRuns matching filter.
        has_more:
          type: boolean
        total_count:
          format: int32
          type:
            - integer
            - 'null'
      required:
        - runs
        - has_more
    ScenarioRunView:
      type: object
      description: >-
        A ScenarioRunView represents a single run of a Scenario on a Devbox.
        When completed, the ScenarioRun will contain the final score and output
        of the run.
      properties:
        id:
          type: string
          description: ID of the ScenarioRun.
        name:
          description: Optional name of ScenarioRun.
          type:
            - string
            - 'null'
        scenario_id:
          type: string
          description: ID of the Scenario that has been run.
        devbox_id:
          type: string
          description: ID of the Devbox on which the Scenario is running.
        benchmark_run_id:
          description: >-
            ID of the BenchmarkRun that this Scenario is associated with, if
            any.
          type:
            - string
            - 'null'
        scoring_contract_result:
          description: The scoring result of the ScenarioRun.
          anyOf:
            - $ref: '#/components/schemas/ScoringContractResultView'
            - type: 'null'
        start_time_ms:
          type: integer
          format: int64
          description: The time that the scenario started
        duration_ms:
          format: int64
          description: Duration scenario took to run.
          type:
            - integer
            - 'null'
        state:
          $ref: '#/components/schemas/ScenarioRunState'
          description: The state of the ScenarioRun.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >-
            User defined metadata to attach to the scenario run for
            organization.
        purpose:
          description: Purpose of the ScenarioRun.
          type:
            - string
            - 'null'
        environment_variables:
          additionalProperties:
            type: string
          description: Environment variables used to run the scenario.
          type:
            - object
            - 'null'
        secrets_provided:
          additionalProperties:
            type: string
          description: User secrets used to run the scenario.
          type:
            - object
            - 'null'
      required:
        - id
        - scenario_id
        - devbox_id
        - state
        - metadata
    ScoringContractResultView:
      type: object
      description: >-
        A ScoringContractResultView represents the result of running all scoring
        functions on a given input context.
      properties:
        score:
          type: number
          format: float
          description: >-
            Total score for all scoring contracts. This will be a value between
            0 and 1.
        scoring_function_results:
          type: array
          items:
            $ref: '#/components/schemas/ScoringFunctionResultView'
          description: List of all individual scoring function results.
      required:
        - score
        - scoring_function_results
    ScenarioRunState:
      type: string
      enum:
        - running
        - scoring
        - scored
        - completed
        - canceled
        - timeout
        - failed
    ScoringFunctionResultView:
      type: object
      description: >-
        A ScoringFunctionResultView represents the result of running a single
        scoring function on a given input context.
      properties:
        score:
          type: number
          format: float
          description: Final score for the given scoring function.
        scoring_function_name:
          type: string
          description: Scoring function name that ran.
        output:
          type: string
          description: Log output of the scoring function.
        state:
          $ref: '#/components/schemas/ScoringFunctionResultViewState'
          description: The state of the scoring function application.
      required:
        - score
        - scoring_function_name
        - output
        - state
    ScoringFunctionResultViewState:
      type: string
      enum:
        - unknown
        - complete
        - error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````