Modern Treasury LedgerAccountSettlement API

The LedgerAccountSettlement API from Modern Treasury — 3 operation(s) for ledgeraccountsettlement.

OpenAPI Specification

modern-treasury-ledgeraccountsettlement-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Modern Treasury AccountCapability LedgerAccountSettlement API
  version: v1
  contact:
    name: Modern Treasury Engineering Team
    url: https://moderntreasury.com
  description: The Modern Treasury REST API. Please see https://docs.moderntreasury.com for more details.
servers:
- url: http://localhost:3000
- url: https://app.moderntreasury.com
tags:
- name: LedgerAccountSettlement
paths:
  /api/ledger_account_settlements/{id}/ledger_entries:
    parameters:
    - name: id
      in: path
      description: id
      required: true
      schema:
        type: string
    patch:
      summary: patch ledger_account_settlement_entries
      tags:
      - LedgerAccountSettlement
      operationId: patchLedgerAccountSettlementEntries
      description: Add ledger entries to a draft ledger account settlement.
      security:
      - basic_auth: []
      parameters: []
      responses:
        '200':
          description: successful
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '404':
          description: not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '422':
          description: unsuccessful
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ledger_account_settlement_entries_patch_request'
    delete:
      summary: delete ledger_account_settlement_entries
      tags:
      - LedgerAccountSettlement
      operationId: deleteLedgerAccountSettlementEntries
      description: Remove ledger entries from a draft ledger account settlement.
      security:
      - basic_auth: []
      parameters: []
      responses:
        '200':
          description: successful
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '404':
          description: not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '422':
          description: unsuccessful
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ledger_account_settlement_entries_delete_request'
  /api/ledger_account_settlements:
    post:
      summary: create ledger_account_settlement
      tags:
      - LedgerAccountSettlement
      operationId: createLedgerAccountSettlement
      description: Create a ledger account settlement.
      security:
      - basic_auth: []
      parameters:
      - name: Idempotency-Key
        in: header
        required: false
        description: This key should be something unique, preferably something like an UUID.
        schema:
          type: string
      responses:
        '201':
          description: successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ledger_account_settlement'
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '422':
          description: unsuccessful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ledger_account_settlement_create_request'
    get:
      summary: list ledger_account_settlements
      tags:
      - LedgerAccountSettlement
      operationId: listLedgerAccountSettlements
      description: Get a list of ledger account settlements.
      security:
      - basic_auth: []
      parameters:
      - name: after_cursor
        in: query
        schema:
          type: string
          nullable: true
        required: false
      - name: per_page
        in: query
        schema:
          type: integer
        required: false
      - $ref: '#/components/parameters/metadata_query'
      - $ref: '#/components/parameters/bulk_id'
      - name: settled_ledger_account_id
        in: query
        schema:
          type: string
        required: false
      - name: settlement_entry_direction
        in: query
        schema:
          type: string
        required: false
      - name: ledger_transaction_id
        in: query
        schema:
          type: string
        required: false
      - name: ledger_id
        in: query
        schema:
          type: string
        required: false
      - name: created_at
        in: query
        schema:
          type: object
          additionalProperties:
            type: string
            format: date-time
        style: deepObject
        required: false
        description: Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the created at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use created_at%5Bgt%5D=2000-01-01T12:00:00Z.
        explode: true
      - name: updated_at
        in: query
        schema:
          type: object
          additionalProperties:
            type: string
            format: date-time
        style: deepObject
        required: false
        description: Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the updated at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use updated_at%5Bgt%5D=2000-01-01T12:00:00Z.
        explode: true
      responses:
        '200':
          description: successful
          headers:
            X-After-Cursor:
              schema:
                type: string
                nullable: true
              required: false
              description: The cursor for the next page. Including this in a call as `after_cursor` will return the next page.
            X-Per-Page:
              schema:
                type: integer
                nullable: true
              description: The current `per_page`.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ledger_account_settlement'
  /api/ledger_account_settlements/{id}:
    parameters:
    - name: id
      in: path
      schema:
        type: string
      description: id
      required: true
    get:
      summary: get ledger_account_settlement
      tags:
      - LedgerAccountSettlement
      operationId: getLedgerAccountSettlement
      description: Get details on a single ledger account settlement.
      security:
      - basic_auth: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ledger_account_settlement'
        '404':
          description: not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
    patch:
      summary: update ledger_account_settlement
      tags:
      - LedgerAccountSettlement
      operationId: updateLedgerAccountSettlement
      description: Update the details of a ledger account settlement.
      security:
      - basic_auth: []
      parameters: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ledger_account_settlement'
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '404':
          description: not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
        '422':
          description: unsuccessful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_message'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ledger_account_settlement_update_request'
