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

# Create a new fee policy

> Requires the fee_policy.create permission.

Creates a new fee policy for the authenticated company with pricing rules




## OpenAPI

````yaml /api-spec.yaml post /v1/pricing/fee-policies
openapi: 3.1.0
info:
  title: Rinne API
  version: 1.0.0
  description: >
    **Rinne API** is a robust payment platform that offers integration with
    multiple payment providers.


    ## Authentication


    The API uses API Key authentication via the `x-api-key` header. Each company
    has a unique key to access resources.


    ## Response Format


    All responses follow a consistent format:

    - **Success**: Returns the requested data directly

    - **Error**: Returns an `error` object with detailed information


    ## Pagination


    Endpoints that return lists support pagination through parameters:

    - `page`: Page number (default: 1)

    - `limit`: Items per page (default: 20, maximum: 100)


    ## Supported Providers


    The API supports multiple payment providers:

    - **Rinne**: Internal provider

    - **Celcoin**: PIX integration and other financial services


    ## Raw Card Data (PCI Endpoints)


    Card credential fields (`card_data.number`, `card_data.cvv`,
    `card_data.network_token`,

    `card_data.cryptogram`, and the 3DS `card.number`) must always be sent
    encrypted —

    values start with the `ev:` prefix. Plaintext values are rejected with

    `400 VALIDATION_ERROR` on every host.


    There are two ways to send encrypted values:

    - **rinne-js**: card forms and wallet buttons (Apple Pay / Google Pay)
    encrypt
      credentials client-side before they leave the browser.
    - **PCI API host**: server-to-server integrations that handle raw card data
    must call
      `https://pci.api.rinne.com.br/core` (sandbox: `https://pci.api-sandbox.rinne.com.br/core`)
      instead of the regular host. This endpoint encrypts `number` and `cvv` in transit
      before the request reaches the API; all other fields pass through unchanged.

    The PCI host serves only transaction creation and 3DS session creation (both
    the

    self and merchant variants); use the regular host for everything else.
  contact:
    name: Rinne API Support
    email: suporte@rinne.com.br
servers:
  - url: https://api-sandbox.rinne.com.br/core
    description: Sandbox
  - url: https://api.rinne.com.br/core
    description: Production
security: []
tags:
  - name: System
    description: System and API health endpoints
  - name: Authentication
    description: User authentication and authorization endpoints
  - name: Management
    description: >-
      Merchant management endpoints - create, list, get specific, overview,
      update
  - name: Transactions
    description: Transaction operations for merchants - create, list, overview, refunds
  - name: Affiliations
    description: Affiliation management for merchants
  - name: Banking
    description: Banking operations for merchants - balance, cashout, statements
  - name: Bank Accounts
    description: Bank account management for merchants
  - name: Pix Keys
    description: PIX key management for merchants
  - name: Company Transactions
    description: Direct transaction management and query endpoints for companies
  - name: Companies
    description: Company management
  - name: Company Affiliations
    description: Payment provider affiliation management
  - name: Company Banking
    description: Company banking endpoints (balance, etc.)
  - name: Company Pix
    description: Company PIX key management
  - name: Company Ledger
    description: Company ledger entry query endpoints
  - name: Ledger
    description: Ledger entry query endpoints (company and merchants)
  - name: Webhooks
    description: Endpoints for receiving webhooks from external providers
  - name: Pricing
    description: Fee and cost policy management for transaction pricing
  - name: Users
    description: User management endpoints
  - name: Roles
    description: Role management endpoints
  - name: Permissions
    description: Permission management endpoints
  - name: Admin
    description: Admin management endpoints
    x-scalar-ignore: true
