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

# Create fraud rule



## OpenAPI

````yaml /openapi.json post /api/v1/business/fraud/rules
openapi: 3.0.0
info:
  title: Axra Public API
  description: Merchant and third-party developer API surface
  version: '2026-04-15'
  contact: {}
servers:
  - url: http://localhost:3001
    description: Local development
  - url: https://staging-api.useaxra.com
    description: Staging
  - url: https://api.useaxra.com
    description: Production
security: []
tags: []
paths:
  /api/v1/business/fraud/rules:
    post:
      tags:
        - Business Fraud Rules
      summary: Create fraud rule
      operationId: FraudRulesController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFraudRuleDto'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/FraudRuleResponseDto'
                required:
                  - success
                  - data
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '422':
          description: Unprocessable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorEnvelopeDto'
components:
  schemas:
    CreateFraudRuleDto:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        priority:
          type: number
          default: 100
        enabled:
          type: boolean
          default: true
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/RuleConditionDto'
        match:
          type: string
          enum:
            - all
            - any
        action:
          type: string
          enum:
            - ALLOW
            - REVIEW
            - BLOCK
        riskScore:
          type: number
          default: 0
          minimum: 0
          maximum: 100
        metadata:
          type: object
      required:
        - name
        - conditions
        - match
        - action
    FraudRuleResponseDto:
      type: object
      properties:
        id:
          type: string
        businessId:
          type: string
        name:
          type: string
        description:
          type: string
        priority:
          type: number
        enabled:
          type: boolean
        conditions:
          type: object
        action:
          type: string
          enum:
            - ALLOW
            - REVIEW
            - BLOCK
        riskScore:
          type: number
        metadata:
          type: object
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - businessId
        - name
        - priority
        - enabled
        - conditions
        - action
        - riskScore
        - createdAt
        - updatedAt
    HttpErrorEnvelopeDto:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          $ref: '#/components/schemas/HttpErrorBodyDto'
      required:
        - success
        - error
    RuleConditionDto:
      type: object
      properties:
        field:
          type: string
        operator:
          type: string
          enum:
            - eq
            - neq
            - gt
            - gte
            - lt
            - lte
            - in
            - not_in
            - contains
        value:
          type: object
      required:
        - field
        - operator
        - value
    HttpErrorBodyDto:
      type: object
      properties:
        code:
          type: string
          example: VALIDATION_ERROR
        message:
          type: string
          example: email must be an email
        statusCode:
          type: number
          example: 400
        errors:
          type: object
          description: >-
            Optional per-field validation messages (when present on the source
            exception)
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - code
        - message
        - statusCode

````