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

# Upsert account risk control

> Creates or updates risk limits for a trading account owned by the authenticated principal's organization. The caller must have Controls Premium and organization control edit access.



## OpenAPI

````yaml /api-reference/controls.openapi.json put /v1/controls/accounts/{account_id}/risk
openapi: 3.1.0
info:
  title: controls
  description: ''
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.anthid.com
    description: Production
security: []
tags:
  - name: Organization Controls
    description: Organization-level control configuration
  - name: Controls - Account - Manual
    description: Account-level manual control configuration
  - name: Controls - Account - Risk
    description: Account-level risk-limit control configuration
  - name: Controls - Account - Time
    description: Account-level time-window control configuration
  - name: Controls - Symbol - Manual
    description: Symbol-level manual control configuration
  - name: Controls - Symbol - Risk
    description: Symbol-level risk-limit control configuration
  - name: Controls - Symbol - Time
    description: Symbol-level time-window control configuration
  - name: Control Evaluation
    description: Effective control-state evaluation
paths:
  /v1/controls/accounts/{account_id}/risk:
    put:
      tags:
        - Controls - Account - Risk
      summary: Upsert account risk control
      description: >-
        Creates or updates risk limits for a trading account owned by the
        authenticated principal's organization. The caller must have Controls
        Premium and organization control edit access.
      operationId: upsertAccountRiskControl
      parameters:
        - name: account_id
          in: path
          description: Trading account id
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Optional loss, position-size, and order-size limits for the account
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertRiskControlRequest'
        required: true
      responses:
        '200':
          description: Account risk control upserted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountRiskControl'
        '400':
          description: Request or organization context is invalid
          content:
            text/plain:
              schema:
                type: string
        '401':
          description: Missing or invalid authentication credentials
          content:
            text/plain:
              schema:
                type: string
        '403':
          description: >-
            Caller lacks entitlement, edit permission, or ownership of the
            trading account
          content:
            text/plain:
              schema:
                type: string
        '429':
          description: Caller exceeded the request rate limit
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: Unexpected server error while upserting the control
          content:
            text/plain:
              schema:
                type: string
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    UpsertRiskControlRequest:
      type: object
      properties:
        max_daily_loss_amount:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Quantity'
        max_daily_loss_percent:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Percent'
        max_order_size:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Quantity'
        max_position_size:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Quantity'
    AccountRiskControl:
      type: object
      required:
        - account_id
        - organization_id
        - version
        - max_daily_loss_amount
        - max_daily_loss_percent
        - created_at
        - updated_at
      properties:
        account_id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        max_daily_loss_amount:
          type: number
          format: double
        max_daily_loss_percent:
          type: number
          format: double
        max_order_size:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Quantity'
        max_position_size:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Quantity'
        organization_id:
          type: string
          format: uuid
        updated_at:
          type: string
          format: date-time
        version:
          type: integer
          format: int64
    Quantity:
      type: string
    Percent:
      type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````