For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inBook a demo
HomeGuidesAPI ReferenceGlossary
HomeGuidesAPI ReferenceGlossary
      • Creating and Managing Payers (C2s)
      • Creating and Managing Vendors (C3s)
      • Creating Payouts via API
      • Invoices
      • Batch Payments
      • Recurring Payments
      • Approval Policies
      • Email Inbox
      • GL Accounts
      • Vendor Credits
      • Accounting Sync
Logo
Sign inBook a demo
On this page
  • Setting Up GL Accounts
  • Using GL Accounts
  • Using AI to Predict GL Accounts
Accounts Payable

GL Accounts

Was this page helpful?
Previous

Vendor Credits

Next
Built with

GL (General Ledger) accounts can be used to categorize line items on invoices for accounting purposes. Mercoa provides functionality to manage GL accounts and optionally use AI to predict appropriate GL accounts for invoice line items.

Setting Up GL Accounts

GL accounts are stored in entity metadata. To add or update GL accounts for an entity, update the entity’s glAccountId metadata key with an array of GL account objects:

Plain string values:

POST
/entity/:entityId/metadata/:key
1curl -X POST https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/metadata/glAccountId \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '[
5 "{key: '\''60205'\'', value: '\''60205 Marketing Expense'\''}",
6 "{key: '\''60215'\'', value: '\''60215 Office Expense'\''}",
7 "{key: '\''60225'\'', value: '\''60225 Payroll Expense'\''}",
8 "{key: '\''60550'\'', value: '\''60550 Rent Expense'\''}"
9]'
Try it

JSON values with subtitles:

POST
/entity/:entityId/metadata/:key
1curl -X POST https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/metadata/glAccountId \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '[
5 "{key: '\''60205'\'', value: {value: '\''60205 Marketing Expense'\'', subtitle: '\''Expense'\''}}",
6 "{key: '\''60215'\'', value: {value: '\''60215 Office Expense'\'', subtitle: '\''Expense'\''}}",
7 "{key: '\''60225'\'', value: {value: '\''60225 Payroll Expense'\'', subtitle: '\''Expense'\''}}",
8 "{key: '\''60550'\'', value: {value: '\''60550 Rent Expense'\'', subtitle: '\''Expense'\''}}"
9]'
Try it

GL Accounts can also be automatically synced using Accounting Sync.

Using GL Accounts

If you use Mercoa’s React Component Library, line items show a dropdown of GL accounts for the entity.

When selected, the glAccountId is added to the line item as a special glAccountId field in the lineItem object. It’s not added to the lineItem.metadata object.

This glAccountId field can be used to filter invoices by GL account.

Using AI to Predict GL Accounts

Mercoa can use AI to predict GL accounts for line items.

To enable this:

  1. Make sure the entity has a glAccountId metadata key set with the list of GL accounts provided in the previous section.
  2. Make sure the predictMetadata is set to true for the entity (defaults to true).
  3. Make sure all lineItem ocr fields are set to true (defaults to true).

Mercoa needs the user to manually tag the GL accounts for the first invoice. Once the initial invoice is created and manually tagged with GL accounts, the AI can predict line item GL accounts for new invoices from the same vendor.