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

# Check Risk

> Evaluate the risk of a proposed DeFi action (deposit, borrow, withdraw) against configurable risk policies. Returns ALLOW, DENY, or WARN with reasons and alternatives.



## OpenAPI

````yaml POST /agent/check-risk
openapi: 3.0.3
info:
  title: Circular API
  description: >-
    DeFi risk intelligence API by Rosetta — markets, vaults, positions, risk
    analysis, credit ratings, and portfolio management across Morpho Blue, Aave
    V3, and other lending protocols.
  version: 1.0.0
  contact:
    name: Rosetta
    url: https://rosetta.sh
servers:
  - url: https://api.circular.rosetta.sh/api/v1
    description: Production
security:
  - BearerApiKey: []
tags:
  - name: Markets
    description: Lending market data — overview, search, compare, history, positions
  - name: Tokens
    description: Token metadata and oracle feeds
  - name: Vaults
    description: Vault data — overview, concentration, depositors
  - name: Positions
    description: Position scanning — wallet positions, loops, vault positions
  - name: Risk
    description: >-
      Risk analysis — dashboard, concentration, depeg simulation, protocol
      health
  - name: Liquidations
    description: Liquidation feed and history
  - name: Analytics
    description: Strategy breakdown, trends, yield opportunities, whale monitoring
  - name: Research
    description: Deep market research, deployment analysis, borrow strategy
  - name: Ratings
    description: Credit ratings — methodology, market ratings, vault ratings
  - name: Portfolios
    description: Portfolio management — overview, risk, yield, alerts, liquidity
  - name: Health
    description: API health check
  - name: Agent
    description: Agent risk API — risk checks and policy defaults
  - name: Client
    description: Client self-service — profile, API keys, usage, quota dashboard
paths:
  /agent/check-risk:
    post:
      tags:
        - Agent
      summary: Check risk for a DeFi action
      description: >-
        Evaluate the risk of a proposed DeFi action (deposit, borrow, withdraw)
        against configurable risk policies. Returns ALLOW, DENY, or WARN with
        reasons and alternatives.
      operationId: checkRisk
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RiskCheckRequest'
      responses:
        '200':
          description: Risk check result
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/RiskCheckResult'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '400':
          description: Handler error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HandlerErrorResponse'
components:
  schemas:
    RiskCheckRequest:
      type: object
      required:
        - action
        - marketId
        - amountUsd
      properties:
        action:
          type: string
          enum:
            - deposit
            - borrow
            - withdraw
            - swap
        marketId:
          type: string
        amountUsd:
          type: number
        walletAddress:
          type: string
        policy:
          $ref: '#/components/schemas/RiskPolicy'
    RiskCheckResult:
      type: object
      properties:
        decision:
          type: string
          enum:
            - ALLOW
            - DENY
            - WARN
        reasons:
          type: array
          items:
            $ref: '#/components/schemas/RiskReason'
        market:
          type: object
          properties:
            name:
              type: string
            rating:
              type: string
            riskScore:
              type: number
            utilization:
              type: number
            tvl:
              type: number
            supplyApy:
              type: number
            borrowApy:
              type: number
        position:
          type: object
          nullable: true
          properties:
            healthFactor:
              type: number
              nullable: true
            currentLeverage:
              type: number
            distanceToLiq:
              type: number
              nullable: true
        alternative:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/RiskAlternative'
        alternatives:
          type: array
          items:
            $ref: '#/components/schemas/RiskAlternative'
        meta:
          type: object
          properties:
            latencyMs:
              type: number
            policyApplied:
              $ref: '#/components/schemas/RiskPolicy'
            checksRun:
              type: array
              items:
                type: string
            timestamp:
              type: string
              format: date-time
    Meta:
      type: object
      properties:
        latencyMs:
          type: number
          description: Server-side processing time in milliseconds
        freshness:
          type: string
          description: Data freshness indicator (live, cached, snapshot)
        source:
          type: string
          description: Which protocol(s) provided data
    HandlerErrorResponse:
      type: object
      description: Returned when a handler returns success false (HTTP 400)
      properties:
        error:
          type: string
          description: Error message from the handler
        meta:
          $ref: '#/components/schemas/Meta'
    RiskPolicy:
      type: object
      properties:
        minRating:
          type: string
          default: BBB
        maxUtilization:
          type: number
          default: 0.85
        maxConcentrationPct:
          type: number
          default: 0.05
        requireFreshOracle:
          type: boolean
          default: true
        maxLeverage:
          type: number
          default: 3
    RiskReason:
      type: object
      properties:
        check:
          type: string
        severity:
          type: string
          enum:
            - critical
            - warning
            - info
        message:
          type: string
        value: {}
        threshold: {}
    RiskAlternative:
      type: object
      properties:
        marketId:
          type: string
        name:
          type: string
        rating:
          type: string
        riskScore:
          type: number
        supplyApy:
          type: number
        borrowApy:
          type: number
        tvl:
          type: number
        utilization:
          type: number
        chainId:
          type: integer
        protocol:
          type: string
        reason:
          type: string
  securitySchemes:
    BearerApiKey:
      type: http
      scheme: bearer
      description: API key in format circ_live_* or circ_test_*

````