paths:
  /v1/pricing/fee-policies:
    post:
      tags:
        - Pricing
      summary: Create a new fee policy
      description: >
        Requires the fee_policy.create permission.


        Creates a new fee policy for the authenticated company with pricing
        rules
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFeePolicyDto'
            examples:
              standard-card-fees:
                summary: Standard card fee structure
                value:
                  name: standard-card-fees
                  description: Standard fee structure for card transactions
                  is_active: true
                  cashout_price: 350
                  rules:
                    - conditions:
                        - field: transaction.payment_method
                          operator: EQUALS
                          value: CREDIT_CARD
                        - field: transaction.installments
                          operator: EQUALS
                          value: 1
                      price:
                        percentage: 2.3
                      priority: 1
                    - conditions:
                        - field: transaction.payment_method
                          operator: EQUALS
                          value: DEBIT_CARD
                      price:
                        percentage: 1.8
                      priority: 2
                    - conditions: []
                      price:
                        percentage: 3
                      priority: 99
      responses:
        '201':
          description: Fee policy created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeePolicyResponseDto'
        '400':
          description: Validation error
        '401':
          description: Unauthorized - Invalid or missing API key
        '403':
          description: Insufficient permissions to access this resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthorizationErrorResponse'
        '404':
          description: Company not found
        '500':
          description: Internal server error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateFeePolicyDto:
      type: object
      description: Fee policy creation request
      required:
        - name
        - cashout_price
        - rules
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9_-]+$
          minLength: 1
          maxLength: 100
          description: Policy name (alphanumeric, underscores, hyphens only)
          example: standard-card-fees
        description:
          type: string
          maxLength: 500
          description: Optional policy description
          example: Standard fee structure for card transactions
        is_active:
          type: boolean
          default: true
          description: Whether the policy is active
          example: true
        cashout_price:
          type: integer
          minimum: 0
          description: Cashout price in cents (fixed fee for cashout operations)
          example: 350
        automatic_anticipation_percentage:
          allOf:
            - $ref: '#/components/schemas/AnticipationRate'
            - default: 2
        spot_anticipation_percentage:
          allOf:
            - $ref: '#/components/schemas/AnticipationRate'
            - default: 2
        rules:
          type: array
          minItems: 1
          items:
            type: object
            required:
              - conditions
              - price
              - priority
            properties:
              conditions:
                type: array
                items:
                  $ref: '#/components/schemas/Condition'
              price:
                $ref: '#/components/schemas/PricingValue'
              priority:
                type: integer
                minimum: 1
    FeePolicyResponseDto:
      type: object
      description: Fee policy response
      properties:
        id:
          type: string
          description: Policy ID
          example: a3dbd0c2-9f79-4f86-8caa-47779b3f2793
        name:
          type: string
          example: standard-card-fees
        description:
          type:
            - string
            - 'null'
          example: Standard fee structure for card transactions
        is_active:
          type: boolean
          example: true
        cashout_price:
          type: integer
          description: Cashout price in cents (fixed fee for cashout operations)
          example: 350
        automatic_anticipation_percentage:
          $ref: '#/components/schemas/AnticipationRate'
        spot_anticipation_percentage:
          $ref: '#/components/schemas/AnticipationRate'
        organization_id:
          type: string
          description: Organization company ID
          example: a3dbd0c2-9f79-4f86-8caa-47779b3f2794
        rules:
          type: array
          items:
            $ref: '#/components/schemas/PricingRule'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AuthorizationErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: AUTHORIZATION_ERROR
            message:
              type: string
              example: You need 'admin' permissions to access this resource
            status:
              type: integer
              example: 403
            path:
              type: string
              example: /companies
            timestamp:
              type: string
              format: date-time
              example: '2023-12-01T10:00:00.000Z'
            requestId:
              type: string
              example: req_123456789
    AnticipationRate:
      type: number
      minimum: 0
      maximum: 100
      multipleOf: 0.0001
      description: Monthly anticipation rate as a percentage (up to 4 decimal places)
      example: 2.4999
    Condition:
      type: object
      description: Rule condition for transaction field evaluation
      required:
        - field
        - operator
        - value
      properties:
        field:
          type: string
          pattern: ^transaction(\.[a-zA-Z_][a-zA-Z0-9_]*)+$
          description: >
            Dotted path to any field exposed by the public transaction response
            schema, with arbitrary nesting depth (e.g., "transaction.amount",
            "transaction.card_data.brand", "transaction.consumer.address.city").
            Subkeys under "transaction.metadata" are also accepted because
            metadata is an arbitrary record. Paths that point to a non-primitive
            (e.g., "transaction.card_data") or to a field not present in the
            response schema are rejected at create/update time.
          example: transaction.card_data.brand
        operator:
          type: string
          enum:
            - EQUALS
            - NOT_EQUALS
            - GREATER_THAN
            - LESS_THAN
            - GREATER_OR_EQUAL
            - LESS_OR_EQUAL
            - IN
            - NOT_IN
          description: Comparison operator
          example: EQUALS
        value:
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items:
                oneOf:
                  - type: string
                  - type: number
                  - type: boolean
          description: >
            Value to compare against (array for 'IN'/'NOT_IN' operators). Use
            boolean true/false for boolean fields such as
            automatic_anticipation.
          example: CREDIT_CARD
    PricingValue:
      type: object
      description: >-
        Pricing structure with percentage, flat fee, and minimum price. At least
        one pricing component must be provided.
      anyOf:
        - required:
            - percentage
        - required:
            - flat
        - required:
            - minimum_price
      properties:
        percentage:
          type:
            - number
            - 'null'
          format: float
          minimum: 0
          description: Percentage fee (e.g., 2.5 for 2.5%)
          example: 2.5
        flat:
          type:
            - number
            - 'null'
          format: float
          minimum: 0
          description: Flat fee in cents
          example: 50
        minimum_price:
          type:
            - number
            - 'null'
          format: float
          minimum: 0
          description: Minimum fee in cents
          example: 100
    PricingRule:
      type: object
      description: Individual pricing rule with conditions and pricing
      required:
        - conditions
        - price
        - priority
      properties:
        id:
          type: string
          description: System-generated rule ID
          example: a3dbd0c2-9f79-4f86-8caa-47779b3f2793
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/Condition'
          description: Array of conditions (empty array means applies to all)
        price:
          $ref: '#/components/schemas/PricingValue'
        priority:
          type: integer
          minimum: 1
          description: Rule priority (1 = highest priority)
          example: 1
        created_at:
          type: string
          format: date-time
          description: Rule creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Rule last update timestamp
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Company API key for authentication

````