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

# Create settlement

> Release selected payment splits into a bank account with typed deductions. Idempotency-Key is required. Matching replays return the original resource; changed payloads conflict with HTTP 409. All writes require organization-wide Treasury visibility.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/settlements
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/settlements:
    post:
      tags:
        - API
      summary: Create settlement
      description: >-
        Release selected payment splits into a bank account with typed
        deductions. Idempotency-Key is required. Matching replays return the
        original resource; changed payloads conflict with HTTP 409. All writes
        require organization-wide Treasury visibility.
      operationId: createApiSettlement
      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:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              properties:
                bankAccountId:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                settlementDate:
                  type: string
                  format: date
                  pattern: >-
                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
                items:
                  minItems: 1
                  maxItems: 1000
                  type: array
                  items:
                    type: object
                    properties:
                      customerPaymentId:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      paymentSplitId:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      amount:
                        type: integer
                        exclusiveMinimum: 0
                        maximum: 9007199254740991
                    required:
                      - customerPaymentId
                      - paymentSplitId
                      - amount
                    additionalProperties: false
                deductions:
                  default: []
                  maxItems: 32
                  type: array
                  items:
                    type: object
                    properties:
                      deductionType:
                        type: string
                        enum:
                          - commission
                          - tax_withholding
                          - tax_perception
                          - chargeback
                          - adjustment
                          - other
                      amount:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      description:
                        type: string
                        maxLength: 500
                      taxKind:
                        $ref: '#/components/schemas/ApiSharedEnum78c05c0fb9'
                      jurisdiction:
                        type: string
                        maxLength: 60
                    required:
                      - deductionType
                      - amount
                    additionalProperties: false
                netDepositAmount:
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                integrationSource:
                  type: string
                  minLength: 1
                  maxLength: 120
                integrationId:
                  type: string
                  minLength: 1
                  maxLength: 255
              required:
                - bankAccountId
                - settlementDate
                - items
                - deductions
                - netDepositAmount
              additionalProperties: false
      responses:
        '201':
          description: Committed resource or replay
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSharedObjecta9a56f8ba3'
        '400':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
        '401':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
        '403':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
        '404':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
        '409':
          description: Idempotency or 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 state conflict
                      retryable: false
                      details: []
        '422':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
        '429':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
        '503':
          description: 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: Request could not be completed
                      retryable: false
                      details: []
components:
  schemas:
    ApiSharedEnum78c05c0fb9:
      type: string
      enum:
        - iibb
        - vat
        - income_tax
        - suss
        - stamps
    ApiSharedObjecta9a56f8ba3:
      type: object
      required:
        - request_id
        - data
      properties:
        request_id:
          type: string
        data:
          $ref: '#/components/schemas/ApiSharedObjectf0953ff270'
    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
    ApiSharedObjectf0953ff270:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        object:
          type: string
          const: settlement
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        bank_account_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        settlement_date:
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
        status:
          type: string
        gross_amount:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        deductions_amount:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        net_amount:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        created_at:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
      required:
        - object
        - id
        - bank_account_id
        - settlement_date
        - status
        - gross_amount
        - deductions_amount
        - net_amount
        - created_at
      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.