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

# Runs

> Measure a saved portfolio or a what-if book against a benchmark and peer funds. Keep the request_key: retrying the same request joins its run for 24 hours after it ends. Another request with that key returns 409. At most three runs may run at once; none runs past 60 minutes. A run whose books hold names the model has not scored first waits up to 10 more minutes while they are scored. Requires itoflow-engine-results.

Operation ID: startRiskRun.



## OpenAPI

````yaml /openapi/itoflow-public.openapi.json post /risk/runs
openapi: 3.1.0
info:
  description: >-
    All Itoflow APIs are experimental and may change without notice. Read-only
    operations marked interactive can be tried from the documentation; the
    others are reference-only.
  title: Itoflow Developer API
  version: 1.0.0
servers:
  - description: Itoflow API
    url: https://api.itoflow.ai
security: []
tags:
  - name: Account
  - name: Billing
  - name: Brokers
  - name: Chat
  - name: Connected MCP servers
  - name: GitHub
  - name: Market data
  - name: Monitors
  - name: Notifications
  - name: Portfolios
  - name: Risk runs
  - name: Sharing and data
  - name: Strategies
paths:
  /risk/runs:
    post:
      tags:
        - Risk runs
      summary: Start a risk run
      description: >-
        Measure a saved portfolio or a what-if book against a benchmark and peer
        funds. Keep the request_key: retrying the same request joins its run for
        24 hours after it ends. Another request with that key returns 409. At
        most three runs may run at once; none runs past 60 minutes. A run whose
        books hold names the model has not scored first waits up to 10 more
        minutes while they are scored. Requires itoflow-engine-results.


        Operation ID: startRiskRun.
      operationId: startRiskRun
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Gateway_RiskRunStart'
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_startRiskRunResponse'
          description: Run accepted
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: Request failed
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: The itoflow-engine-results flag is off.
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: Request failed
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: Request failed
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: Request failed
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: Request failed
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Gateway_RiskRunError'
          description: Request failed
          headers:
            Cache-Control:
              schema:
                const: no-store
                type: string
      security:
        - bearerAuth: []
components:
  schemas:
    Gateway_RiskRunStart:
      additionalProperties: false
      properties:
        request:
          additionalProperties: false
          properties:
            analyses:
              description: >-
                What to compute; defaults to both. "risk" computes risk, risk
                change, bets, sizing, scenarios, drivers, trust, exposures,
                liquidity and valuation; "performance" computes performance,
                attribution and factor P&L. A run skips the factor and price
                reads its sections do not use, and lists the others as
                not_requested.
              items:
                enum:
                  - risk
                  - performance
                type: string
              minItems: 1
              type: array
              uniqueItems: true
            benchmark:
              description: An index or a fund to measure against, such as SPY.US.
              maxLength: 32
              minLength: 1
              type: string
            include_forecast_quality:
              description: >-
                Defaults to false. Set true to include forecast-quality
                validation and its historical factor snapshots. Current risk,
                attribution, risk change and scenarios remain included either
                way.
              type: boolean
            peers:
              default: []
              description: >-
                0 to 10 peer funds, such as PAVE.US. A peer with no holdings
                book is left out of the run and named in its view.
              items:
                maxLength: 32
                minLength: 1
                type: string
              maxItems: 10
              type: array
            portfolio:
              anyOf:
                - additionalProperties: false
                  properties:
                    portfolio_id:
                      description: A saved portfolio the user owns.
                      format: uuid
                      pattern: >-
                        ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      type: string
                  required:
                    - portfolio_id
                  type: object
                - additionalProperties: false
                  properties:
                    holdings:
                      description: >-
                        A what-if: 1 to 3000 holdings. With a CASH line the
                        weights add to 1, within 0.01. Without one, the rest of
                        the book is cash; a book that borrows lists CASH below
                        zero. Nothing is saved.
                      items:
                        additionalProperties: false
                        properties:
                          symbol:
                            description: >-
                              Ticker symbol such as NVDA.US; a bare ticker means
                              its US listing. CASH is US dollars.
                            maxLength: 32
                            minLength: 1
                            type: string
                          weight:
                            description: >-
                              Fraction of the portfolio's net assets, so 0.25 is
                              25%. A short is below zero, and CASH holds what
                              its sale raised.
                            type: number
                        required:
                          - symbol
                          - weight
                        type: object
                      maxItems: 3000
                      minItems: 1
                      type: array
                  required:
                    - holdings
                  type: object
              description: >-
                The book to measure: a saved portfolio, or holdings for a
                what-if.
          required:
            - portfolio
            - benchmark
          type: object
        request_key:
          maxLength: 200
          minLength: 1
          type: string
      required:
        - request_key
        - request
      type: object
    Gateway_startRiskRunResponse:
      additionalProperties: false
      properties:
        joined_existing_run:
          type: boolean
        run_id:
          pattern: ^[0-9a-f]{32}$
          type: string
        status:
          enum:
            - running
            - ok
            - partial
            - failed
          type: string
      required:
        - run_id
        - status
        - joined_existing_run
      type: object
    Gateway_RiskRunError:
      additionalProperties: false
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              type: string
            flag:
              type: string
            message:
              type: string
          required:
            - code
            - message
          type: object
      required:
        - error
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: Itoflow access token issued for the Itoflow API.
      scheme: bearer
      type: http

````

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