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

# Calcular retención de Ganancias sin registrar un pago

> Operación de solo lectura. No requiere Idempotency-Key ni emite certificados. Usa los pagos elegibles del mes. Crear el pago recalcula con un bloqueo mensual; un cambio que desbalancea los medios de pago devuelve 409 STATE_CONFLICT con detalle GANANCIAS_CALCULATION_MISMATCH. Un fallo ARCA devuelve 422 BUSINESS_REQUIREMENT_UNMET con detalle GANANCIAS_STATUS_UNRESOLVED, salvo override explícito is_inscripto.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/supplier-payments/preview-ganancias
openapi: 3.1.0
info:
  title: La Pyme API
  description: >-
    Resources and workflows for purchases, sales, inventory, contacts, products,
    reports, and settings.
  version: 1.0.0
  contact:
    name: La Pyme Support
    email: hola@lapyme.com.ar
  license:
    name: Proprietary
    url: https://lapyme.com.ar/terminos
servers:
  - url: https://api.lapyme.com.ar
    description: Servidor de producción
security:
  - bearerAuth: []
tags:
  - name: API
    description: Public API operations for La Pyme integrations.
paths:
  /api/v1/supplier-payments/preview-ganancias:
    post:
      tags:
        - API
      summary: Calcular retención de Ganancias sin registrar un pago
      description: >-
        Operación de solo lectura. No requiere Idempotency-Key ni emite
        certificados. Usa los pagos elegibles del mes. Crear el pago recalcula
        con un bloqueo mensual; un cambio que desbalancea los medios de pago
        devuelve 409 STATE_CONFLICT con detalle GANANCIAS_CALCULATION_MISMATCH.
        Un fallo ARCA devuelve 422 BUSINESS_REQUIREMENT_UNMET con detalle
        GANANCIAS_STATUS_UNRESOLVED, salvo override explícito is_inscripto.
      operationId: previewApiSupplierPaymentGanancias
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiGananciasPreviewRequest'
      responses:
        '200':
          description: Cálculo sin escrituras
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGananciasPreviewResponse'
        '400':
          description: Datos inválidos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Datos inválidos
                      retryable: false
                      details: []
        '401':
          description: API key faltante o inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: API key faltante o inválida
                      retryable: false
                      details: []
        '403':
          description: Scopes insuficientes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Scopes insuficientes
                      retryable: false
                      details: []
        '422':
          description: Condición ARCA sin resolver
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Condición ARCA sin resolver
                      retryable: false
                      details: []
        '429':
          description: Límite de solicitudes excedido para la organización
          headers:
            Retry-After:
              description: Segundos a esperar antes de volver a intentar la solicitud.
              schema:
                type: string
                example: '30'
            X-RateLimit-Limit:
              description: Límite de la ventana activa.
              schema:
                type: string
                example: '5000'
            X-RateLimit-Remaining:
              description: Solicitudes restantes en la ventana activa.
              schema:
                type: string
                example: '0'
            X-RateLimit-Reset:
              description: Segundos restantes hasta el reset de la ventana activa.
              schema:
                type: string
                example: '30'
            RateLimit-Limit:
              description: Límite de la ventana activa en formato estándar.
              schema:
                type: string
                example: '5000'
            RateLimit-Remaining:
              description: Solicitudes restantes en la ventana activa en formato estándar.
              schema:
                type: string
                example: '0'
            RateLimit-Reset:
              description: >-
                Segundos hasta el reset de la ventana activa en formato
                estándar.
              schema:
                type: string
                example: '30'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: RATE_LIMITED
                  value:
                    request_id: req_rate_limit_1
                    error:
                      type: rate_limit_error
                      code: RATE_LIMITED
                      message: >-
                        The organization request limit was reached. Try again
                        later.
                      retryable: true
                      details: []
        '500':
          description: Error interno
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Error interno
                      retryable: false
                      details: []
        '503':
          description: >-
            Verificación de credenciales temporalmente ocupada; reintentá sin
            cambiar la operación ni su Idempotency-Key.
          headers:
            Retry-After:
              description: >-
                Segundos de espera. La verificación de credenciales indica 1;
                otras dependencias pueden indicar otro valor.
              schema:
                type: string
                example: '1'
            Cache-Control:
              description: La verificación de credenciales indica no-store.
              schema:
                type: string
                example: no-store
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                authentication_capacity:
                  summary: Verificación temporalmente ocupada
                  value:
                    request_id: req_auth_capacity_1
                    error:
                      type: api_error
                      code: INTERNAL_ERROR
                      message: >-
                        La verificación de credenciales está ocupada. Reintentá
                        más tarde.
                      retryable: true
                      details: []
