WritersLogic Verifiable AI Agent Hub Reconcile Ledger API

The Reconcile Ledger API from WritersLogic Verifiable AI Agent Hub — 1 operation(s) for reconcile ledger.

GitHub OpenAPI

Operations 1

POST /api/v1/reconcile-ledger Exact Ledger Reconciler #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/writerslogic-com:writerslogic-com-reconcile-ledger-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

writerslogic-com-reconcile-ledger-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: WritersLogic Verifiable AI Agent Hub Reconcile Ledger API
  version: 2.0.0
  description: Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.
  contact:
    name: WritersLogic
    url: https://writerslogic.com/agents
    email: agents@writerslogic.com
servers:
- url: https://agents.writerslogic.com
tags:
- name: Reconcile Ledger
paths:
  /api/v1/reconcile-ledger:
    post:
      operationId: reconcile_ledger
      summary: Exact Ledger Reconciler
      description: 'Explains which charges, refunds and fees make up a Stripe, PayPal or bank payout, with an exact solver instead of a model: subset-sum over integer minor units (meet-in-the-middle, DP, branch-and-bound) across candidate fee schedules (percentage + fixed, tiers, caps), withholding, FX rates and rounding conventions (half-up, half-even, truncate; per line or on the total). Paste a Stripe balance or payout-reconciliation CSV, a PayPal activity CSV or structured rows. verdict.action is RECONCILED, MATCHED_WITH_UNSETTLED_ITEMS (every payout explained, some items belong to a later payout), AMBIGUOUS (with the exact count), UNMATCHED_SETTLEMENTS (missing items, phantom payouts and the closest near-miss) or SEARCH_INCOMPLETE. Reports which rounding convention reconciles and a hash-chained audit trail. Structured input, CSV and plain one-amount-per-line statements make zero LLM calls; other free text is normalized by a fast-tier LLM whose rows must quote the source verbatim. Not accounting or tax advice.


        Price: 1.50 USDC on Base (x402).'
      x-x402-price-usdc: '1.50'
      x-x402-amount: '1500000'
      x-payment-info:
        protocols:
        - x402
        price:
          mode: fixed
          currency: USD
          amount: '1.50'
      x-audience: business
      x-sample-url: https://agents.writerslogic.com/api/v1/samples/reconcile-ledger
      security:
      - x402: []
      - apiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                items:
                  type: array
                  maxItems: 2000
                  description: Ledger lines. Amounts are signed (refunds and disputes negative) strings in major units, e.g. "1234.56".
                  items:
                    type: object
                    additionalProperties: false
                    required:
                    - id
                    - amount
                    - currency
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 64
                      amount:
                        anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 40
                        - type: number
                        description: Decimal string; locale formats (1.234,56, (12.00)) are accepted and parsed exactly.
                      currency:
                        type: string
                        minLength: 3
                        maxLength: 3
                        description: ISO 4217 currency code.
                      date:
                        type: string
                        minLength: 10
                        maxLength: 40
                        description: ISO date YYYY-MM-DD (a time suffix is ignored).
                      kind:
                        type: string
                        enum:
                        - charge
                        - invoice
                        - refund
                        - dispute
                        - fee
                        - adjustment
                        - other
                      group:
                        type: string
                        minLength: 1
                        maxLength: 64
                        description: Lines sharing a group (an invoice) are settled together or not at all.
                settlements:
                  type: array
                  maxItems: 200
                  description: Payouts or bank settlement totals to explain.
                  items:
                    type: object
                    additionalProperties: false
                    required:
                    - id
                    - amount
                    - currency
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 64
                      amount:
                        anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 40
                        - type: number
                      currency:
                        type: string
                        minLength: 3
                        maxLength: 3
                        description: ISO 4217 currency code.
                      date:
                        type: string
                        minLength: 10
                        maxLength: 40
                        description: ISO date YYYY-MM-DD (a time suffix is ignored).
                      itemIds:
                        type: array
                        maxItems: 2000
                        items:
                          type: string
                          minLength: 1
                          maxLength: 64
                        description: Restrict the candidate items for this settlement.
                      feeScheduleIds:
                        type: array
                        maxItems: 20
                        items:
                          type: string
                          minLength: 1
                          maxLength: 64
                        description: Restrict the fee schedules tried for this settlement (e.g. its processor).
                      withholdingIds:
                        type: array
                        maxItems: 20
                        items:
                          type: string
                          minLength: 1
                          maxLength: 64
                        description: Require one of these withholdings; omit to also try none.
                feeSchedules:
                  type: array
                  maxItems: 20
                  description: Candidate fee schedules; the solver reports which one reconciles each settlement. Omit for no fees.
                  items:
                    type: object
                    additionalProperties: false
                    required:
                    - id
                    - rules
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 64
                      description:
                        type: string
                        maxLength: 300
                      source:
                        type: string
                        maxLength: 500
                      rules:
                        type: array
                        maxItems: 20
                        items:
                          type: object
                          additionalProperties: false
                          description: 'First rule whose kinds (default charge, invoice) and currencies match an item sets its fee: percent (or tiers) of |amount| plus a fixed amount, clamped to min and max, signed like the item.'
                          properties:
                            kinds:
                              type: array
                              maxItems: 7
                              items:
                                type: string
                                enum:
                                - charge
                                - invoice
                                - refund
                                - dispute
                                - fee
                                - adjustment
                                - other
                            currencies:
                              type: array
                              maxItems: 40
                              items:
                                type: string
                                minLength: 3
                                maxLength: 3
                                description: ISO 4217 currency code.
                            percent:
                              anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 40
                              - type: number
                              description: Percentage, e.g. 2.9 for 2.9%.
                            fixed:
                              anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 40
                              - type: number
                              description: Fixed fee per item in the item's currency.
                            fixedByCurrency:
                              type: array
                              maxItems: 40
                              items:
                                type: object
                                additionalProperties: false
                                required:
                                - currency
                                - amount
                                properties:
                                  currency:
                                    type: string
                                    minLength: 3
                                    maxLength: 3
                                    description: ISO 4217 currency code.
                                  amount:
                                    anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 40
                                    - type: number
                              description: Per-currency fixed fee; overrides fixed.
                            tiers:
                              type: array
                              maxItems: 20
                              description: Percentage bands on |amount|; amounts above the last upTo use the last band's percent.
                              items:
                                type: object
                                additionalProperties: false
                                required:
                                - percent
                                properties:
                                  upTo:
                                    anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 40
                                    - type: number
                                  percent:
                                    anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 40
                                    - type: number
                            tierMode:
                              type: string
                              enum:
                              - marginal
                              - threshold
                              description: 'marginal: each band charged at its own percent; threshold: the band containing the amount applies to all of it.'
                            min:
                              anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 40
                              - type: number
                            max:
                              anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 40
                              - type: number
                      fixedPerSettlement:
                        anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 40
                        - type: number
                        description: Fixed fee deducted once per settlement, in the settlement currency (rounded to its minor unit).
                      fxMarkupPercent:
                        anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 40
                        - type: number
                        description: 'Spread applied to FX conversions: effective rate = rate x (1 - markup/100).'
                withholdings:
                  type: array
                  maxItems: 20
                  items:
                    type: object
                    additionalProperties: false
                    required:
                    - id
                    - ratePercent
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 64
                      ratePercent:
                        anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 40
                        - type: number
                      base:
                        type: string
                        enum:
                        - gross
                        - net_of_fee
                      kinds:
                        type: array
                        maxItems: 7
                        items:
                          type: string
                          enum:
                          - charge
                          - invoice
                          - refund
                          - dispute
                          - fee
                          - adjustment
                          - other
                fxRates:
                  type: array
                  maxItems: 500
                  description: Direct rates only (1 from = rate to). The latest rate dated on or before the reference date applies; an undated rate is the fallback.
                  items:
                    type: object
                    additionalProperties: false
                    required:
                    - from
                    - to
                    - rate
                    properties:
                      from:
                        type: string
                        minLength: 3
                        maxLength: 3
                        description: ISO 4217 currency code.
                      to:
                        type: string
                        minLength: 3
                        maxLength: 3
                        description: ISO 4217 currency code.
                      rate:
                        anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 40
                        - type: number
                      date:
                        type: string
                        minLength: 10
                        maxLength: 40
                        description: ISO date YYYY-MM-DD (a time suffix is ignored).
                text:
                  type: object
                  additionalProperties: false
                  description: Messy source text for collections not given structurally. A CSV with a header (Stripe balance or payout-reconciliation export, PayPal activity export, bank statement) is parsed by code with no model, and so are headerless lines with one amount each (date, id, amount, currency, and wording that names one kind, such as Payment or Refund); anything else goes to a fast-tier LLM that must quote every row verbatim.
                  properties:
                    items:
                      type: string
                      maxLength: 30000
                    settlements:
                      type: string
                      maxLength: 30000
                    terms:
                      type: string
                      maxLength: 30000
                      description: Fee schedules, tax/withholding rates and FX rates in prose or tables.
                    amountColumn:
                      type: string
                      maxLength: 100
                      description: 'CSV header to read amounts from, e.g. "net" for a Stripe or PayPal export whose payout is the sum of net amounts. Default: the first amount-like column (Amount, then Gross).'
                defaultCurrency:
                  type: string
                  minLength: 3
                  maxLength: 3
                  description: Currency for text rows that state none.
                crossCheck:
                  type: boolean
                  description: Run two independent LLM translations and keep only rows both produced (default true).
                conventions:
                  type: object
                  additionalProperties: false
                  description: 'Restrict the conventions searched (default: all rounding modes x both scopes x both FX date policies).'
                  properties:
                    rounding:
                      type: array
                      minItems: 1
                      maxItems: 3
                      items:
                        type: string
                        enum:
                        - half_up
                        - half_even
                        - truncate
                    scope:
                      type: array
                      minItems: 1
                      maxItems: 2
                      items:
                        type: string
                        enum:
                        - line
                        - total_net
                    fxPolicy:
                      type: array
                      minItems: 1
                      maxItems: 2
                      items:
                        type: string
                        enum:
                        - item_date
                        - settlement_date
                toleranceMinor:
                  type: integer
                  minimum: 0
                  maximum: 1000000
                  description: Accepted |residual| per settlement in minor units (default 0 = exact).
                nearMissToleranceMinor:
                  type: integer
                  minimum: 1
                  maximum: 1000000000
                  description: Largest residual searched when reporting the closest near-miss for an unmatched settlement.
                maxLagDays:
                  type: integer
                  minimum: 0
                  maximum: 3650
                  description: An item may settle at most this many days after its date.
                limits:
                  type: object
                  additionalProperties: false
                  properties:
                    maxSolutions:
                      type: integer
                      minimum: 2
                      maximum: 100
                    maxNodes:
                      type: integer
                      minimum: 1000
                      maximum: 20000000
                    maxMillis:
                      type: integer
                      minimum: 100
                      maximum: 25000
            example:
              text:
                items: 'id,Type,Amount,Currency,Created (UTC)

                  ch_1,charge,100.00,usd,2026-10-01 09:12:44

                  ch_2,charge,250.00,usd,2026-10-01 14:03:10

                  ch_3,charge,40.00,usd,2026-10-02 08:45:31

                  re_1,refund,25.00,usd,2026-10-02 16:20:05'
                settlements: 'id,Amount,Currency,Arrival Date

                  po_1,314.25,usd,2026-10-05'
              feeSchedules:
              - id: stripe_us_card
                rules:
                - percent: '2.9'
                  fixed: '0.30'
      responses:
        '200':
          description: Paid result with provenance
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      verdict:
                        type: object
                        description: Machine-readable call, computed in code. Leads the answer; detail follows in the other fields.
                        properties:
                          action:
                            type: string
                            enum:
                            - RECONCILED
                            - MATCHED_WITH_UNSETTLED_ITEMS
                            - AMBIGUOUS
                            - UNMATCHED_SETTLEMENTS
                            - SEARCH_INCOMPLETE
                            - INSUFFICIENT_INPUT
                          reason_code:
                            type: string
                            description: Stable code for why this action was returned.
                          confidence:
                            anyOf:
                            - type: number
                            - type: 'null'
                            description: 0-1; null when no judgment was made.
                          confidence_label:
                            type: string
                            enum:
                            - low
                            - medium
                            - high
                          edge_bps:
                            anyOf:
                            - type: number
                            - type: 'null'
                            description: Expected edge in bps of cost; null when not priced.
                          edge_usd:
                            anyOf:
                            - type: number
                            - type: 'null'
                            description: 'Expected edge in USD (cover-claim: cover-asset units); null when not priced.'
                          size_usd:
                            anyOf:
                            - type: number
                            - type: 'null'
                            description: Suggested stake in USD; null when not sized.
                          headline:
                            type: string
                          drivers:
                            type: array
                            items:
                              type: string
                          next_step:
                            type: string
                          partial:
                            type: boolean
                            description: True when part of the analysis could not run; see missing.
                          missing:
                            type: array
                            items:
                              type: string
                      disclaimer:
                        type: string
                        description: Not financial advice.
                      status:
                        type: string
                        enum:
                        - UNIQUE
                        - AMBIGUOUS
                        - NO_EXACT_MATCH
                        - BUDGET_EXCEEDED
                        - INSUFFICIENT_INPUT
                        description: UNIQUE only when the search completed and exactly one assignment exists.
                      deterministic:
                        type: boolean
                        description: True when no LLM touched the verdict path (structured, CSV or line-grammar input).
                      reconciled:
                        type: boolean
                        description: Every settlement matched and no item left unsettled.
                      summary:
                        type: object
                      solution:
                        anyOf:
                        - type: object
                        - type: 'null'
                        description: The recommended assignment (lowest date lag among the reported solutions); null when no settlement matched.
                      alternatives:
                        type: array
                        items:
                          type: object
                      ambiguity:
                        type: object
                      conventions:
                        type: object
                        description: Which rounding mode / scope / FX policy reproduces the settlements.
                      discrepancies:
                        type: object
                        description: Unsettled items, phantom settlements, residuals, closest near-misses.
                      budget:
                        type: object
                      audit:
                        type: object
                        description: Solver, budgets, statistics, canonical input hash and the hash-chained step list.
                      translation:
                        type: object
                      notes:
                        type: array
                        items:
                          type: string
                  _provenance:
                    type: object
                    description: C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance
                required:
                - data
                - _provenance
        '400':
          description: Invalid request (no payment consumed)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
        '401':
          description: Invalid X-API-KEY
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
        '402':
          description: Payment required or invalid
          content:
            application/json:
              schema:
                type: object
                description: x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)
                properties:
                  x402Version:
                    type: integer
                  error:
                    type: string
                  code:
                    type: string
                  resource:
                    type: object
                  accepts:
                    type: array
                    items:
                      type: object
                  extensions:
                    type: object
        '502':
          description: Upstream failure; the payment is released or not settled
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
      tags:
      - Reconcile Ledger
components:
  securitySchemes:
    x402:
      type: apiKey
      in: header
      name: PAYMENT-SIGNATURE
      description: x402 v2 payment payload (base64) sent after a 402 challenge
    apiKey:
      type: apiKey
      in: header
      name: X-API-KEY