Skip to main content
All use cases
Procurement / APOperations

Contas a pagar runs itself. The audit trail writes itself.

The buying agent ingests each supplier invoice, validates the counterparty's CNPJ, matches it against the ERP entry, and schedules Pix or boleto for the due date. Every payment runs inside a signed budget mandate with a revocation key, and closes back into the ledger with the NF-e attached. Nothing is paid twice; nothing is paid blind.

BeforeInbox of boletos → manual approval chain
AfterMandated agent → paid on the due date, sealed
3-way
invoice · ERP · payment match
Try it in the Sandbox
CNPJ
Validated first
Counterparty checked before anything is scheduled
Pix · boleto
Payment rails
Scheduled to each invoice's due date
Budget cap
Signed mandate
Spend stops at the approved ceiling
NF-e
Attached
Fiscal doc sealed to every payment
What the CFO sees

Every payment answers who, why, and under which budget.

One supplier invoice, end to end: the agent validates the supplier's CNPJ, matches the invoice to its ERP entry, schedules Pix for the due date, and pays under the operations mandate. The receipt binds the payment to the NF-e and to the mandate that authorized it — an audit answer, not a bank-statement line.

  • Three-way match — invoice, ERP entry, payment — before any money moves
  • Due-date scheduling on Pix or boleto, not month-end batch runs
  • The receipt binds NF-e, Pix endToEndId and mandate for the auditor

Pay everything due this week from the operations budget.

Seven invoices due — validating each supplier, matching the ERP entries, and scheduling Pix inside the R$80,000 July mandate.

Supplier invoice · contas a pagar
INV-2093 · Metalúrgica Prisma
Paid · reconciled
FornecedorCNPJ 43.210.987/0001-55
ValorR$ 12.480,00
VencimentoFriday · paid on the day
Mandatocm_ops…8Q1 · cap R$ 80.000
PixE2E c07d…41a
nfe-2093.xmlreceipt-inv2093.json
paid · reconciled · sealedrcp_ap2093
The pain

The conversation is the easy part.

Accounts payable is an approval chain wearing a spreadsheet. Invoices arrive by email, someone retypes them into the ERP, someone else approves on WhatsApp, and finance discovers the duplicates at month close. It is slow where it should be boring, and blind exactly where it should be auditable.

Retype every emailed boleto into the ERP and the bank portal

The agent ingests the invoice and matches it to its ERP entry

Approve payments ad hoc on WhatsApp with no spend ceiling

A signed mandate caps the budget; the agent cannot exceed it

Pay in batch runs — early and lose float, or late and eat fines

Pix or boleto scheduled to each invoice's own due date

Reconcile bank statement to ERP by hand at month close

Every payment closes back reconciled with the NF-e attached

How the agent does it

The buying agent, governed end to end.

codespar_kyc validates the supplier before anything is scheduled. codespar_pay executes Pix or boleto on the due date under the operations mandate — a signed budget with a revocation key, not a shared bank login. codespar_ledger closes the loop: payment, NF-e and ERP entry reconciled into one sealed record per invoice.

01
Ingest
Email / ERP

Invoice + NF-e captured

02
Validate
codespar_kyc

Supplier CNPJ verified

KYC rail
03
Match
Omie

Invoice ↔ ERP entry

04
Pay
codespar_pay

Pix on due date · mandate

Pix rail
05
Reconcile
codespar_ledger

NF-e + E2E sealed

Audit ledger
Architecture

Invoices enter from email or the ERP. The agent validates the counterparty, three-way-matches invoice, ERP entry and payment schedule, then executes on Pix or boleto under the tenant's operations mandate. Settlement correlation matches the bank confirmation back to the invoice and seals payment, NF-e and mandate into one audit record.

In code

A few lines. The whole loop.

accounts-payable.ts
const session = await codespar.sessions.create();

for (const invoice of dueThisWeek) {
  // no valid supplier, no payment — checked before scheduling
  await session.execute("codespar_kyc", { taxId: invoice.supplier.cnpj });

  await session.execute("codespar_pay", {
    rail: invoice.boleto ? "boleto" : "pix",
    amount: invoice.total,
    scheduledFor: invoice.dueDate,     // paid on the day, not in a batch
    mandate: "cm_ops",                 // signed budget · revocable
    attach: { nfe: invoice.nfeXml },   // fiscal doc rides with the payment
  });
}

// each payment: matched, mandate-checked, reconciled, sealed
3-way · sealedreceipt · rcp_accoun
Featured tools
codespar_pay

Pays Pix or boleto on the due date, inside the signed operations mandate.

codespar_kyc

Validates the supplier's CNPJ before any payment is scheduled.

codespar_ledger

Reconciles payment, NF-e and ERP entry into one sealed audit record.

See the meta-tool reference

Ship it this afternoon.

Open the sandbox, point a session at your providers, and run the whole loop against real rails in minutes — not the quarter it takes to build it by hand.

Accounts payable agent — CodeSpar | CodeSpar