{"openapi":"3.1.0","info":{"title":"Crypto Payments API","version":"1.0.0","description":"Reconcile caller-supplied stablecoin payment records against invoices. Underpayments, overpayments, duplicate transaction hashes, and token, recipient, or chain mismatches are reported from the records in the request. No network calls are made. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses the x402 protocol with exact USDC on Base (chain id 8453). Each POST operation has a fixed USD price.\nHow to call an operation:\n1. POST JSON matching the requestBody. Invalid input returns 400 with no payment challenge.\n2. A valid unpaid call returns 402 with the exact amount and payTo.\n3. Pay and retry with payment-signature. Payment settles only if the operation returns 2xx. A 4xx/5xx is not charged.\nInclude an Idempotency-Key header of 64 hex characters from 32 random bytes. Reuse that key only for retries of the same operation and request body.\nAll outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Verify time-sensitive or official data with the cited source before acting."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/crypto-payments/stablecoin-payment-reconcile":{"post":{"operationId":"reconcile_stablecoin_payment","summary":"Reconcile stablecoin payment","description":"Reconcile caller-supplied stablecoin payment records against invoices. Compares amounts, token, recipient, and chain ID, and reports underpayments, overpayments, duplicate transaction hashes, and payments that are not linked to an invoice. reconciliation_status is matched, underpaid, overpaid, duplicate, mismatched, or incomplete. Amounts are integers in smallest units. No chain is queried, and a transaction hash is not treated as confirmation that funds arrived.","tags":["crypto-payments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"invoices":{"minItems":1,"maxItems":40,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"chainId":{"type":"integer","exclusiveMinimum":0,"maximum":2147483647},"recipient":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"tolerance":{"type":"string"}},"required":["id","amount","decimals","token","chainId","recipient"],"additionalProperties":false}},"payments":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"invoiceId":{"type":"string","minLength":1,"maxLength":80},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"chainId":{"type":"integer","exclusiveMinimum":0,"maximum":2147483647},"recipient":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"transactionHash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"timestamp":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"}},"required":["amount","decimals","token","chainId","recipient"],"additionalProperties":false}},"rules":{"type":"object","properties":{"allowPartial":{"type":"boolean"},"tolerance":{"type":"string"},"associateUnlabeledPayments":{"type":"string","enum":["none","single_invoice"]}},"additionalProperties":false}},"required":["invoices","payments"],"additionalProperties":false},"example":{"invoices":[{"id":"INV-100","amount":"1000000","decimals":6,"token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","chainId":8453,"recipient":"0x1111111111111111111111111111111111111111"}],"payments":[{"id":"p1","invoiceId":"INV-100","amount":"600000","decimals":6,"token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","chainId":8453,"recipient":"0x1111111111111111111111111111111111111111","transactionHash":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","timestamp":"2026-11-05T12:00:00.000Z"},{"id":"p2","invoiceId":"INV-100","amount":"300000","decimals":6,"token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","chainId":8453,"recipient":"0x1111111111111111111111111111111111111111","transactionHash":"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"},{"id":"p3","amount":"1000000","decimals":6,"token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","chainId":8453,"recipient":"0x2222222222222222222222222222222222222222","transactionHash":"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"}],"rules":{"allowPartial":true,"tolerance":"0","associateUnlabeledPayments":"none"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"reconciliation_status":{"type":"string"},"expected_amount":{"type":"string"},"received_amount":{"type":"string"},"outstanding_amount":{"type":"string"},"invoices":{"type":"array","items":{"type":"object","properties":{"invoice_id":{"type":"string"},"reconciliation_status":{"type":"string"},"expected_amount":{"type":"string"},"received_amount":{"type":"string"},"outstanding_amount":{"type":"string"}},"additionalProperties":true}},"matched_payments":{"type":"array","items":{"type":"object","properties":{"invoice_id":{"type":"string"},"payment_id":{"type":"string"},"transaction_hash":{"type":"string"},"timestamp":{"type":"string"},"amount":{"type":"string"},"decimals":{"type":"number"},"token":{"type":"string"},"chain_id":{"type":"number"},"recipient":{"type":"string"},"applied_amount":{"type":"string"}},"additionalProperties":true}},"unmatched_payments":{"type":"array","items":{"type":"object","properties":{"payment_id":{"type":"string"},"transaction_hash":{"type":"string"},"amount":{"type":"string"},"decimals":{"type":"number"},"token":{"type":"string"},"chain_id":{"type":"number"},"recipient":{"type":"string"},"reason":{"type":"string"}},"additionalProperties":true}},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"reconciliation_status":"underpaid","expected_amount":"1000000","received_amount":"900000","outstanding_amount":"100000","invoices":[{"invoice_id":"INV-100","reconciliation_status":"underpaid","expected_amount":"1000000","received_amount":"900000","outstanding_amount":"100000"}],"matched_payments":[{"invoice_id":"INV-100","payment_id":"p1","transaction_hash":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","timestamp":"2026-11-05T12:00:00.000Z","amount":"600000","decimals":6,"token":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","chain_id":8453,"recipient":"0x1111111111111111111111111111111111111111","applied_amount":"600000"},{"invoice_id":"INV-100","payment_id":"p2","transaction_hash":"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","amount":"300000","decimals":6,"token":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","chain_id":8453,"recipient":"0x1111111111111111111111111111111111111111","applied_amount":"300000"}],"unmatched_payments":[{"payment_id":"p3","transaction_hash":"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","amount":"1000000","decimals":6,"token":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","chain_id":8453,"recipient":"0x2222222222222222222222222222222222222222","reason":"not_associated"}],"findings":[{"code":"not_associated","severity":"medium","detail":"A payment has no invoice id, so it was not applied."},{"code":"underpaid","severity":"medium","invoice_id":"INV-100","detail":"Invoice INV-100 received 900000 of 1000000 in its smallest units."}],"limitations":["Only the invoice and payment records in this request were compared. No balance or transaction was read from a chain.","A transaction hash is not confirmation that funds arrived or that the transfer is final.","Amounts are integers in each record's smallest unit. They are scaled by the supplied decimals with integer arithmetic.","A payment is applied to an invoice only when invoiceId matches, or when associateUnlabeledPayments is single_invoice and the request contains one invoice.","Partial payments are added together unless rules.allowPartial is false.","Timestamps were not checked against a block time."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object: x402Version, resource with the operation description, accepts with the price and network, and extensions.bazaar with the input schema, input example, output schema, and output example."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed before settlement, so no payment is taken. Reuse the same idempotency key to retrieve the stored error without paying again."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/crypto-payments/invoice-match-score":{"post":{"operationId":"score_invoice_payment_match","summary":"Score invoice payment match","description":"Match caller-supplied payments to invoice amounts, due dates, and fee rates in basis points. Accuracy gives 60 points to the amount, 20 to paying on time, and 20 to the fee. The discrepancy is the invoice total minus the linked payments. No chain is queried.","tags":["crypto-payments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"invoices":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"amount":{"type":"integer","minimum":0,"maximum":9007199254740991},"due_on":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fee_bps":{"type":"integer","minimum":0,"maximum":10000}},"required":["id","amount"],"additionalProperties":false}},"payments":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"invoice_id":{"type":"string","minLength":1,"maxLength":80},"amount":{"type":"integer","minimum":0,"maximum":9007199254740991},"paid_on":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fee":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["invoice_id","amount"],"additionalProperties":false}}},"required":["invoices","payments"],"additionalProperties":false},"example":{"invoices":[{"id":"INV-100","amount":1000000,"due_on":"2026-04-01","fee_bps":100}],"payments":[{"invoice_id":"INV-100","amount":970000,"paid_on":"2026-04-03","fee":20000}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"reconciliation_accuracy_score":{"type":"number"},"discrepancy_amount":{"type":"number"},"fee_variance_percentage":{"type":"number"}},"additionalProperties":true},"example":{"reconciliation_accuracy_score":58,"discrepancy_amount":30000,"fee_variance_percentage":100}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object: x402Version, resource with the operation description, accepts with the price and network, and extensions.bazaar with the input schema, input example, output schema, and output example."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed before settlement, so no payment is taken. Reuse the same idempotency key to retrieve the stored error without paying again."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}