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

# List Rules

> List an agent's rules.

A rule tests a condition against each analyzed call and, when it matches,
applies a tag. `output_type` determines whether the tag is a label or a red
flag.



## OpenAPI

````yaml https://api.usetuner.ai/public/openapi.json get /api/v1/workspaces/{workspace_id}/agents/{agent_id}/settings/rules
openapi: 3.1.0
info:
  title: My Public API
  version: 1.0.0
servers:
  - url: https://api.usetuner.ai
security: []
tags:
  - name: calls
    x-group: Calls
  - name: workspaces
    x-group: Workspaces
  - name: agent-settings
    x-group: Agent Settings
  - name: agents
    x-group: Agents
  - name: simulation
    x-group: Simulation
  - name: providers
    x-group: Providers
paths:
  /api/v1/workspaces/{workspace_id}/agents/{agent_id}/settings/rules:
    get:
      tags:
        - agent-settings
      summary: List Rules
      description: >-
        List an agent's rules.


        A rule tests a condition against each analyzed call and, when it
        matches,

        applies a tag. `output_type` determines whether the tag is a label or a
        red

        flag.
      operationId: >-
        list_rules_api_v1_workspaces__workspace_id__agents__agent_id__settings_rules_get
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: integer
            description: Tuner's internal numeric ID for the agent.
            title: Agent Id
          description: Tuner's internal numeric ID for the agent.
        - name: workspace_id
          in: path
          required: true
          schema:
            type: integer
            description: Workspace ID. Find this in Workspace > General Settings.
            title: Workspace Id
          description: Workspace ID. Find this in Workspace > General Settings.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RuleResponse'
                title: >-
                  Response List Rules Api V1 Workspaces  Workspace Id  Agents 
                  Agent Id  Settings Rules Get
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              example:
                detail: Not authenticated
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: You do not have access to this workspace.
          content:
            application/json:
              example:
                detail: User does not have access to workspace 42
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: The agent has no settings record.
          content:
            application/json:
              example:
                detail: Agent 17 does not have settings
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Bearer: []
components:
  schemas:
    RuleResponse:
      properties:
        id:
          type: integer
          title: Id
          description: Tuner's ID for this rule.
        condition_source_type:
          type: string
          title: Condition Source Type
          description: Category of call data the condition tests.
        condition_source_id:
          type: integer
          title: Condition Source Id
          description: ID of the eval, metric, or field the condition tests.
        condition_source_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Condition Source Name
          description: Display name of the referenced eval, metric, or field.
        operator:
          type: string
          title: Operator
          description: How the value is compared.
        condition_value:
          title: Condition Value
          description: Value the condition compares against.
        output_type:
          type: string
          title: Output Type
          description: Whether matching calls get a label or a red flag.
        output_tag_name:
          type: string
          title: Output Tag Name
          description: Tag applied to matching calls.
        output_description:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Description
          description: Note explaining what this rule is for.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the rule was created.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: When the rule was last updated.
      type: object
      required:
        - id
        - condition_source_type
        - condition_source_id
        - operator
        - condition_value
        - output_type
        - output_tag_name
        - created_at
        - updated_at
      title: RuleResponse
      description: Response schema for a rule.
    ErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable description of what went wrong.
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Error body returned when a request fails.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    Bearer:
      type: http
      description: >-
        Use Tuner API key (tr_api_...) or user session token. Find your API key
        in Workspace Settings > API Keys.
      scheme: bearer

````