canonical: https://jentic.com/apis/codat.io/sync-for-expenses

# Codat Sync for Expenses API

Codat's Sync for Expenses API lets corporate card and spend management platforms write expense transactions into a customer's accounting software with the right account mapping, tax rate, and tracking category applied. It manages partner-expense connections, mapping options, sync triggers, and per-transaction status so the platform can show finance teams exactly which expenses reached the ledger and which need attention. It is used by card issuers, expense apps, and travel-and-expense platforms that want one accounting integration covering QuickBooks, Xero, and Sage.

## For AI agents

Push expense transactions from a card or spend management platform into a customer's accounting software with correct account, tax, and category mapping.

## Scope

Does not handle commerce sales sync, accounting ledger reads, or payment processing - use for posting expense transactions from a partner platform into accounting software with correct GL mapping only.

## Capabilities

- Configure a Sync for Expenses connection between the partner platform and the customer's accounting system
- Push expense transactions into the linked accounting platform with mapped account, tax rate, and tracking category
- Read mapping options so the partner platform can present the correct GL accounts and tax rates to users
- Trigger sync runs and monitor sync status at company, latest, and per-sync granularity
- Inspect per-transaction status to identify which expense lines posted successfully and which failed
- Manage partner-expense connections that link a customer's account on the partner platform to their accounting platform

## Use cases

### Corporate Card Expense Sync

Card issuers and corporate card platforms use Sync for Expenses to write each cardholder transaction into the customer's accounting ledger automatically. The /companies/{companyId}/sync/expenses/syncs endpoint triggers a run and the /sync/expenses/syncs/{syncId}/status endpoint exposes per-transaction status so the finance team sees what posted and what needs review.

Example prompt: Trigger a sync for company {companyId}, then retrieve the latest sync status and list any transactions that failed to post.

### Travel and Expense Platform Reconciliation

Travel-and-expense apps use Sync for Expenses to write approved expense reports into accounting platforms with correct GL coding. The /sync/expenses/mappingOptions endpoint surfaces the chart of accounts and tax rates available in the destination, letting the platform offer accurate dropdowns at submission time so each expense lands in the right account when synced.

Example prompt: Fetch mapping options for company {companyId} and return the available GL accounts and tax rates for use in the expense submission UI.

### Spend Management Reliability Monitoring

Spend management ops teams monitor sync reliability through the status endpoints. /sync/expenses/syncs/list/status and /sync/expenses/syncs/lastSuccessful/status surface health across customers so the team can investigate failed syncs before the customer's finance team notices the missing entries.

Example prompt: List the status of the last 50 syncs for company {companyId} and report any with status other than 'Success'.

### AI Agent Expense Reconciliation

AI agents that handle expense reconciliation use Sync for Expenses through Jentic to remediate failed posts. The agent searches Jentic for 'expense sync status', loads the operation, identifies failed transactions, and triggers a re-sync after correcting the mapping. Jentic isolates the Codat API key in its vault.

Example prompt: Search Jentic for 'sync for expenses status', load the operation, and identify expenses for company {companyId} that failed in the last run.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /companies/{companyId}/sync/expenses/config | Read sync configuration for a company |
| POST | /companies/{companyId}/sync/expenses/connections/partnerExpense | Create a partner-expense connection |
| GET | /companies/{companyId}/sync/expenses/mappingOptions | List available accounts, tax rates, and tracking categories |
| POST | /companies/{companyId}/sync/expenses/syncs | Trigger a sync run |
| GET | /companies/{companyId}/sync/expenses/syncs/lastSuccessful/status | Check the last successful sync status |
| GET | /companies/{companyId}/sync/expenses/syncs/{syncId}/status | Get per-transaction status for a specific sync run |

## Key resources

- **Connections** — Manage partner-expense connections between the partner platform and accounting destination
- **Configuration** — Read and write the per-company sync configuration
- **Mapping options** — Surface the chart of accounts, tax rates, and tracking categories available for mapping
- **Sync** — Trigger sync runs that push expenses to the accounting platform
- **Sync status** — Inspect status at the latest, last successful, and listed-syncs level
- **Expenses** — Submit individual expense transactions for sync
- **Transaction status** — Per-transaction status within a given sync run

## Why Jentic

- **Setup:** Wiring Codat Sync for Expenses by hand means building its Basic API-key header, targeting api.codat.io, and threading companyId through mapping-option reads, sync creation, and status polling yourself. Through Jentic you install once, import the Sync for Expenses API from the API Directory, store the Codat API key once, and your agent calls it.
- **Permission scoping:** Sync for Expenses puts the company id in the URL path (/companies/{companyId}/sync/expenses/...), so a rule can pin your agent to one company: it reads that company's expense sync config, mapping options, and sync status and nothing else. You choose the operations it may call, so triggering a new expense sync is only in the allowed set if you add it.
- **Credential handling:** Your Codat API key is stored once, encrypted, by your own Jentic One instance and injected at execution time as the Basic Authorization header. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'sync expenses to accounting software' or 'check the last successful expense sync', and Jentic returns the matching Sync for Expenses operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Codat Accounting API** — Provides full read and write access to the accounting ledger that Sync for Expenses posts into
- **Codat Sync for Commerce** — Pushes commerce sales rather than expenses into accounting platforms
- **Codat Bank Feeds** — Posts transactions as a native bank feed rather than as expense entries

## FAQ

### What authentication does the Sync for Expenses API use?

The API uses an API key passed in the Authorization header as 'Basic <base64-encoded-key>'. The single security scheme in the spec is named auth_header. Through Jentic, the Codat API key is stored encrypted in the vault and the Authorization header is constructed at execution time.

### Can I push corporate card transactions into QuickBooks with this API?

Yes. After creating a partner-expense connection via /companies/{companyId}/sync/expenses/connections/partnerExpense, push expenses through the sync endpoints under /companies/{companyId}/sync/expenses. The transactions arrive in QuickBooks with the GL account, tax rate, and tracking category applied based on the mapping options you supply.

### What are the rate limits for the Sync for Expenses API?

Codat does not publish a fixed rate limit in the OpenAPI spec; limits are governed at the company and connection level and depend on the destination accounting platform's own limits. Codat returns HTTP 429 with a Retry-After header when limits are hit and recommends exponential backoff.

### How do I check why an expense transaction failed to post through Jentic?

Search Jentic for 'expense sync transaction status', load the GET /companies/{companyId}/sync/expenses/syncs/{syncId}/status operation, and execute it with the sync ID. Install with pip install jentic and use the standard async search, load, and execute flow.

### Which accounting platforms does Sync for Expenses support?

Sync for Expenses supports QuickBooks Online, Xero, and Sage as primary destinations using the same endpoint surface. The destination is selected when the partner-expense connection is created, and the mapping options endpoint returns the destination-specific chart of accounts.

### Note that the API spec marks this API version as 'prealpha' - is it production-ready?

The OpenAPI spec exposes version 'prealpha' in info.version, indicating Codat may still iterate on the surface. Production deployments should pin to the spec version they tested against and watch for breaking changes; through Jentic the loaded schema is versioned with the spec used at search time.

### Can I limit what my agent is allowed to do with the Sync for Expenses API?

Yes. Because you run Jentic One yourself, your own rules decide which Sync for Expenses operations the agent may call and which Codat credentials it may use. Since the company id sits in the URL path (/companies/{companyId}/sync/expenses/...), you can pin the agent to a single company and give it read-only access to that company's sync configuration, mapping options, and sync status. Triggering a new expense sync via POST /companies/{companyId}/sync/expenses/syncs is only in the allowed set if you add it, so the agent cannot post to the ledger unless you grant that operation.
