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

# Create recurring rule

> Operacion: Create recurring rule.



## OpenAPI

````yaml /generated/specs/finance.json post /api/v1/recurring/rules
openapi: 3.0.0
info:
  title: Raul API - Finanzas
  description: >-
    Facturas, boletas, ejecuciones de billing, cuentas por pagar y medios de
    pago.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags: []
paths:
  /api/v1/recurring/rules:
    post:
      tags:
        - Recurring Expenses
      summary: Create recurring rule
      description: 'Operacion: Create recurring rule.'
      operationId: RecurringRuleController_createRule
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecurringRuleDto'
      responses:
        '201':
          description: Rule created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringRuleResponseDto'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateRecurringRuleDto:
      type: object
      properties:
        is_active:
          type: boolean
          description: Indica si la regla está activa
        supplier_id:
          type: string
          description: Supplier ID (optional)
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        category_id:
          type: string
          description: Category ID (optional for income rules)
          example: b2c3d4e5-f678-90ab-cdef-123456789012
        client_id:
          type: string
          description: Client ID (optional, mainly used by manual income rules)
          example: b2c3d4e5-f678-90ab-cdef-123456789012
        description:
          type: string
          description: Rule description
          example: Monthly rent
          maxLength: 255
        type:
          type: string
          description: Rule type
          enum:
            - expense
            - income
          example: expense
        source:
          type: string
          description: Rule source metadata
          example: manual_user
        projection_group:
          type: string
          description: Optional grouping hint for projections
          example: rrhh
        expected_amount:
          type: number
          description: >-
            Expected amount (legacy format, optional when projection_months is
            sent)
          example: 500000
          minimum: 0
        expected_day:
          type: number
          description: Expected day of the month
          example: 5
          minimum: 1
          maximum: 31
        end_date:
          format: date-time
          type: string
          description: End date for the recurring rule (optional)
          example: '2026-12-31T00:00:00.000Z'
        amount_schedule:
          description: Optional scheduled amount changes by month
          type: array
          items:
            $ref: '#/components/schemas/RecurringRuleAmountScheduleItemDto'
        projection_months:
          description: >-
            Dense projection matrix used by the UI to edit projected month
            amounts directly
          type: array
          items:
            $ref: '#/components/schemas/RecurringRuleProjectionMonthDto'
      required:
        - description
    RecurringRuleResponseDto:
      type: object
      properties:
        rule_id:
          type: string
        supplier_id:
          type: object
        category_id:
          type: object
        client_id:
          type: object
        description:
          type: string
        type:
          type: string
          enum:
            - expense
            - income
        source:
          type: object
        projection_group:
          type: object
        expected_amount:
          type: number
        expected_day:
          type: number
        end_date:
          type: object
        amount_schedule:
          type: array
          items:
            $ref: '#/components/schemas/RecurringRuleAmountScheduleItemDto'
        projection_months:
          type: array
          items:
            $ref: '#/components/schemas/RecurringRuleProjectionMonthDto'
        is_active:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - rule_id
        - supplier_id
        - description
        - type
        - expected_amount
        - expected_day
        - end_date
        - is_active
        - created_at
        - updated_at
    RecurringRuleAmountScheduleItemDto:
      type: object
      properties:
        effective_month:
          type: string
          description: Month where the new amount starts applying
          example: 2026-05
        amount:
          type: number
          description: Amount applied from the effective month onward
          example: 2500000
          minimum: 0
      required:
        - effective_month
        - amount
    RecurringRuleProjectionMonthDto:
      type: object
      properties:
        month:
          type: string
          description: Month represented in the dense projection matrix
          example: 2026-04
        amount:
          type: number
          description: Amount assigned to the projected month
          example: 2500000
        is_active:
          type: boolean
          description: Whether the rule is active for this month
          example: true
      required:
        - month
        - amount
        - is_active
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Token de sesión Better Auth para rutas de backoffice; las rutas de
        portal usan su token propio.

````

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