Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
Ramp API field-shape verification (Task 1) — resolved from the OpenAPI spec
Date: 2026-08-28
Source of truth: https://docs.ramp.com/openapi/developer-api.json (downloaded, 2.2 MB,
parsed directly — NOT a single-pass doc read). Every claim below is grounded in a named
schema in that file.
Why now: originally the live sandbox was blocked (no scopes); the OpenAPI contract resolved
the shapes. UPDATE 2026-08-28: Brad granted the scopes and everything below was then RE-CONFIRMED
LIVE — see the LIVE-VERIFIED section immediately below.
★ LIVE-VERIFIED (2026-08-28, scopes granted) ★
Re-confirmed against the live sandbox (demo-api.ramp.com), not just the spec:
- Amount: real txn
amount: 431.68(deprecated dollar float) vsentity_amount:{value:43168}(cents). Theentity_amountfix is correct — the old code posted 1/100th. - Coding:
line_items[].accounting_field_selections[].category_info.type == "GL_ACCOUNT"withexternal_id= the Carbon account.id. Thecategory_info.typefix is correct. The coding is online_items[](mirrored inaccounting_categories), NOT top-levelaccounting_field_selections([]). The list endpoint DOES returnline_items. - Install/converge live: connection "linked" (remote_provider_name "Carbon"), 79-account CoA
pushed with correct
classification(CREDCARD/EXPENSE/…), cost-center field created. - Pull live: 5 transfers → Payment cardTransactions; a coded USD charge → Charge cardTransaction ($350 → Advertising), posted + balanced + Ramp-mapped.
- 3 MORE real bugs found via live testing (all fixed + PROVEN):
pushChartOfAccounts(service.ts) — SAME.eq("companyId")-on-accountbug → 0 accounts pushed. Fixed via companyGroupId (79 pushed after fix).ramp-sync.ts buildTransactionLinesaccount verification — SAME bug → every coded charge failed. Fixed via companyGroupId.getJobDatabaseClient(jobs/db.ts) POOL POISONING: the accounting sweepspool.end()the shared cached size-5 pool; the client cache kept a Kysely over the dead pool → every later ramp-sync threw "Cannot use a pool after calling end on the pool". Fixed to rebuild onending.
- Foreign-currency charge edge case (documented, NOT fixed): a txn whose merchant currency ≠
settlement currency has its single
line_item.amountin MERCHANT currency while the header uses settlemententity_amount→ the post-card-transaction line-sum check rejects it. USD-only posts fine.
Credential / scope provisioning (was the standing blocker — RESOLVED)
- Sandbox host
demo-api.ramp.comis correct. Token mint works and returns a 10-day token; the token endpoint does not validate scope grants at mint — the resource call is the real gate (403DEVELOPER_7100when a scope is ungranted). Scopes are a Ramp-side dashboard config; Brad granted them 2026-08-28, which unblocked everything above.demo.ramp.com(the product demo UI) does not expose developer-API/scope management — that is a separate developer surface.
FIXED in this pass (inbound path — applied to the working tree, uncommitted)
1. Transaction amount is a DEPRECATED dollar float, not minor-unit cents — CRITICAL
- Spec:
Transaction.amount=type: number,deprecated: true, desc "Deprecated. Useentity_amount." The replacemententity_amountis anApiSignedAmount = { currency, value:int }whosevalueis "in the smallest denomination (e.g. cents for USD)" and signed. - Code assumed:
RampTransactionSchema.amount: z.number()read as minor units; the card family didfromMinorUnits(tx.amount)(÷100). A $150.00 charge →fromMinorUnits(150)= $1.50. Every card transaction posted at 1/100th of its real value. - Fix applied:
models.tsaddsRampSignedAmountSchema+entity_amount/merchant_amountonRampTransactionSchema;ramp-sync.tstoMinorUnitsnow reads.value(ApiSignedAmount) and.amount(CurrencyAmount); the card family readstoMinorUnits(tx.entity_amount)first, falling back to the deprecatedamountonly when entity_amount is absent (no settlement currency). Currency now prefersentity_amount.currency.
2. accounting_field_selections[].type is at .category_info.type — CRITICAL
- Spec:
ApiTransactionAccountingFieldSelectionhas NO top-leveltype. The type iscategory_info.type(ApiTransactionAccountingCategoryInfo.type, enum incl.GL_ACCOUNT,COST_CENTER). The selection's ownexternal_idis the pushed Carbon option id (account.id). - Code assumed:
codeSelectionsreadselection.type— always undefined → no line ever resolved an account/cost-center; every line failed "uncoded" in production. - Fix applied:
models.tstypescategory_infoasRampAccountingCategoryInfoSchema;codeSelectionsreadsselection.category_info?.type ?? selection.type.
3. (Separate, live-PROVEN bug) post-card-transaction account query over-scoped by companyId
post-card-transaction/index.tsfilteredaccountby.eq("companyId", companyId), butaccount(chart of accounts) is companyGroup-scoped — nocompanyIdcolumn, PK isidalone. Every post/void 500'd "Failed to fetch card transaction accounts". Fixed to filter byidonly (matches post-purchase-invoice / post-memo). Proven end-to-end: posted je_5ytNrRw89H6GvcjxCAXo1b (balanced), then voided.
MATCHES confirmed (no change needed)
POST /accounting/accountsbody keygl_accounts— code sends{ gl_accounts: batch }✓.classificationenum =ANY/ASSET/CREDCARD/EQUITY/EXPENSE/LIABILITY/REVENUE/UNKNOWN—rampClassificationForClass+ CREDCARD for the card-liability account ✓.POST /accounting/syncsbody{ sync_type, idempotency_key, successful_syncs, failed_syncs }—confirmSyncssends exactly these keys ✓.GET /accounting/all-connectionspath ✓.POST /bills/drafts/{id}/submit✓.POST /purchase-orders/{id}/archive✓ (archivePurchaseOrdercorrect).- Error envelope
{ error_v2: { message, error_code, error_id, additional_info, notes } }— client parseserror_v2.error_code/message✓. POST /bills/draftsbody — CORRECT.PartialApiCreateDraftBillParamsRequestBodyDOES accept top-levelremote_id, plusinvoice_number,invoice_currency,issued_at,due_at,line_items,vendor_id(required). The invoice→Ramp draft-bill push body is fine. (Only nit:document_urlsis not a body field — PDF attaches go viaPOST /bills/drafts/{id}/attachments. Already flagged as a placeholder in code; harmless.)
MISMATCHES to fix (OUTBOUND push — NOT applied; need product decisions + live verify)
A. POST /purchase-orders body is broken (pushPurchaseOrder, service.ts ~820)
ApiPurchaseOrderCreateParamsRequestBody: required [currency, entity_id, line_items, three_way_match_enabled]; matching id field is external_id, not remote_id.
- Code sends
remote_id: po.id→ ignored → Ramp bill↔PO matching silently never works. Change toexternal_id: po.id. - Code OMITS required
currencyandthree_way_match_enabled→ POST 400s. Add both (three_way_match_enableddefault is a product decision — likelyfalse). entity_idis required but sent conditionally → 400 for single-entity companies. Decide a default entity.- Line items: code sends
{ description, quantity, unit_price, remote_id }; create params useexternal_id(notremote_id) andunit_quantity(notquantity) per the create schema. => The PO-push feature is currently non-functional end to end. Fix + sandbox-verify together.
B. archiveBill targets a nonexistent endpoint (client.ts ~413, used service.ts ~939)
POST /bills/{id}/archive does NOT exist. Bills expose DELETE /bills/{id}, POST /hold,
POST /release (only purchase-orders have /archive). The archive-on-settlement step for a
pushed draft bill 404s. Recommend DELETE /developer/v1/bills/{id} (withdraw the pending
bill). Confirm Ramp's intended "retract a submitted-but-unpaid bill" verb against sandbox.
Other inbound shapes confirmed (schemas exist; values want a live pass)
- Bills:
GET /billshas BOTHsync_status(enum:BILL_AND_PAYMENT_SYNCED,BILL_SYNCED,NOT_SYNCED— noSYNC_READY) and async_readybool. Code filters onsync_ready/not-synced — align the not-synced check tosync_status === "NOT_SYNCED". - Reimbursements:
useris FLAT (user_id,user_email,user_full_name,employee_id), not a nested object;statehas 23 values incl.REIMBURSED,MANUALLY_REIMBURSED,REIMBURSED_VIA_PUSH(no plainPAID); query supportssync_status,sync_ready,updated_after,direction,user_id. VerifyresolveEmployeeSupplierreads the flat fields. - Repayments:
GET /repaymentsschemaRepayment={ id, entity_id, funding_method (free string), original_transaction_id, repaid_at, repayment_amount (CurrencyAmount), status, user_id, user_signature };statusenumAWAITING_MANUAL_REPAYMENT/AWAITING_PAYMENT/NONE/REPAID/ REPAYMENT_FAILED/REQUESTED_BY_REVIEWER; queryfrom_repaid_at/to_repaid_at/funding_methods. Matches the cursor design. - Webhooks:
POST /webhooksreturnssecret;POST /webhooks/{id}/verifyis a{challenge}echo. TheX-Ramp-Signatureheader name + HMAC encoding (hex vs base64, what is signed) is NOT in the OpenAPI spec — remains the one genuinely sandbox-only unknown for the webhook route. - Transfers/cashbacks amounts are
CurrencyAmountobjects ({ amount:int cents, currency_code }); the union schema +toMinorUnitsalready handle that shape.
Bottom line
The two most damaging inbound bugs (100× amount understatement; no line coding) plus the live account-scoping 500 are fixed and (for the last) proven end to end. The outbound PO-push + bill-archive mismatches are real and spec-confirmed but need a product decision and a live sandbox pass, so they are documented, not blind-patched. Webhook signature encoding is the only field that the public docs cannot resolve.