components:
  schemas:
    ApiGananciasPreviewRequest:
      type: object
      properties:
        regimen:
          $ref: '#/components/schemas/ApiSharedEnum6a9369bfa4'
        calculation_base:
          type: integer
          minimum: 0
          description: Base elegible de este pago en centavos ARS, sin IVA.
        is_inscripto:
          description: >-
            Override explícito de inscripción en Ganancias. Omitir para
            consultar ARCA; un fallo no permite registrar el pago.
          type: boolean
        supplier_id:
          type: string
          format: uuid
        payment_date:
          type: string
          format: date
        exclude_payment_id:
          type: string
          format: uuid
      required:
        - regimen
        - calculation_base
        - supplier_id
        - payment_date
      additionalProperties: false
    ApiGananciasPreviewResponse:
      type: object
      properties:
        request_id:
          type: string
        data:
          type: object
          properties:
            object:
              type: string
              const: supplier_payment_ganancias_preview
            should_withhold:
              type: boolean
            exempt_reason:
              type: string
            calculation_base:
              type: integer
            accumulated_base_total:
              type: integer
            minimum_non_taxable:
              type: integer
            taxable_amount:
              type: integer
            rate:
              type: number
            gross_withholding:
              type: integer
            previous_withholdings:
              type: integer
            net_withholding:
              type: integer
            minimum_threshold:
              type: integer
            final_withholding:
              type: integer
            supplier_name:
              type: string
            is_inscripto_en_ganancias:
              type: boolean
            person_type:
              type: string
              enum:
                - FISICA
                - JURIDICA
            breakdown:
              type: array
              items:
                type: object
                properties:
                  label:
                    type: string
                  value:
                    type: number
                  formatted_value:
                    type: string
                required:
                  - label
                  - value
                additionalProperties: false
            progressive_scale_details:
              type: object
              properties:
                bracket:
                  type: string
                fixed_amount:
                  type: number
                rate:
                  type: number
                excess_over:
                  type: number
              required:
                - bracket
                - fixed_amount
                - rate
                - excess_over
              additionalProperties: false
          required:
            - object
            - should_withhold
            - calculation_base
            - accumulated_base_total
            - minimum_non_taxable
            - taxable_amount
            - rate
            - gross_withholding
            - previous_withholdings
            - net_withholding
            - minimum_threshold
            - final_withholding
            - supplier_name
            - is_inscripto_en_ganancias
            - person_type
            - breakdown
          additionalProperties: false
      required:
        - request_id
        - data
      additionalProperties: false
    ApiErrorEnvelope:
      type: object
      properties:
        request_id:
          type: string
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - api_error
                - authentication_error
                - authorization_error
                - business_error
                - external_dependency_error
                - idempotency_error
                - invalid_request_error
                - rate_limit_error
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            details:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  metadata:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type:
                        - string
                        - number
                        - boolean
                        - 'null'
                required:
                  - code
                  - message
                additionalProperties: false
          required:
            - type
            - code
            - message
            - retryable
            - details
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
    ApiSharedEnum6a9369bfa4:
      type: string
      enum:
        - '19'
        - '21'
        - '25'
        - '30'
        - '31'
        - '32'
        - '35'
        - '43'
        - '51'
        - '53'
        - '55'
        - '69'
        - '70'
        - '71'
        - '78'
        - '86'
        - '94'
        - '95'
        - '110'
        - '111'
        - '116'
        - '119'
        - '124'
      description: Código de régimen de Ganancias configurado.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Incluí tu API key en el header Authorization con el prefijo Bearer.

````

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