components:
  parameters:
    bulk_id:
      name: id[]
      in: query
      style: form
      explode: true
      allowReserved: true
      schema:
        type: array
        items:
          type: string
      required: false
      description: If you have specific IDs to retrieve in bulk, you can pass them as query parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
    metadata_query:
      name: metadata
      in: query
      schema:
        type: object
        additionalProperties:
          type: string
      style: deepObject
      explode: true
      required: false
      description: For example, if you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters.
  schemas:
    ledger_account_settlement_update_request:
      type: object
      properties:
        description:
          type: string
          description: The description of the ledger account settlement.
          nullable: true
        status:
          type: string
          enum:
          - posted
          - archived
          description: To post a pending ledger account settlement, use `posted`. To archive a pending ledger transaction, use `archived`.
        metadata:
          type: object
          description: Additional data represented as key-value pairs. Both the key and value must be strings.
          additionalProperties:
            type: string
          example:
            key: value
            foo: bar
            modern: treasury
        skip_settlement_ledger_transaction:
          type: boolean
          description: It is set to `false` by default. It should be set to `true` when migrating existing settlements.
          nullable: true
    ledger_account_settlement_create_request:
      type: object
      properties:
        description:
          type: string
          description: The description of the ledger account settlement.
          nullable: true
        status:
          type: string
          enum:
          - pending
          - posted
          - drafting
          description: The status of the ledger account settlement. It is set to `pending` by default. To post a ledger account settlement at creation, use `posted`.
          nullable: true
        settled_ledger_account_id:
          type: string
          format: uuid
          description: The id of the settled ledger account whose ledger entries are queried against, and its balance is reduced as a result.
        contra_ledger_account_id:
          type: string
          format: uuid
          description: The id of the contra ledger account that sends to or receives funds from the settled ledger account.
        allow_either_direction:
          type: boolean
          description: If true, the settlement amount and settlement_entry_direction will bring the settlement ledger account's balance closer to zero, even if the balance is negative.
          nullable: true
        effective_at_upper_bound:
          type: string
          format: date-time
          description: The exclusive upper bound of the effective_at timestamp of the ledger entries to be included in the ledger account settlement. The default value is the created_at timestamp of the ledger account settlement.
          nullable: true
        metadata:
          type: object
          description: Additional data represented as key-value pairs. Both the key and value must be strings.
          additionalProperties:
            type: string
          example:
            key: value
            foo: bar
            modern: treasury
        skip_settlement_ledger_transaction:
          type: boolean
          description: It is set to `false` by default. It should be set to `true` when migrating existing settlements.
          nullable: true
      required:
      - settled_ledger_account_id
      - contra_ledger_account_id
    ledger_account_settlement:
      type: object
      properties:
        id:
          type: string
          format: uuid
        object:
          type: string
        live_mode:
          type: boolean
          description: This field will be true if this object exists in the live environment or false if it exists in the test environment.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        ledger_id:
          type: string
          format: uuid
          description: The id of the ledger that this ledger account settlement belongs to.
        description:
          type: string
          description: The description of the ledger account settlement.
          nullable: true
        status:
          type: string
          enum:
          - archived
          - archiving
          - drafting
          - pending
          - posted
          - processing
          description: The status of the ledger account settlement. One of `processing`, `pending`, `posted`, `archiving` or `archived`.
        settled_ledger_account_id:
          type: string
          format: uuid
          description: The id of the settled ledger account whose ledger entries are queried against, and its balance is reduced as a result.
        contra_ledger_account_id:
          type: string
          format: uuid
          description: The id of the contra ledger account that sends to or receives funds from the settled ledger account.
        effective_at_upper_bound:
          type: string
          format: date-time
          description: The exclusive upper bound of the effective_at timestamp of the ledger entries to be included in the ledger account settlement. The default value is the created_at timestamp of the ledger account settlement.
          nullable: true
        ledger_transaction_id:
          type: string
          format: uuid
          description: The id of the ledger transaction that this settlement is associated with.
          nullable: true
        amount:
          type: integer
          description: The amount of the ledger account settlement.
          nullable: true
        settlement_entry_direction:
          type: string
          description: The direction of the ledger entry with the settlement_ledger_account.
          nullable: true
        currency:
          type: string
          description: The currency of the ledger account settlement.
        currency_exponent:
          type: integer
          description: The currency exponent of the ledger account settlement.
          nullable: true
        metadata:
          type: object
          description: Additional data represented as key-value pairs. Both the key and value must be strings.
          additionalProperties:
            type: string
          example:
            key: value
            foo: bar
            modern: treasury
      additionalProperties: false
      minProperties: 17
      required:
      - id
      - object
      - live_mode
      - created_at
      - updated_at
      - ledger_id
      - description
      - status
      - settled_ledger_account_id
      - contra_ledger_account_id
      - effective_at_upper_bound
      - ledger_transaction_id
      - amount
      - settlement_entry_direction
      - currency
      - currency_exponent
      - metadata
    error_message:
      type: object
      properties:
        errors:
          type: object
          properties:
            code:
              type: string
              enum:
              - parameter_invalid
              - parameter_missing
              - resource_not_found
              - not_found
              - forbidden
              - invalid_ip
              - invalid_key
              - header_invalid
              - expired_key
              - conflict
              - too_many_requests
            message:
              type: string
            parameter:
              type: string
      required:
      - errors
    ledger_account_settlement_entries_patch_request:
      type: object
      properties:
        ledger_entry_ids:
          type: array
          items:
            type: string
            format: uuid
          description: The ids of the ledger entries that are to be added or removed from the ledger account settlement.
          nullable: true
      required:
      - ledger_entry_ids
    ledger_account_settlement_entries_delete_request:
      type: object
      properties:
        ledger_entry_ids:
          type: array
          items:
            type: string
            format: uuid
          description: The ids of the ledger entries that are to be added or removed from the ledger account settlement.
          nullable: true
      required:
      - ledger_entry_ids
  securitySchemes:
    basic_auth:
      type: http
      scheme: basic