> ## 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.

# Apply USD Treasury revaluation

> Explicitly apply a reviewed preview token. Posts only functional ARS at month end and reverses it next month; USD quantities and historical carrying replay stay unchanged. A fresh key replaces the account/month pair after backdated changes; the same key replays its original result. Closed periods and stale previews reject atomically. Never automatic; review the preview before requesting apply.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/treasury/usd-revaluations
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/treasury/usd-revaluations:
    post:
      tags:
        - API
      summary: Apply USD Treasury revaluation
      description: >-
        Explicitly apply a reviewed preview token. Posts only functional ARS at
        month end and reverses it next month; USD quantities and historical
        carrying replay stay unchanged. A fresh key replaces the account/month
        pair after backdated changes; the same key replays its original result.
        Closed periods and stale previews reject atomically. Never automatic;
        review the preview before requesting apply.
      operationId: applyApiUsdTreasuryRevaluation
      parameters:
        - name: Idempotency-Key
          in: header
          description: Clave estable para deduplicar reintentos de la misma operación.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                month:
                  type: string
                  pattern: ^\d{4}-(0[1-9]|1[0-2])$
                bank_account_id:
                  description: >-
                    Omit to include all USD bank accounts, up to 32 per action;
                    select one account for larger organizations.
                  type: string
                  format: uuid
                expected_preview_token:
                  type: string
                  pattern: ^[a-f0-9]{64}$
              required:
                - month
                - expected_preview_token
              additionalProperties: false
      responses:
        '200':
          description: Treasury result or immutable replay
          content:
            application/json:
              schema:
                type: object
                required:
                  - request_id
                  - data
                properties:
                  request_id:
                    type: string
                  data:
                    type: object
                    properties:
                      object:
                        type: string
                        const: usd_treasury_revaluation
                      id:
                        type: string
                        format: uuid
                      month:
                        type: string
                        pattern: ^\d{4}-(0[1-9]|1[0-2])$
                      posting_date:
                        type: string
                        format: date
                      reversal_date:
                        type: string
                        format: date
                      currency:
                        type: string
                        const: USD
                      functional_currency:
                        type: string
                        const: ARS
                      rate:
                        anyOf:
                          - type: number
                            exclusiveMinimum: 0
                          - type: 'null'
                      rate_date:
                        anyOf:
                          - type: string
                            format: date
                          - type: 'null'
                      preview_token:
                        type: string
                      accounts:
                        type: array
                        items:
                          type: object
                          properties:
                            bank_account_id:
                              type: string
                              format: uuid
                            bank_name:
                              type: string
                            account_name:
                              type: string
                            native_balance:
                              type: integer
                            carrying_value:
                              type: integer
                            revalued_value:
                              type: integer
                            adjustment:
                              type: integer
                            current_value:
                              type: integer
                            previous_adjustment:
                              type: integer
                            net_change:
                              type: integer
                            status:
                              $ref: '#/components/schemas/ApiSharedEnume890e5308b'
                            replaces_entry_ids:
                              maxItems: 2
                              type: array
                              items:
                                type: string
                                format: uuid
                            entry_id:
                              anyOf:
                                - type: string
                                  format: uuid
                                - type: 'null'
                            reversal_entry_id:
                              anyOf:
                                - type: string
                                  format: uuid
                                - type: 'null'
                          required:
                            - bank_account_id
                            - bank_name
                            - account_name
                            - native_balance
                            - carrying_value
                            - revalued_value
                            - adjustment
                            - current_value
                            - previous_adjustment
                            - net_change
                            - status
                            - replaces_entry_ids
                            - entry_id
                            - reversal_entry_id
                          additionalProperties: false
                    required:
                      - object
                      - id
                      - month
                      - posting_date
                      - reversal_date
                      - currency
                      - functional_currency
                      - rate
                      - rate_date
                      - preview_token
                      - accounts
                    additionalProperties: false
        '400':
          description: Statement request could not be completed
          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: Statement request could not be completed
                      retryable: false
                      details: []
        '401':
          description: Statement request could not be completed
          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: Statement request could not be completed
                      retryable: false
                      details: []
        '403':
          description: Statement request could not be completed
          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: Statement request could not be completed
                      retryable: false
                      details: []
        '404':
          description: Statement request could not be completed
          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: Statement request could not be completed
                      retryable: false
                      details: []
        '409':
          description: Idempotency or statement state conflict
          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: Idempotency or statement state conflict
                      retryable: false
                      details: []
        '422':
          description: Statement request could not be completed
          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: Statement request could not be completed
                      retryable: false
                      details: []
        '429':
          description: Statement request could not be completed
          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: Statement request could not be completed
                      retryable: false
                      details: []
        '503':
          description: >-
            Statement request could not be completed Verificación de
            credenciales temporalmente ocupada; reintentá sin cambiar la
            operación ni su Idempotency-Key.
          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: Statement request could not be completed
                      retryable: false
                      details: []
                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: []
          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
components:
  schemas:
    ApiSharedEnume890e5308b:
      type: string
      enum:
        - no_balance
        - unchanged
        - adjustment
    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
  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.