jaz-clio 9.8.3 → 9.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/skills/api/SKILL.md +31 -433
- package/assets/skills/api/references/dependencies.md +1 -2
- package/assets/skills/api/references/errors.md +7 -10
- package/assets/skills/api/references/feature-glossary.md +2 -2
- package/assets/skills/api/references/field-map.md +3 -1
- package/assets/skills/api/references/orders.md +2 -2
- package/assets/skills/api/references/rules-bulk-recon-drafts.md +108 -0
- package/assets/skills/api/references/rules-entities-quick-fix.md +108 -0
- package/assets/skills/api/references/rules-fundamentals.md +131 -0
- package/assets/skills/api/references/rules-search-magic-shapes.md +108 -0
- package/assets/skills/cli/SKILL.md +5 -3
- package/assets/skills/cli/references/agent-gotchas.md +1 -1
- package/assets/skills/cli/references/command-catalog.md +1 -1
- package/assets/skills/cli/references/common-workflows.md +1 -1
- package/assets/skills/conversion/SKILL.md +5 -3
- package/assets/skills/jaz-api-reference/SKILL.md +51 -0
- package/assets/skills/jaz-api-reference/references/endpoints-assets-payroll.md +367 -0
- package/assets/skills/jaz-api-reference/references/endpoints-banking-magic.md +500 -0
- package/assets/skills/jaz-api-reference/references/endpoints-bulk-edits.md +362 -0
- package/assets/skills/jaz-api-reference/references/endpoints-master-data.md +776 -0
- package/assets/skills/jaz-api-reference/references/endpoints-schedules-reports.md +442 -0
- package/assets/skills/jaz-api-reference/references/endpoints-transactions.md +831 -0
- package/assets/skills/jaz-api-reference/references/endpoints.md +164 -0
- package/assets/skills/{api → jaz-api-reference}/references/full-api-surface.md +13 -111
- package/assets/skills/{api → jaz-api-reference}/references/search-enums.md +1 -1
- package/assets/skills/{api → jaz-api-reference}/references/search-reference.md +1 -9
- package/assets/skills/jaz-kit/SKILL.md +2 -1
- package/assets/skills/jaz-pseudo-sql/SKILL.md +2 -1
- package/assets/skills/jobs/SKILL.md +2 -1
- package/assets/skills/jobs/references/building-blocks.md +1 -1
- package/assets/skills/jobs/references/credit-control.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +4 -3
- package/cli.mjs +444 -442
- package/package.json +1 -1
- package/assets/skills/api/references/endpoints.md +0 -3407
- /package/assets/skills/{api → jaz-api-reference}/references/search-syntax.md +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Jaz API Rules 1-49: Fundamentals
|
|
2
|
+
|
|
3
|
+
Part of the jaz-api skill. [SKILL.md](../SKILL.md) holds the reading order and the index of all four rule files. Rule numbers are stable: tool descriptions, `errors.md` and other skills cite them by number, and a missing number is a retired rule.
|
|
4
|
+
|
|
5
|
+
### Identifiers & Dates
|
|
6
|
+
1. **All IDs are `resourceId`**, never `id`. References use `<resource>ResourceId` suffix.
|
|
7
|
+
2. **All transaction dates are `valueDate`**, not `issueDate`, `invoiceDate`, `date`. This is an accounting term meaning "date of economic effect."
|
|
8
|
+
3. **All dates are `YYYY-MM-DD` strings**; ISO datetime and epoch ms are rejected.
|
|
9
|
+
|
|
10
|
+
### Payments (Cross-Currency Aware)
|
|
11
|
+
4. **Payment amounts have two fields**: `paymentAmount` = bank account currency (actual cash moved), `transactionAmount` = transaction document currency (invoice/bill/credit note: amount applied to balance). For same-currency, both are equal. For FX (e.g., USD invoice paid from SGD bank at 1.35): `paymentAmount: 1350` (SGD), `transactionAmount: 1000` (USD).
|
|
12
|
+
5. **Payment date is `valueDate`**, not `paymentDate`, not `date`.
|
|
13
|
+
6. **Payment bank account is `accountResourceId`**, not `bankAccountResourceId`.
|
|
14
|
+
7. **Payments require 6 fields**: `paymentAmount`, `transactionAmount`, `accountResourceId`, `paymentMethod`, `reference`, `valueDate`.
|
|
15
|
+
8. **Payments wrapped in `{ payments: [...] }`**, array recommended. Flat objects are now auto-wrapped by the API, but array format is preferred for clarity.
|
|
16
|
+
8a. **On an invoice, bill or credit note update (`PUT`), `payments` (`refunds` on credit notes) edits payments by `resourceId`; it is not a replacement list.** An entry with a stored payment's `resourceId` (from `paymentRecords[]`) updates that payment in place and needs every payment field; `{ resourceId, deleted: true }` removes it; an entry without `resourceId` records a NEW payment; a stored payment left out stays as it is, unless the edit changes the document's total, currency or exchange rate: then every payment is deleted and its bank match released, and nothing records it again. `removedPaymentResourceIds` no longer exists and is ignored if sent. Never echo a stored payment without its `resourceId`: it is recorded a second time, or refused with `INVALID_PAYMENT_AMOUNT` on a fully paid document. Changing a payment's reference, date or method keeps its bank reconciliation; changing its amount releases it. A 422 applies nothing.
|
|
17
|
+
|
|
18
|
+
### Names & Fields
|
|
19
|
+
9. **Line item descriptions use `name`**, not `description`.
|
|
20
|
+
10. **Item names**: canonical field is `internalName`, but `name` alias is accepted on POST. GET responses return both `internalName` and `name`.
|
|
21
|
+
11. **Tag names**: canonical field is `tagName`, but `name` alias is accepted on POST. GET responses return both `tagName` and `name`.
|
|
22
|
+
12. **Custom field names**: POST uses `name`, GET returns both `customFieldName` and `name`.
|
|
23
|
+
13. **Invoice/bill number is `reference`**, not `referenceNumber`.
|
|
24
|
+
|
|
25
|
+
### Transaction Creation
|
|
26
|
+
14. **`saveAsDraft` has OPPOSITE defaults on the two surfaces.** Raw REST: omitting it creates a FINALIZED transaction (`false`). MCP/CLI tools: creates for invoices, bills, both credit notes, journals, sale quotes, purchase requests/orders, and the order-conversions inject `true`: omitting it creates a DRAFT; pass `saveAsDraft: false` to post immediately. When the landing state matters, pass the field explicitly and read `status` off the create response rather than assuming either default. Cash entries and cash transfers are the exception on both surfaces: they have no draft state, so `saveAsDraft: true` is refused with a 422 and the tools do not offer the field at all.
|
|
27
|
+
15. **If `saveAsDraft: false`** (or omitted on the raw REST surface; see Rule 14), every lineItem MUST have `accountResourceId`.
|
|
28
|
+
16. **Phones MUST be E.164**: `+65XXXXXXXX` (SG), `+63XXXXXXXXXX` (PH). No spaces.
|
|
29
|
+
|
|
30
|
+
### Chart of Accounts
|
|
31
|
+
17. **Tax profiles pre-exist**; NEVER create them. Only GET and map.
|
|
32
|
+
18. **Bank accounts are CoA entries** with `accountType: "Bank Accounts"`. A convenience endpoint `GET /bank-accounts` exists but returns a **flat array** `[{...}]`, NOT the standard paginated `{ data, totalElements, totalPages }` shape. Normalize before use.
|
|
33
|
+
19. **CoA bulk-upsert wrapper is `accounts`**, not `chartOfAccounts`.
|
|
34
|
+
20. **CoA POST uses `currency`**, not `currencyCode`. (Asymmetry: GET returns `currencyCode`.)
|
|
35
|
+
21. **CoA POST uses `classificationType`**; GET returns `accountType`. Same values. Both accept all 23 types: Bank Accounts, Cash, Current Asset, Non-current Asset, Fixed Asset, Inventory, Investment, Goodwill, Current Liability, Non-current Liability, Shareholders Equity, Operating Revenue, Other Revenue, Discontinued Income, Financing Income, Investing Income, Direct Costs, Operating Expense, Other Expense, Finance Cost, Investing Expense, Income Tax Expense, Discontinued Expense (nine of these are the IFRS 18 set added 2026-05, listed in rule 140). COGS is **Direct Costs**, never Operating Expense; "Cost of Goods Sold" is the default account NAME, not a type. Values are singular: a plural or invented value returns zero rows with no error, and `search_accounts` does not normalise (only `create_account` does). The set is GLOBAL (same for every org); confirm against the platform with `list_account_classifications` using `limit: 100`; its default page is 20 and there are 23.
|
|
36
|
+
22. **CoA code mapping: match by NAME, not code**; pre-existing accounts may have different codes. Resource IDs are the universal identifier.
|
|
37
|
+
|
|
38
|
+
### Bulk Upsert (Items, Contacts & Rates)
|
|
39
|
+
- **Items bulk-upsert** (`POST /items/bulk-upsert`): max 500 per call. Provide `resourceId` per item to update (partial: only changed fields needed, server preserves existing values). Omit `resourceId` to create (defaults: `status=ACTIVE`, `itemCategory=NON_INVENTORY`). Response: `{ resourceId: null, resourceIds: [...] }`. **SYNC**: returns resourceIds immediately.
|
|
40
|
+
- **Contacts bulk-upsert** (`POST /contacts/bulk-upsert`): max 500 per call. Provide `resourceId` to update (partial), omit to create. `billingName` required for create. **ASYNC**: returns `{ jobId, status: "QUEUED", totalRecords }`. Poll `search_background_jobs` with `filter: {resourceId:{eq:jobId}}` until status is `SUCCESS`, `FAILED`, or `PARTIAL_SUCCESS`. Unlike items, contacts bulk-upsert is asynchronous.
|
|
41
|
+
- **Rates bulk-upsert** (`POST /organization/currencies/rates/bulk-upsert`): max 500 per call. Requires `rateDirection` per rate (`FUNCTIONAL_TO_SOURCE` or `SOURCE_TO_FUNCTIONAL`). **Auto-enables currencies not yet enabled in the org**; no need to call `add_currency` first. Response: `{ resourceId: null, resourceIds: [...] }`.
|
|
42
|
+
|
|
43
|
+
### Background Jobs (Universal Async Tracking)
|
|
44
|
+
- **ANY operation that returns a `jobId`** can be polled via `search_background_jobs`. This includes: contacts bulk-upsert (`UPSERT_CONTACTS`), items bulk-upsert (`UPSERT_ITEMS`), bank statement import (`PROCESS_BANK_STATEMENT_FILES`), and magic processing (`MAGIC_TRANSACTION_*`).
|
|
45
|
+
- **🚨 CRITICAL: Filter by `resourceId`, NOT `jobId`**; `filter: {jobId:{eq:...}}` is silently ignored (returns ALL jobs). Must use `filter: {resourceId:{eq:theJobId}}`. The response field is named `jobId` but the filter path is `resourceId`.
|
|
46
|
+
- **Poll until terminal status**: `SUCCESS`, `FAILED`, or `PARTIAL_SUCCESS`. Use `processedCount`, `failedCount`, `totalRecords` for progress. `PARTIAL_SUCCESS` means some records succeeded and some failed; check `errorDetails` array for per-record errors.
|
|
47
|
+
- **`startedAt` filter does NOT work**; use `createdAt` for date range filtering.
|
|
48
|
+
- **`errorDetails` is `[]` (empty array) on success**, not `null`.
|
|
49
|
+
- **Known jobTypes**: `UPSERT_CONTACTS`, `UPSERT_ITEMS`, `PROCESS_BANK_STATEMENT_FILES`, `MAGIC_TRANSACTION_PURCHASE`, `MAGIC_TRANSACTION_SALE`, `MAGIC_TRANSACTION_SALE_CREDIT_NOTE`.
|
|
50
|
+
|
|
51
|
+
### Export Records
|
|
52
|
+
- **`outputFormat: "XLSX"` is always required**; no other format is currently supported. Hardcode it.
|
|
53
|
+
- **`query` + `filter` are mutually exclusive**; the server returns `INVALID_SEARCH_INPUT` if both are provided. Pass `query` (structured search string, same syntax as dashboard) OR `filter` (raw JSON filter object), never both.
|
|
54
|
+
- **Available entity types**: `INVOICE`, `BILL`, `CUSTOMER_CREDIT_NOTE`, `SUPPLIER_CREDIT_NOTE`, `SALE_PAYMENT`, `PURCHASE_PAYMENT`, `BATCH_PAYMENT`, `CONTACT`, `ITEM`, `CAPSULE`, `SCHEDULED_TRANSACTION`, `JOURNAL`, `BANK_RECORD`, `CASHFLOW_TRANSACTION`, `FIXED_ASSET`, `CHART_OF_ACCOUNT`, `TAX_PROFILE`.
|
|
55
|
+
- **`fileUrl` expires in ~5 minutes**; it's a pre-signed S3 URL. Warn the user to download immediately.
|
|
56
|
+
- **Preview first**: use `preview_export_records` to confirm scope (count + sample rows) before calling `export_records`. The `filterDescription` field gives a human-readable summary like `"2580 records | Status in: UNPAID"`.
|
|
57
|
+
- **Column customization**: use `get_export_columns` to discover available column paths and headers. Pass a `columns` array to select specific fields. Omit for default columns.
|
|
58
|
+
- **`previewRows` keys are column headers**, not field paths. E.g. `{"Invoice Ref #": "INV-001", "Customer": "Acme"}`. Use `resolvedColumns` to map headers back to paths.
|
|
59
|
+
|
|
60
|
+
### Journals & Cash
|
|
61
|
+
23. **Journals use `journalEntries`** with `amount` + `type: "DEBIT"|"CREDIT"`, NOT `debit`/`credit` number fields.
|
|
62
|
+
24. **Journals support multi-currency via `currency` object**, same format as invoices/bills: `"currency": { "sourceCurrency": "USD" }` (auto-fetch platform rate) or `"currency": { "sourceCurrency": "USD", "exchangeRate": 0.74 }` (custom rate). Must be enabled for the org. Omit for base currency. **Direction**: `exchangeRate` is functionalToSource (1 org-base unit = N `sourceCurrency`), usually the inverse of a quoted rate. Pass your figure as-is with `rateDirection` rather than inverting by hand; Rule 49. Three restrictions apply to foreign currency journals: (a) **no controlled accounts**: accounts with `controlFlag` (AR, AP) are off-limits (use invoices/bills instead), (b) **no FX accounts**: FX Unrealized Gain/Loss/Rounding are system-managed, (c) **bank accounts must match**: can only post to bank accounts in the same currency as the journal (e.g., USD journal → USD bank account only, not SGD bank account). All other non-controlled accounts (expenses, revenue, assets, liabilities) are available.
|
|
63
|
+
25. **`currency` object is the SAME on every create and update**: invoices, bills, credit notes, AND journals all use `currency: { sourceCurrency: "USD", exchangeRate?: number, rateDirection?: "FUNCTIONAL_TO_SOURCE" | "SOURCE_TO_FUNCTIONAL" }`. **Direction**: `exchangeRate` is functionalToSource (1 org-base unit = N `sourceCurrency`), usually the inverse of a quoted rate. Pass your figure as-is with `rateDirection` rather than inverting by hand; Rule 49. Never use `currencyCode: "USD"` (silently ignored on invoices/bills) or `currency: "USD"` (string, causes 400 on invoices/bills). **Exception, Quick Fix**: changing an existing record's currency uses `currencySettings: { sourceCurrencyCode }` (Rule 107); `currency` there is dropped.
|
|
64
|
+
26. **Cash entries use `accountResourceId`** at top level for the BANK account + `lines` array for offsets.
|
|
65
|
+
|
|
66
|
+
### Credit Notes & Refunds
|
|
67
|
+
27. **Credit note application wraps in `credits` array** with `amountApplied`, not flat.
|
|
68
|
+
28. **CN refunds use the same Payment shape** as invoice/bill payments: `paymentAmount`, `transactionAmount`, `accountResourceId`, `paymentMethod`, `valueDate`, `reference`. The API also accepts aliases `refundAmount`/`refundMethod` (see Rule 53) but prefer canonical `paymentAmount`/`paymentMethod` for consistency.
|
|
69
|
+
|
|
70
|
+
### Inventory Items
|
|
71
|
+
29. **Inventory items** (`POST /inventory-items`, verified live 2026-09-02): required are `itemCode`, `name`, `unit` (e.g. `"pcs"`; a blank unit returns `ITEM_UNIT_EMPTY_ERROR`), `costingMethod` (`"FIXED"` or `"WAC"`), `cogsResourceId` and `blockInsufficientDeductions` (send `false` explicitly; omitting it 422s, it is not defaulted server-side). Send `name`: the endpoint declares no `name` property and marks `internalName` required, but the API populates `internalName` from the `name` you send. The two account links are TYPE-constrained and the errors name the type: `cogsResourceId` must be **Direct Costs** (`INVALID_ACCOUNT_TYPE_DIRECT_COST`), `purchaseAccountResourceId` must be **Inventory** (`INVALID_ACCOUNT_TYPE_INVENTORY`); an inventory purchase debits the asset, and COGS is recognised on sale. The API reports `purchaseAccountResourceId`, `saleAccountResourceId`, `appliesToSale` and `appliesToPurchase` as "required if [cogsResourceId] is present", but `cogsResourceId` is itself always required, so all four are unconditional too. `appliesToSale` and `appliesToPurchase` must both be **`true`**, not merely present: `false` returns `APPLIES_TO_SALE_ERROR` / `APPLIES_TO_PURCHASE_ERROR` ("must be true when cogs selected"), so an inventory-tracked item with COGS is necessarily both sale- and purchase-applicable. There is no `inventoryAccountResourceId`; it appears in no request schema and a create succeeds without it.
|
|
72
|
+
30. **Delete inventory items via `DELETE /items/:id`**, not `/inventory-items/:id`.
|
|
73
|
+
|
|
74
|
+
### Cash Transfers
|
|
75
|
+
31. **Cash transfers use `cashOut`/`cashIn` sub-objects**, NOT flat `fromAccountResourceId`/`toAccountResourceId`. Each: `{ accountResourceId, amount }`.
|
|
76
|
+
|
|
77
|
+
### Schedulers
|
|
78
|
+
32. **Scheduled invoices/bills wrap in `{ invoice: {...} }` or `{ bill: {...} }`**, not flat. Recurrence field is `repeat` (NOT `frequency`/`interval`). `saveAsDraft: false` required. **`reference` is required** inside the `invoice`/`bill` wrapper; omitting it causes 422.
|
|
79
|
+
33. **Scheduled journals use FLAT structure** with `schedulerEntries`, not nested in `journal` wrapper. **`valueDate` is required** at the top level (alongside `startDate`, `repeat`, etc.).
|
|
80
|
+
|
|
81
|
+
### Bookmarks
|
|
82
|
+
34. **Bookmarks use `items` array wrapper** with `name`, `value`, `categoryCode`, `datatypeCode`.
|
|
83
|
+
|
|
84
|
+
### Custom Fields
|
|
85
|
+
35. **Custom fields: `appliesTo` WORKS and `type` does nothing** (re-probed live 2026-09-02, reversing the previous entry). Send `appliesTo` as an OBJECT: `{invoices, bills, customerCredits, supplierCredits, payments}` sets the matching `applyTo*` to `SHOW`; **omit it and the field appears on nothing**. The old "do not send appliesTo" note came from an ARRAY example, which does 400. `format` is the ONLY control over the kind of field and the datatype is derived, not chosen: `CUSTOM` (default) yields `datatypeCode: TEXT`, any `ALL_*` value (`ALL_CUSTOMERS`/`ALL_SUPPLIERS`/`ALL_CONTACTS`/`ALL_EMPLOYEES`/`ALL_USERS`) yields `LIST`, a picklist of that population. **There is no NUMBER, DATE or DROPDOWN custom field**: `type`, `fieldType`, `entityType`, `datatypeCode` and `options` all return 200 and are silently dropped (an int on `datatypeCode` also returns 200, so the DTO does not declare it). `printOnDocuments` is required and not defaulted server-side.
|
|
86
|
+
35a. **Custom field values on transactions**: Set via `customFields: [{ customFieldName: "PO Number", actualValue: "PO-123" }]` on invoice/bill/customer-CN/supplier-CN/payment/item/fixed-asset create/update. NOT on journals, cash entries, or cash transfers. Read from GET responses in the same shape.
|
|
87
|
+
35b. **Custom field search**: `POST /custom-fields/search` with filter/sort/limit/offset. Filter by `customFieldName` (StringExpression), `datatypeCode` (StringExpression: TEXT, LIST, DATE; there is no DROPDOWN; see rule 35).
|
|
88
|
+
35c. **Custom field GET**: `GET /custom-fields/:resourceId` returns full definition including `applyToSales`, `applyToPurchase`, `applyToCreditNote`, `applyToPayment`, `printOnDocuments`, `listOptions`.
|
|
89
|
+
|
|
90
|
+
### Tags on Transactions
|
|
91
|
+
35d. **Tags are `tags: string[]`** on ALL transaction create/update: invoices, bills, customer CNs, supplier CNs, journals, cash-in, cash-out, cash transfers. CLI uses `--tag <name>` (singular, wrapped to array). API accepts the array directly.
|
|
92
|
+
|
|
93
|
+
### Nano Classifiers
|
|
94
|
+
35e. **ClassifierConfig**: `classifierConfig: [{ resourceId: "<classifierId>", type: "invoice"|"bill", selectedClasses: [{ className: "Class A", resourceId: "<classId>" }], printable: true }]`. Goes on each line item of invoices, bills, credit notes, journal entries and cash entries, and on the record itself for fixed assets, leases, deferrals and loans (create, update, and the GET returns it). `resourceId` is the nano classifier's (`POST /nano-classifiers` creates one). On those four records `type` is the classifier's own type, as the classifier GET returns it, and an update REPLACES every classifier the record holds (omitting the field keeps them): to add one, send the stored ones plus the new entry. Clio's update tools take a change and merge it. A selected class needs `resourceId` unless it sends `entityResourceId` instead (a classifier whose options are customers, suppliers, contacts, employees or users). Quick fix and Ledger Find & Fix add `{ resourceId, deleted: true }` to remove one classifier and leave unnamed ones as they are (rule 107).
|
|
95
|
+
|
|
96
|
+
### Reports
|
|
97
|
+
36. **Report field names differ by type**; this is the most error-prone area:
|
|
98
|
+
|
|
99
|
+
| Report | Required Fields |
|
|
100
|
+
|--------|----------------|
|
|
101
|
+
| Trial balance | `startDate`, `endDate` |
|
|
102
|
+
| Balance sheet | `primarySnapshotDate` |
|
|
103
|
+
| P&L | `primarySnapshotDate`, `secondarySnapshotDate` |
|
|
104
|
+
| General ledger | `startDate`, `endDate`, `groupBy: "ACCOUNT"` (also `CONTACT`, `TRANSACTION`, `RELATIONSHIP`, `CAPSULE`). Optional `limit` (1-1000; omitted = whole report in one response), `offset` (ROW offset, see Rule 38), `filter.account.resourceId: { in: [...] }` |
|
|
105
|
+
| Cashflow | `primaryStartDate`, `primaryEndDate` |
|
|
106
|
+
| Cash balance | `reportDate` |
|
|
107
|
+
| AR/AP report | `endDate` |
|
|
108
|
+
| AR/AP summary | `startDate`, `endDate` |
|
|
109
|
+
| Bank balance summary | `primarySnapshotDate` |
|
|
110
|
+
| Equity movement | `primarySnapshotStartDate`, `primarySnapshotEndDate` |
|
|
111
|
+
| Ledger highlights | *(none, simple GET)* |
|
|
112
|
+
|
|
113
|
+
37. **Ledger highlights is a simple GET**: `GET /api/v1/ledger/highlights` returns org-wide GL summary metadata: transaction counts by type, date range, active accounts/currencies, cross-currency flag, and dynamic FX types. No parameters. Response dates are epoch ms (see Rule 52).
|
|
114
|
+
37a. **Data exports use simpler field names**: P&L export uses `startDate`/`endDate` (NOT `primarySnapshotDate`). AR/AP export uses `endDate`.
|
|
115
|
+
|
|
116
|
+
### Pagination
|
|
117
|
+
38. **All list/search endpoints use `limit`/`offset` pagination**: NOT `page`/`size`. **`offset` is a 0-indexed PAGE NUMBER, not a row-skip** (offset=1 = second page of `limit` rows). **Exceptions, where `offset` is a 0-indexed ROW offset (next page = offset + limit):** `POST /generate-reports/general-ledger` and `templated-general-ledger`, the AR/AP details reports (`ar-details-report`, `ap-details-report`, `templated-ar-details-report`, `templated-ap-details-report`), `/purchase-items` (list and search), `GET /organization/currencies/{code}/rates`, and `POST /employees/payouts/search`. Paging one of these by page number re-reads overlapping rows and skips the rest. Default limit=100, offset=0. Max limit=1000, max offset=65536. `page`/`size` params are silently ignored. Response shape: `{ totalPages, totalElements, truncated, data: [...] }`. When `truncated: true`, a `_meta: { fetchedRows, maxRows }` field explains why (offset cap or `--max-rows` soft cap: default 10,000). Use `--max-rows <n>` to override. Always check `truncated` before assuming the full dataset was returned. **Payload tier (`view`): page-then-drill:** `search_*` and the lean `list_*` tools (invoices, bills, contacts, items, journals, customer/supplier credit notes, sale/purchase orders) return a **compact summary row by default** (`view:"lean"`: id + reference/status/date/contact/amount). Search lean to FIND a record, then read it in full via its `get_*`; pass `view:"full"` only when you need whole rows up front (heavier: avoid for broad searches). Other collections always return full. CLI defaults to full; use `--view lean`.
|
|
118
|
+
|
|
119
|
+
### Other
|
|
120
|
+
39. **Currency rates use `/organization/currencies/:code/rates`**: enable currencies first via `POST /organization/currencies`, then set rates via `POST /organization/currencies/:code/rates` with body `{ "rate": 0.74, "rateApplicableFrom": "YYYY-MM-DD" }` (see Rule 49 for direction). The older hyphenated `/organization-currencies/...` rate paths still resolve but are **superseded**: treat the nested form as the only supported path. The reference is migrating away from the hyphenated form, so do not rely on it being documented. Cannot set rates for org base currency. Full CRUD: POST (create), GET (list), GET/:id, PUT/:id, DELETE/:id.
|
|
121
|
+
40. **FX invoices/bills MUST use `currency` object**; `currencyCode: "USD"` (string) is **silently ignored** (transaction created in base currency!). Use `currency: { sourceCurrency: "USD" }` to auto-fetch platform rate (ECB/FRANKFURTER), or `currency: { sourceCurrency: "USD", exchangeRate: 0.74 }` for a custom rate. Rate hierarchy: org rate → platform/ECB → transaction-level. **Direction**: `exchangeRate` is functionalToSource (1 org-base unit = N `sourceCurrency`), usually the inverse of a quoted rate. Pass your figure as-is with `rateDirection` rather than inverting by hand; Rule 49.
|
|
122
|
+
41. **Invoice GET uses `organizationAccountResourceId`** for line item accounts; POST uses `accountResourceId`. Request-side aliases resolve `issueDate` → `valueDate`, `bankAccountResourceId` → `accountResourceId`, etc.
|
|
123
|
+
42. **Scheduler GET returns `interval`**; POST uses `repeat`. (Response-side asymmetry remains.)
|
|
124
|
+
43. **Search sort is an object**: `{ sort: { sortBy: ["valueDate"], order: "DESC" } }`. Required when `offset` is present (even `offset: 0`).
|
|
125
|
+
44. **Bank records**. **Create**: Multipart CSV/OFX via `POST /magic/importBankStatementFromAttachment` or JSON via `POST /bank-records/:accountResourceId` with `{ records: [{amount, transactionDate, description?, payerOrPayee?, reference?}] }` (positive = cash-in, negative = cash-out, response: `{data: {errors: []}}`). **Search**: `POST /bank-records/:accountResourceId/search`; filter fields: `valueDate` (DateExpression), `status` (StringExpression: UNRECONCILED, RECONCILED, ARCHIVED, POSSIBLE_DUPLICATE), `description`, `extContactName` (payer/payee), `extReference`, `netAmount` (BigDecimalExpression), `extAccountNumber`. Sort by `valueDate` DESC default.
|
|
126
|
+
45. **Withholding tax (PH) has two sides.** Expanded withholding (EWT) on what you pay sits on each bill / supplier credit note line as `withholdingTax`: copy `code`, `rate`, `type` and `description` from one `list_withholding_codes` row (a field left out is not stored, measured 2026-10-06). Creditable withholding (CWT) a customer deducts is recorded from the customer's BIR Form 2307 with `record_withholding_tax_certificate`, never on the invoice lines (rule 98). On `WITHHOLDING_CODE_NOT_FOUND`, check the code against `list_withholding_codes` (codes contain a space: `WC 158`); never strip the field silently, because the tax disappears from the bill.
|
|
127
|
+
46. **Known API bugs (500s)**: none on this list today. **Capsules POST, catalogs POST, inventory balances by status GET, contact groups PUT and custom fields PUT are NO LONGER on this list.** Capsules POST creates the capsule and returns its `resourceId`. Catalogs POST returned 201 on a live probe 2026-09-23 (item `unit` omitted, it is optional); its response is counts (`createdCatalogs`, `createdCatalogItems`), not a resourceId, so find the new catalog with `search_catalogs`. Inventory balances by status works (Rule 97). Contact groups PUT and custom fields PUT were re-probed live 2026-09-02 and returned 200 and applied the change. Do not route around any of them.
|
|
128
|
+
47. **Non-existent endpoints**: `POST /inventory/adjustments` (and `/inventory-adjustments`, `/inventory-items/:id/adjustments`, `/items/:id/inventory-adjustments`; no stock-adjustment write path exists at any spelling), `GET /payments` (list), and `POST /payments/search` return 404; these endpoints are not implemented. For payments, per-payment CRUD is `GET/PUT/DELETE /payments/:resourceId` and there ARE two payment-scoped searches; see Rule 64. `POST /deposits` also 404s, but for a different reason, see Rule 47a; do not read it as a missing feature.
|
|
129
|
+
47a. **Deposits are not an entity; the 404 on `/deposits` is by design.** A deposit is a **flag on a Chart of Accounts account**, not a document: the account carries `depositContactType` = `CUSTOMER` (advance received, a liability) or `SUPPLIER` (advance paid, an asset). Once flagged, a deposit movement is an **ordinary transaction against that account**: top up with `POST /journals` / `POST /cash-in-entries` / `POST /cash-out-entries` (one leg on the flagged account), draw down with `POST /invoices/:id/payments` or `POST /bills/:id/payments` passing `accountResourceId` = the flagged account **and `paymentMethod` set to something other than BANK_TRANSFER / CASH / CHEQUE** (use `OTHER`; those three force a bank/cash account and 422 here, see Rule 80), read with `POST /cashflow-transactions/search`. **The flag has its own endpoint**: `GET /deposit-accounts?depositContactType=CUSTOMER|SUPPLIER` lists the flagged accounts with balances per currency (the type is required, one side per call; pages count account-and-currency rows, so merge by `accountResourceId`), and `PUT /deposit-accounts` `{ accounts: [{ organizationAccountResourceId, depositContactType, restrictPaymentOverdraft }] }` (1-500) flags (`CUSTOMER` needs an active liability account, `SUPPLIER` an active asset account; never control, bank, cash or inventory accounts) or unflags (`depositContactType: null`; the key is required). `restrictPaymentOverdraft` is required when flagging: the PUT sets both fields every time. One change: any bad account refuses the whole PUT with a 422 naming each. `depositContactType` is still on no chart-of-accounts model, so `POST /chart-of-accounts` cannot create a deposit account: create the account, then flag it. Tools: `list_deposit_accounts`, `flag_deposit_accounts`. Full walkthrough: jaz-api-reference `references/endpoints-banking-magic.md` → Deposits.
|
|
130
|
+
48. **Attachments (full CRUD)**: **Add**: `POST /:type/:id/attachments` (multipart, `file` field, `application/pdf` or `image/*`, NOT `text/plain`). **List**: `GET /:type/:id/attachments`. **Delete**: `DELETE /:type/:id/attachments/:attachmentResourceId` (HTTP 200). CLI: `clio attachments add --file <path>` or `--url <url>`, `clio attachments list`, `clio attachments delete <attachmentResourceId>`. **The list response shape depends on the entity**. Measured raw 2026-09-07: `/invoices/:id/attachments` returns `{ reference, resourceId, attachments: [{fileName, fileType, fileId, attachmentResourceId}] }`, while `/bills/:id/attachments` and `/journals/:id/attachments` return the conventional `{ data: [...] }`. Both credit-note types were unmeasured (every sampled record was void; see below). `listAttachments` in `core/api/attachments.ts` reads either key, so through the CLI or a tool you get `.data` in all cases; only a raw request sees the split. The attachment ID field is `attachmentResourceId` (not `resourceId`). **A VOIDED record 404s on three of the five types.** Measured 2026-09-07: a voided invoice, customer credit note and supplier credit note each answer `404 not_found` with `"<Entity> is voided"`, while a voided bill and a voided journal return 200 and list normally. The 404 is about the record's status, not its existence (`GET /invoices/:id` on the same id works), so never read this 404 as a bad resourceId. Anything fanning out to attachments alongside other calls must treat that leg as degradable, or one voided record destroys the whole response; `get_transaction_summary` did exactly that until 5.55.1.
|
|
131
|
+
49. **Currency rate direction: `rate` = functionalToSource (1 base = X foreign)**. POST `rate: 0.74` for a SGD org means 1 SGD = 0.74 USD. **If your data stores rates as "1 USD = 1.35 SGD" (sourceToFunctional), you MUST invert: `rate = 1 / 1.35 = 0.74`.** GET confirms both: `rateFunctionalToSource` (what you POSTed) and `rateSourceToFunctional` (the inverse). **You do not have to do the arithmetic**: `add_currency_rate`, `update_currency_rate` and the `currency` object on the 8 FX create tools (invoice, bill, journal, both credit notes, both cash entries, TTB) accept an optional `rateDirection` (`FUNCTIONAL_TO_SOURCE` | `SOURCE_TO_FUNCTIONAL`): declare how your figure reads and pass it verbatim. Omitting it always means `FUNCTIONAL_TO_SOURCE`. The two families differ only in where the label is applied: the rate-table tools (plus `bulk_upsert_currency_rates`) send it on the wire and the server applies it, while the 8 FX create tools have no such field, so the client inverts and strips it there. Prefer either to inverting by hand: a wrong inversion is silent and wrong by rate². `clio calc fx-reval` REQUIRES the direction; that calculator historically assumed the opposite convention to the API.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Jaz API Rules 50-88: Search, Jaz Magic, Response Shapes, Drafts
|
|
2
|
+
|
|
3
|
+
Part of the jaz-api skill. [SKILL.md](../SKILL.md) holds the reading order and the index of all four rule files. Rule numbers are stable: tool descriptions, `errors.md` and other skills cite them by number, and a missing number is a retired rule.
|
|
4
|
+
|
|
5
|
+
### Search & Filter
|
|
6
|
+
50. **Search endpoint universal pattern**: All 32 `POST /*/search` endpoints share identical structure: `{ filter?, sort: { sortBy: ["field"], order: "ASC"|"DESC" }, limit: 1-1000, offset: 0-65536 }`. `offset` is a 0-indexed page number (not row-skip), except on the row-offset endpoints listed in Rule 38. Sort is REQUIRED when offset is present (even `offset: 0`). Default limit: 100. `sortBy` is always an array on all endpoints (no exceptions). See jaz-api-reference `references/search-reference.md` for per-endpoint filter/sort fields.
|
|
7
|
+
50a. **`query` field (Jaz search operators)**: 14 endpoints accept an optional `query` string alongside `filter`: invoices, bills, customer/supplier credit notes, journals, cashflow-transactions, bank-records, contacts, items, capsules, fixed-assets, scheduled-transactions, chart-of-accounts, tax-profiles. Example: `{ "query": "status:unpaid AND $500+", "limit": 50 }`. Key syntax: amounts (`$500+`, `$100-500`, `amount:>2m`, magnitude suffixes `5k`/`2m`/`1b`), negative (`$-500`), absolute value (`abs:1000+`), dates (`date:this month`, `date:-30d`, `due:overdue`, `submitted:last week`, `lastpayment:-7d`), status/enum (`status:unpaid`, `currency:SGD,USD`; comma = OR), string fields (`customer:acme`, `ref:INV-*` wildcard, `=ref:INV-001` exact, `ref:/\d{4}/` regex), blank checks (`ref:blank`, `tag:!blank`), booleans (`hasattachment:yes`, `customer:yes`), negation (`!status:paid` or `NOT status:void`; **never `-`** for negation), logic (`AND`/`OR` with implicit AND on space), grouping, inline sort (`sort:amount:desc`). Full syntax spec (all fields, aliases, entity field lists, examples): jaz-api-reference **`references/search-syntax.md`**.
|
|
8
|
+
50b. **`query` + `filter` merge**: When both are present, they are merged at the filter level. Explicit `filter` keys win on conflict. Use `query` for human-readable shorthand, `filter` for programmatic precision, or combine both: `{ "query": "date:this year", "filter": { "currencyCode": { "in": ["SGD"] } } }`.
|
|
9
|
+
50c. **`query` error handling**: Unknown field name → `query_not_understood` (400). Bad enum value (e.g. `status:BADVALUE`) → **empty results, no error** (silent miss). Unsupported endpoint → `query_not_supported` (400). Parser unavailable → `query_parse_error` (502). Empty/null/whitespace query → passthrough (ignored). In CLI/MCP: use `--query` / `query` param only on supported entities; unsupported entities have no `--query` flag.
|
|
10
|
+
51. **Filter operator reference**: An operator the target type does not declare is now rejected with a 400 naming it, not ignored, so use the exact set. String: `eq`, `neq`, `contains`, `notContains`, `in` (array, max 100), `likeIn` (array, max 100), `reg` (substring array, max 100; a term match despite the name, not a regex), `startWith`, `notStartWith`, `endWith`, `notEndWith`, `isNull`, `isBlank`, `isNotBlank` (each takes the **string** `"true"`/`"false"`, not a bool). Numeric: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `inRange`/`notInRange` (exactly 2 values, low then high). Date (YYYY-MM-DD): `eq`, `gt`, `gte`, `lt`, `lte`, `between`/`notBetween` (exactly 2 values), `isNull`, `isNotNull`. DateTime (RFC3339): `eq`, `gt`, `gte`, `lt`, `lte`, `between`, converted to epoch ms internally. Boolean: `eq`. JSON: `jsonIn`, `jsonNotIn`. Logical: `and`/`or` objects everywhere; `andGroup`/`orGroup` arrays on invoices, bills, journals, cashflow transactions, payments, batch payments and the order family (orders, quotes, requests, line items), **not** on credit notes. `not` exists only on contacts, items, tags, custom fields, tax profiles and nano classifiers; it is **not** available on invoices, bills or journals.
|
|
11
|
+
52. **Date format asymmetry (CRITICAL)**. Request dates: `YYYY-MM-DD` strings (all create/update and DateExpression filters). Request datetimes: RFC3339 strings (DateTimeExpression filters for `createdAt`, `updatedAt`, `approvedAt`, `submittedAt`). **ALL response dates**: `int64` epoch milliseconds, including `valueDate`, `createdAt`, `updatedAt`, `approvedAt`, `submittedAt`, `matchDate`. Convert: `new Date(epochMs).toISOString().slice(0,10)`. **Timezone convention**: ALL business dates (`valueDate`, `dueDate`, `startDate`, `endDate`, etc.) are in the **organization's timezone**, never UTC. The epoch ms stored in the DB represents the org-local date (no timezone conversion is ever needed). Only audit timestamps (`createdAt`, `updatedAt`, `action_at`) are UTC.
|
|
12
|
+
53. **Field aliases on create endpoints**. Middleware transparently maps: `issueDate`/`date` → `valueDate` (invoices, bills, credit notes, journals). `name` → `tagName` (tags) or `internalName` (items). `paymentDate` → `valueDate`, `bankAccountResourceId` → `accountResourceId` (payments). `paymentAmount` → `refundAmount`, `paymentMethod` → `refundMethod` (credit note refunds). `accountType` → `classificationType`, `currencyCode` → `currency` (CoA). Canonical names always work; aliases are convenience only.
|
|
13
|
+
54. **All search/list responses are flat**: every search and list endpoint returns `{ totalElements, totalPages, data: [...] }` directly (no outer `data` wrapper). Access the array via `response.data`, pagination via `response.totalElements`. **Four exceptions**: (a) `GET /bank-accounts` returns a plain array `[{...}]` (see Rule 18), (b) `GET /invoices/:id` returns a flat object `{...}` (no `data` wrapper), unlike `GET /bills/:id`, `GET /contacts/:id`, `GET /journals/:id` which wrap in `{ data: {...} }`. Normalize the invoice GET response before use. (c) **The empty-result envelope on the scheduled-\* handlers changes shape**: when the upstream search block comes back null, eight handlers short-circuit to `{ "data": [], "pagination": { "total": 0 } }`. No `totalElements`, no `totalPages`, and a third pagination key name. The SAME endpoint returns the normal flat envelope the moment one row exists. Affected: list AND attachment-list on scheduled invoices, scheduled bills, scheduled journals, scheduled subscriptions. **Never read `totalElements` on a scheduled-\* response without falling back to `pagination.total`** (`response.totalElements ?? response.pagination?.total ?? 0`) and count rows off `data.length`, which is correct in both shapes. (d) **`GET /organization-report-template` returns its rows under `reportTemplates`, not `data`, and carries no counts**: measured 2026-09-06 against an org holding 12 templates, where `data` was `[]` and `totalElements` `0`. The `list_organization_report_templates` tool normalizes it, so read `.data` as usual; the raw endpoint does not. Its `/search` sibling returns a **bare array** with no envelope, the same shape as exception (a) above. So the two halves of one family disagree with each other. Both are normalized for you by the tools, so read `.data` as usual. The endpoint also ignores `limit`/`offset` entirely (probed at 1, 3 and 100; 12 rows every time), so it returns everything in one response.
|
|
14
|
+
55. **Scheduled endpoints support date aliases**: `txnDateAliases` middleware (mapping `issueDate`/`date` → `valueDate`) now applies to all scheduled create/update endpoints: `POST/PUT /scheduled/invoices`, `POST/PUT /scheduled/bills`, `POST/PUT /scheduled/journals`, `POST/PUT /scheduled/subscriptions`.
|
|
15
|
+
56. **Kebab-case URL aliases**. `capsuleTypes` endpoints also accept kebab-case paths: `/capsule-types` (list, search, CRUD). `moveTransactionCapsules` also accepts `/move-transaction-capsules`. Both camelCase and kebab-case work identically.
|
|
16
|
+
|
|
17
|
+
### Jaz Magic: Extraction & Autofill
|
|
18
|
+
57. **When the user starts from an attachment, always use Jaz Magic**: if the input is a PDF, JPG, or any document image (invoice, bill, receipt), the correct path is `POST /magic/createBusinessTransactionFromAttachment`. Do NOT manually construct a `POST /invoices` or `POST /bills` payload from an attachment; Jaz Magic handles the entire extraction-and-autofill pipeline server-side: OCR, line item detection, contact matching, CoA auto-mapping via ML learning, and draft creation with all fields pre-filled. Only use `POST /invoices` or `POST /bills` when building transactions from structured data (JSON, CSV, database rows) where the fields are already known. If you hold the invoice/bill as raw HTML (e.g. an email body), pass it via `sourceType: "HTML"` with an `html` field; the backend renders it to a PDF then extracts, so you do NOT need to save it to a file first.
|
|
19
|
+
58. **Three upload modes with different content types**: `sourceType: "FILE"` requires **multipart/form-data** with `sourceFile` blob (JSON body fails with 400 "sourceFile is a required field"). `sourceType: "URL"` accepts **application/json** with `sourceURL` string. `sourceType: "HTML"` accepts the raw HTML body in an `html` field (JSON or multipart); the backend renders it to a PDF, then extracts (use this for an email body you already hold; no file needed). The OAS only documents URL mode; FILE and HTML modes are undocumented there.
|
|
20
|
+
58a. **The server FETCHES the source; a local path is not a source at any spelling**: in URL mode `sourceURL` is opened by the Jaz server, so it must be reachable from the public internet; in FILE mode you send the bytes yourself as a multipart blob. A path on the calling machine (`/mnt/user-data/uploads/x.zip`, `/tmp/invoice.pdf`) is neither: it is not a URL the server can open, and putting it in `sourceURL` (or in an MCP `file.download_url`, which the HOST populates and a caller must never author) fails after a round-trip with no indication that re-spelling the path is hopeless. Same rule for `classify_documents`: its `source` is fetched server-side, and a local folder/zip path is accepted only when the client is running on the caller's own machine. When you hold bytes but no shareable URL, switch to FILE mode or ask for a Dropbox/Drive/OneDrive share link; do not retry the path.
|
|
21
|
+
59. **Three required fields + one optional**: the source (`sourceFile` multipart blob, NOT `file`, for FILE, `sourceURL` for URL, or `html` for HTML), `businessTransactionType` (`"INVOICE"`, `"BILL"`, `"CUSTOMER_CREDIT_NOTE"`, `"SUPPLIER_CREDIT_NOTE"`, `"SALE_QUOTE"`, `"SALE_ORDER"`, `"PURCHASE_REQUEST"`, or `"PURCHASE_ORDER"`; `EXPENSE` rejected; a quote/request lands DRAFT, an order lands PENDING until the order update's `isPendingToActive*` flag), `sourceType` (`"FILE"`, `"URL"`, or `"HTML"`). For HTML mode, `html` is the raw HTML string (max 5 MB). Optional: `uploadMode` (`"SEPARATE"` default, or `"MERGED"` for a single PDF containing multiple documents; the backend splits it via boundary detection before extraction; refused for the four quote/order/request types) and `internalNotes` (max 3000 characters, set on the created record). Max 10 MB per file. All required fields are validated server-side. **CRITICAL: multipart form field names are camelCase**: `businessTransactionType`, `sourceType`, `sourceFile`, `uploadMode`, NOT snake_case. Using `business_transaction_type` returns 422 "businessTransactionType is a required field". The File blob must include a filename and correct MIME type (e.g. `application/pdf`, `image/jpeg`); bare `application/octet-stream` blobs are rejected with 400 "Invalid file type".
|
|
22
|
+
59a. **MERGED upload workflow tracking**: When `uploadMode: "MERGED"`, the upload response `workflowResourceId` is a **parent** tracking ID. The backend splits the PDF, then creates **child** workflows for each split page; these child IDs appear in `POST /magic/workflows/search` (by fileName or createdAt), NOT the parent ID. To track MERGED progress, search by `fileName` rather than the parent `workflowResourceId`.
|
|
23
|
+
60. **Response maps transaction types**: Request `INVOICE` → response `SALE`. Request `BILL` → response `PURCHASE`. Request `CUSTOMER_CREDIT_NOTE` → response `SALE_CREDIT_NOTE`. Request `SUPPLIER_CREDIT_NOTE` → response `PURCHASE_CREDIT_NOTE`. S3 paths follow the response type. The response `validFiles[]` array contains `workflowResourceId` for tracking extraction progress via `POST /magic/workflows/search`.
|
|
24
|
+
61. **Extraction is asynchronous**: the API response is immediate (file upload confirmation only). The actual Magic pipeline (OCR, line item extraction, contact matching, CoA learning, and autofill) runs asynchronously. Use `POST /magic/workflows/search` with `filter.resourceId.eq: "<workflowResourceId>"` to check status (SUBMITTED → PROCESSING → COMPLETED/FAILED). When COMPLETED, `businessTransactionDetails.businessTransactionResourceId` contains the created draft BT ID. The `subscriptionFBPath` in the response is a Firebase Realtime Database path for real-time status updates (alternative to polling).
|
|
25
|
+
62. **Accepts PDF and JPG/JPEG**: both file types confirmed working. Handwritten documents are accepted at upload stage (extraction quality varies). `fileType` in response reflects actual format: `"PDF"`, `"JPEG"`.
|
|
26
|
+
63. **Workflow search tracks all magic uploads**: `POST /magic/workflows/search` searches across BT extractions AND bank statement imports. Filter by `resourceId` (eq), `documentType` (SALE, PURCHASE, SALE_CREDIT_NOTE, PURCHASE_CREDIT_NOTE, SALE_QUOTE, SALE_ORDER, PURCHASE_REQUEST, PURCHASE_ORDER, BANK_STATEMENT), `status` (SUBMITTED, PROCESSING, COMPLETED, FAILED), `fileName` (contains), `fileType`, `createdAt` (date range). Response: paginated `MagicWorkflowItem` with `businessTransactionDetails.businessTransactionResourceId` (the draft BT ID when COMPLETED) or `bankStatementDetails` (for bank imports). Standard search sort: `{ sortBy: ["createdAt"], order: "DESC" }`.
|
|
27
|
+
|
|
28
|
+
### Cashflow & Unified Ledger
|
|
29
|
+
64. **Four ways to read payments: pick by scope.** `GET /payments` (list) and `POST /payments/search` do NOT exist and never did. What does exist: (a) **per-payment CRUD**: `GET/PUT/DELETE /payments/:resourceId`; (b) **payment-scoped search**: `POST /sales/payments/search` and `POST /purchases/payments/search` (added 2026-08-13), one side of the ledger each, plus `POST /batch-payments/search` for batches; (c) **cross-entity ledger**: `POST /cashflow-transactions/search`, the unified transaction ledger spanning invoices, bills, credit notes, journals, cash entries and payments. Filter it by `businessTransactionType` (e.g. `SALE`, `PURCHASE`) and `direction` (`PAYIN`, `PAYOUT`). Response dates are epoch milliseconds. The cashflow ledger tool is `search_cashflow_transactions`; its `resourceId` is a ledger row, not a payment record, so it 404s on `get_payment` / `update_payment`, which take a document's `paymentRecords` id. The per-side payment searches (b) have no tool; reach them with a raw request. (d) **Per-document settlements**: `GET /invoices/:id/payments` and `GET /bills/:id/payments`, and for credit notes `GET /customer-credit-notes/:id/refunds` / `GET /supplier-credit-notes/:id/refunds` (the domain distinguishes a refund from a payment; a journal has neither). This is the right call for **one known document's own settlements** and the one to reach for first: no filter to get wrong. All four answer `{ data: [...] }` (measured raw 2026-09-07). It is listed here because it was missing from this rule while (c) sat one line away, and `get_transaction_summary` consequently filtered the ledger by `businessTransactionResourceId`, a field `TransactionsFilter` does not declare, for its entire life, 400ing on every call behind a silent catch.
|
|
30
|
+
65. **Contacts search uses `name`**, NOT `billingName`. The filter field for searching contacts by name is `name` (maps to `billingName` internally). Sort field is also `name`. Using `billingName` in a search filter returns zero results.
|
|
31
|
+
|
|
32
|
+
### Response Shape Gotchas
|
|
33
|
+
66. **Contact boolean fields are `customer`/`supplier`**, NOT `isCustomer`/`isSupplier`. These are plain booleans on the contact object: `{ "customer": true, "supplier": false }`. Using `isCustomer` or `isSupplier` in code will be `undefined`.
|
|
34
|
+
67. **Finalized statuses differ by resource type**, NOT `"FINALIZED"`, `"FINAL"`, or `"POSTED"`. Journals → `"ACTIVE"` (journals have no approval state: their lifecycle is `ACTIVE | VOID | DRAFT`; live-verified 2026-08-03). Invoices/Bills → `"UNPAID"` (progresses to `"PARTIALLY_PAID"`, `"PAID"`). `OVERDUE` is not a status (a list with it returns 422 and a search matches nothing), so find overdue documents with `status in [UNPAID, PARTIALLY_PAID]` plus `dueDate lt <today in the organization's timezone>`. Customer/Supplier Credit Notes → `"UNAPPLIED"` (progresses to `"PARTIALLY_APPLIED"`, `"APPLIED"`). All types support `"DRAFT"` and `"VOID"` (not `"VOIDED"`). When creating with `saveAsDraft: false`, the response status matches the type's finalized status.
|
|
35
|
+
68. **Create/pay responses are minimal by default**: POST create endpoints (invoices, bills, journals, contacts, payments) return only `{ resourceId: "..." }` (plus a few metadata fields). They do NOT return the full entity. To verify field values after creation, do a subsequent `GET /:type/:resourceId`. **MCP tool shortcut:** `create_invoice` / `create_bill` / `create_journal` / `create_contact` / `create_item` accept `returnFullEntity: true`: the executor performs the GET server-side and returns the full entity inline, saving a turn. The raw REST `POST` is still minimal-only; only the MCP tools collapse the round trip. **If the post-create GET fails** (transient 5xx, network blip), the tool returns the minimal create envelope augmented with `_hydration: { status: 'failed', resourceId, message }`. The write committed; the agent should retry only the `get_*` call, NEVER the create (would duplicate the document). **`_fx` on transaction creates:** invoice/bill/credit-note create results may carry a sibling `_fx` field, e.g. `FX: 1 SGD (your base) = 0.74 USD (applied rate for 2026-04-03)`, the exchange rate the record was ACTUALLY created with. Relay that line to the user verbatim; it matters most when the caller supplied no rate (the organization rate was applied silently, and a rate stored the wrong way round reads as an obviously absurd number the user can catch on sight).
|
|
36
|
+
69. **No `amountDue` field**: Invoices and bills do NOT have an `amountDue` field. To check if a transaction is fully paid, inspect the `paymentRecords` array: if `paymentRecords.length > 0`, payments exist. Compare `totalAmount` with the sum of `paymentRecords[].transactionAmount` to determine remaining balance.
|
|
37
|
+
70. **Response dates include time component**: Even though request dates are `YYYY-MM-DD`, response dates are epoch milliseconds (see Rule 52). When comparing dates from responses, always convert with `new Date(epochMs).toISOString().slice(0, 10)`, never string-match against the raw epoch value. Remember: business dates are org-timezone (see Rule 52).
|
|
38
|
+
71. **Items POST requires `saleItemName`/`purchaseItemName`**: When creating items with `appliesToSale: true` or `appliesToPurchase: true`, you MUST include `saleItemName` and/or `purchaseItemName` respectively. These are the display names shown on sale/purchase documents. Omitting them causes 422: "saleItemName is a required field". If not specified, default to the `internalName` value.
|
|
39
|
+
72. **Items PUT requires `itemCode` + `internalName`**: Even for partial updates, `PUT /items/:id` requires both `itemCode` and `internalName` in the body. Omitting either causes 422. Use read-modify-write pattern: GET current item, merge your updates, PUT the full payload. Clio handles this automatically.
|
|
40
|
+
73. **Capsules PUT requires `resourceId` + `capsuleTypeResourceId`**: Even for partial updates, `PUT /capsules/:id` requires `resourceId` and `capsuleTypeResourceId` in the body. Omitting either causes 422 or "Capsule type not found". Use read-modify-write pattern: GET current capsule, merge updates, PUT full payload. Clio handles this automatically.
|
|
41
|
+
|
|
42
|
+
### Cash Entry Response Shape (CRITICAL)
|
|
43
|
+
74. **Cash-in/out/transfer CREATE returns `parentEntityResourceId`**: the resourceId in the POST response (`{ data: { resourceId: "X" } }`) is the journal header's `parentEntityResourceId`. This ID is used for DELETE (`DELETE /cash-entries/X`) and PUT. GET (`GET /cash-in-entries/:id`) accepts either the cashflow-transaction `resourceId` from the LIST response or this `parentEntityResourceId`. Three different IDs exist per cash entry: `parentEntityResourceId` (from CREATE + in LIST), `resourceId` (cashflow-transaction ID, from LIST, also accepted by GET), `businessTransactionResourceId` (underlying journal ID, do NOT use for anything).
|
|
44
|
+
75. **Cash-in/out/transfer LIST/GET return cashflow-transaction shape**, NOT journal shape. Key field differences from journals: `transactionReference` (NOT `reference`), `transactionStatus` (NOT `status`; values: `ACTIVE`/`VOID`), `valueDate` is epoch ms (NOT ISO string), no `journalEntries` array, has `direction` (`PAYIN`/`PAYOUT`), has nested `account` object with bank name, has `businessTransactionType` (`JOURNAL_DIRECT_CASH_IN`/`JOURNAL_DIRECT_CASH_OUT`/`JOURNAL_CASH_TRANSFER`).
|
|
45
|
+
76. **Cash-in/out/transfer search uses `/cashflow-transactions/search`**: Filter by `businessTransactionType: { eq: "JOURNAL_DIRECT_CASH_IN" }` (or `JOURNAL_DIRECT_CASH_OUT` or `JOURNAL_CASH_TRANSFER`). Other useful filters: `organizationAccountResourceId` (bank account), `businessTransactionReference` (reference), `valueDate` (date range). The search endpoint is shared across all cashflow transaction types.
|
|
46
|
+
77. **DELETE for cash entries uses `/cash-entries/:id`**, NOT the individual resource paths. The ID used is the `parentEntityResourceId` (= the resourceId returned by CREATE). This is a shared endpoint for all cash entry types (cash-in, cash-out, cash-transfer).
|
|
47
|
+
|
|
48
|
+
### Entity Resolution (Fuzzy Matching)
|
|
49
|
+
78. **`--contact`, `--account`, and `--bank-account` accept names**: any CLI flag that takes a contact, chart of accounts entry, or bank account accepts EITHER a UUID resourceId OR a fuzzy name. Examples: `--contact "ACME Corp"`, `--account "DBS Operating"`, `--bank-account "Business"`. The CLI auto-resolves to the best match (strict thresholds) and shows the resolved entity on stderr. UUIDs are passed through without API calls. If the match is ambiguous, the CLI errors with a list of candidates, never silently picks the wrong entity.
|
|
50
|
+
80. **Payment/refund account is gated by `paymentMethod`, not by the field's type**: the field itself accepts any chart-of-accounts id (the REST layer applies no type filter), but the platform then rejects anything outside Bank Accounts / Cash **when the method is BANK_TRANSFER, CASH or CHEQUE**: `INVALID_ACCOUNT_FOR_BUSINESS_TRANSACTION_FOUND`. Every other method reaches a non-bank account, which is the only way a deposit drawdown works: pay an invoice with `paymentMethod: OTHER` and `accountResourceId` set to the deposit account. The CLI mirrors this, filtering `--account` to bank/cash for those three methods only. Do not read the permissive field as permission: the REST layer is a proxy, and the accounting engine behind it is the authority.
|
|
51
|
+
|
|
52
|
+
### Draft Finalization Pipeline (Convert & Next)
|
|
53
|
+
|
|
54
|
+
The `clio bills draft` subcommand group enables the full "review → fill missing → convert" workflow that mirrors the Jaz UI's "Convert and Next" button. Designed for AI agents processing a queue of draft bills.
|
|
55
|
+
|
|
56
|
+
#### Commands
|
|
57
|
+
|
|
58
|
+
| Command | Purpose |
|
|
59
|
+
|---------|---------|
|
|
60
|
+
| `clio bills draft list [--ids <ids>] [--json]` | Queue view: all drafts with per-field validation + attachment count |
|
|
61
|
+
| `clio bills draft finalize <id> [flags] [--json]` | Fill missing fields + convert DRAFT → UNPAID in one PUT |
|
|
62
|
+
| `clio bills draft attachments <id> [--json]` | List attachments with download URLs for agent inspection |
|
|
63
|
+
|
|
64
|
+
#### Mandatory Fields for Bill Finalization
|
|
65
|
+
|
|
66
|
+
| Field | JSON Path | CLI Flag | Resolver |
|
|
67
|
+
|-------|-----------|----------|----------|
|
|
68
|
+
| Contact | `contactResourceId` | `--contact <name/UUID>` | Fuzzy resolved |
|
|
69
|
+
| Bill date | `valueDate` | `--date <YYYY-MM-DD>` | Literal |
|
|
70
|
+
| Due date | `dueDate` | `--due <YYYY-MM-DD>` | Literal |
|
|
71
|
+
| Line items | `lineItems` (non-empty) | `--lines <json>` | none |
|
|
72
|
+
| Item name | `lineItems[i].name` | via `--lines` | none |
|
|
73
|
+
| Item price | `lineItems[i].unitPrice` | via `--lines` | none |
|
|
74
|
+
| Item account | `lineItems[i].accountResourceId` | `--account <name/UUID>` (bulk) | Fuzzy resolved |
|
|
75
|
+
|
|
76
|
+
Optional: `--ref`, `--notes`, `--tag`, `--tax-profile <name/UUID>` (bulk, fuzzy resolved), `--tax`, `--tax-inclusive`, `--dry-run`, `--input <file>`.
|
|
77
|
+
|
|
78
|
+
#### Agent Workflow Pattern
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Step 1: clio bills draft list --json
|
|
82
|
+
→ Batch queue: every DRAFT with per-field validation + attachment count
|
|
83
|
+
|
|
84
|
+
Step 2: For each draft where ready = false:
|
|
85
|
+
a) Read validation.missingFields from Step 1 output
|
|
86
|
+
b) Optional: clio bills draft attachments <id> --json
|
|
87
|
+
→ Download fileUrl, read PDF/image, extract or verify values
|
|
88
|
+
c) Resolve values (ask user, or infer from attachment + context)
|
|
89
|
+
d) clio bills draft finalize <id> --contact "Acme" --date 2025-01-15 ... --json
|
|
90
|
+
→ Updates + converts to UNPAID in one PUT (Rule 67: bills/invoices → UNPAID, journals → ACTIVE)
|
|
91
|
+
|
|
92
|
+
Step 3: For each draft where ready = true:
|
|
93
|
+
clio bills draft finalize <id> --json
|
|
94
|
+
→ Converts directly (all mandatory fields already present)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
81. **`--account` bulk patches line items**: when used with `clio bills draft finalize`, `--account` resolves the name to a UUID then sets `accountResourceId` on EVERY line item where it's currently null. Existing accounts are NOT overwritten. Same for `--tax-profile`. `--lines` takes priority (full replacement).
|
|
98
|
+
82. **`--dry-run` validates without modifying**: returns the same validation structure as `draft list` (per-field status/hint), so agents can preview what would happen before committing. No API write occurs.
|
|
99
|
+
83. **Finalization is a single PUT**: `updateBill()` with `saveAsDraft: false` transitions DRAFT → UNPAID (per Rule 67) and updates all fields in one call. No delete-and-recreate. The CLI handles all field normalization automatically (date format, line item sanitization, account field name mapping).
|
|
100
|
+
84. **Draft list attachment count**: `draft list` includes `attachmentCount` per draft (from `GET /bills/:id/attachments`). Use `draft attachments <id>` for full details including `fileUrl` download links.
|
|
101
|
+
85. **PUT body requires `resourceId`**: The UpdateBill PUT endpoint requires `resourceId` in the body (in addition to the URL path). Dates must be `YYYY-MM-DD` (not ISO with time). `taxInclusion` is boolean (`true`/`false`), not string. Line items must use `accountResourceId` (not `organizationAccountResourceId` from GET).
|
|
102
|
+
86. **GET→PUT field asymmetry**: GET returns `organizationAccountResourceId` on line items; PUT requires `accountResourceId`. GET returns dates as `2026-02-27T00:00:00Z`; PUT requires `2026-02-27`. GET returns `taxProfile: { resourceId }` object; PUT requires `taxProfileResourceId` string. The CLI `draft finalize` command normalizes all of these automatically.
|
|
103
|
+
87. **Magic workflow status may be null immediately after creation**: The `POST /magic/workflows/search` endpoint may return a workflow with `status: null` right after `POST /magic/create-from-attachment`. Allow 2-3 seconds before polling, or default to `SUBMITTED`. The CLI `magic status` command defaults null status to `SUBMITTED`.
|
|
104
|
+
88. **Finalized invoices/bills need `accountResourceId` on all line items**: When `saveAsDraft: false` (or using `--finalize`), every `lineItems[i].accountResourceId` must be set. Omitting it causes 422: "lineItems[0].accountResourceId is required if [saveAsDraft] is false". The CLI validates this pre-flight.
|
|
105
|
+
|
|
106
|
+
#### DRY Extension Pattern
|
|
107
|
+
|
|
108
|
+
Bills, invoices, and credit notes share identical mandatory field specs. Adding `clio invoices draft` or `clio customer-credit-notes draft` later reuses all validation, formatting, and CLI flag logic from `draft-helpers.ts`; only the API calls differ.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-cli
|
|
3
|
-
version: 9.8.3
|
|
4
3
|
description: >-
|
|
5
4
|
Use this skill when running Clio CLI commands, building shell scripts with
|
|
6
5
|
Clio, debugging auth issues, understanding --json output, paginating results,
|
|
@@ -11,6 +10,8 @@ description: >-
|
|
|
11
10
|
80 command groups and 523 tools, including employee-expense claims.
|
|
12
11
|
license: MIT
|
|
13
12
|
compatibility: Requires Node.js >= 18.0.0. Install via npm install -g jaz-clio.
|
|
13
|
+
metadata:
|
|
14
|
+
version: "9.9.0"
|
|
14
15
|
---
|
|
15
16
|
|
|
16
17
|
# Clio CLI Skill
|
|
@@ -34,7 +35,8 @@ You are working with **Clio** (`jaz-clio`), the CLI for the Jaz accounting platf
|
|
|
34
35
|
| Need | Skill |
|
|
35
36
|
|------|-------|
|
|
36
37
|
| CLI command syntax, flags, output | **jaz-cli** (this skill) |
|
|
37
|
-
| API field names, error codes,
|
|
38
|
+
| API field names, error codes, 148 API rules | **jaz-api** |
|
|
39
|
+
| Endpoint request/response shapes, search filters, search enums | **jaz-api-reference** |
|
|
38
40
|
| IFRS transaction recipes (depreciation, leases, loans) | **jaz-recipes** |
|
|
39
41
|
| Month-end close, bank recon, GST filing workflows | **jaz-jobs** |
|
|
40
42
|
| Migration from Xero/QuickBooks/Sage | **jaz-conversion** |
|
|
@@ -239,7 +241,7 @@ clio invoices search --query "status:unpaid sort:amount:desc" --limit 10
|
|
|
239
241
|
- Unsupported entities have no `--query` flag (background-jobs, tags, contact-groups, etc.).
|
|
240
242
|
- Never use `-` for negation; it means negative amount (e.g. `$-500` = amount is -500). Use `!` or `NOT`.
|
|
241
243
|
|
|
242
|
-
See `references/search-reference.md` in the `jaz-api` skill for the full syntax spec.
|
|
244
|
+
See `references/search-reference.md` in the `jaz-api-reference` skill for the full syntax spec.
|
|
243
245
|
|
|
244
246
|
## Body Input
|
|
245
247
|
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
|
|
42
42
|
18. **`reconciliations invoice-receipt` / `bill-receipt` gate on `paymentDirection`, not BSE type.** The 422 error code "Invalid business transaction type" is misleadingly named; the actual API check is on the BSE's `paymentDirection`. **`invoice-receipt` requires `PAYIN`** (positive amount via `clio bank add-records` → `credit_amount > 0`). **`bill-receipt` requires `PAYOUT`** (NEGATIVE amount → `debit_amount > 0`). Statement-imported BSEs (`clio bank import`) also work; direction is set from the CSV. For programmatic seeding, `clio bank add-records` with the correct sign is sync, fast, and reliable; no need for the async magic-OCR `bank import` path.
|
|
43
43
|
|
|
44
|
-
19. **No universal/cross-entity search.** The previous `clio search <q>` (Typesense-backed grouped search) was removed; it was FE-typeahead infrastructure. For agent/programmatic search use the structured `--query` syntax on per-entity search commands (`clio invoices search --query "..."`, `clio bills search --query "..."`, etc.). See `references/search-syntax.md` (in api skill) for the full DSL: AND/OR/NOT, parentheses, amount ranges (`$500+`, `$100-500`), date ranges (`date:-30d`, `date:jan-mar 2025`), wildcards, and entity-specific fields.
|
|
44
|
+
19. **No universal/cross-entity search.** The previous `clio search <q>` (Typesense-backed grouped search) was removed; it was FE-typeahead infrastructure. For agent/programmatic search use the structured `--query` syntax on per-entity search commands (`clio invoices search --query "..."`, `clio bills search --query "..."`, etc.). See `references/search-syntax.md` (in the jaz-api-reference skill) for the full DSL: AND/OR/NOT, parentheses, amount ranges (`$500+`, `$100-500`), date ranges (`date:-30d`, `date:jan-mar 2025`), wildcards, and entity-specific fields.
|
|
@@ -443,7 +443,7 @@ Drafts only change: a finalized run is refused (`PAYRUN_NOT_DRAFT`). Type, frequ
|
|
|
443
443
|
|------------|-----------|
|
|
444
444
|
| `get <id>` | Lines, amounts and the PDF link (`generatedDocuments`) |
|
|
445
445
|
| `search` | `--payrun`, `--employee`, `--employee-name`, `--pay-profile`, `--payout-status`, `--payrun-status`, `--limit`, `--offset`, `--sort`, `--order` |
|
|
446
|
-
| `refresh <id>` | Rebuild one draft payslip from current pay;
|
|
446
|
+
| `refresh <id>` | Rebuild one draft payslip from current pay; a pay-setup line replaces every line of its pay type, lines of other pay types stay |
|
|
447
447
|
| `refresh-payrun <payrunId>` | `--payslips <list>` (default all). Payslips that cannot be refreshed are listed and the exit code is 1 |
|
|
448
448
|
| `generate <payrunId>` | `--payslips <list>` (default all). Makes the PDFs of a finalized run again; a 202 job |
|
|
449
449
|
|
|
@@ -168,7 +168,7 @@ clio journals create --input dep-2026-01.json --json # body: valueDate, journa
|
|
|
168
168
|
Find transactions matching criteria and bulk-update them.
|
|
169
169
|
|
|
170
170
|
```bash
|
|
171
|
-
# Search invoices via structured --query syntax (see api skill: references/search-syntax.md)
|
|
171
|
+
# Search invoices via structured --query syntax (see jaz-api-reference skill: references/search-syntax.md)
|
|
172
172
|
clio invoices search --query "customer:acme AND status:unpaid AND \$500+" --json
|
|
173
173
|
|
|
174
174
|
# Or with discrete flags
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-conversion
|
|
3
|
-
version: 9.8.3
|
|
4
3
|
description: >-
|
|
5
4
|
Use this skill when migrating accounting data into Jaz, importing from Xero,
|
|
6
5
|
QuickBooks, Sage, MYOB, or Excel exports. Covers the full conversion pipeline:
|
|
@@ -9,6 +8,8 @@ description: >-
|
|
|
9
8
|
and verifying TB. Also use when the user mentions data migration, conversion,
|
|
10
9
|
import, or switching accounting software, whenever a customer's prior system
|
|
11
10
|
is Xero, QuickBooks, Sage, MYOB, or an Excel-based ledger.
|
|
11
|
+
metadata:
|
|
12
|
+
version: "9.9.0"
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
# Jaz Conversion Skill
|
|
@@ -151,12 +152,13 @@ If TB doesn't match, identify the discrepancy:
|
|
|
151
152
|
5. **FYE exchange rates + original dates**: Quick conversion uses original dates (for aging) but explicit FYE rate via `currency: { sourceCurrency, exchangeRate }` on every FX transaction. Prior UGL is in the TTB; explicit rate ensures zero UGL in Jaz. See `references/edge-cases.md`.
|
|
152
153
|
6. **System-generated CoA accounts cannot be deleted**: discover them via API before attempting a wipe-and-replace.
|
|
153
154
|
7. **100% accuracy is required**: customer's accountant signs off on TB match. No rounding errors, no missing balances.
|
|
154
|
-
8. **Always load `jaz-api` skill alongside this one**: this skill has conversion domain knowledge, `jaz-api` has API field names
|
|
155
|
+
8. **Always load `jaz-api` skill alongside this one**: this skill has conversion domain knowledge, `jaz-api` has API field names and gotchas, and `jaz-api-reference` has the endpoints.
|
|
155
156
|
9. **Filter noise from aging reports before creating contacts**: AR/AP aging reports contain subtotal rows, dates, column headers, and numeric-only strings that are NOT contact names. Reject them to avoid creating garbage contacts. See `references/mapping-rules.md`.
|
|
156
157
|
10. **TTB routing differs between Quick and Full**: Quick routes AR/AP through clearing accounts (conversion invoices already hold the real AR/AP). Full posts directly to all accounts (detailed transactions follow). See `references/option1-full.md`.
|
|
157
158
|
|
|
158
159
|
## See Also
|
|
159
160
|
|
|
160
|
-
- **jaz-api**: Field names,
|
|
161
|
+
- **jaz-api**: Field names, error codes, and gotchas (load alongside this skill)
|
|
162
|
+
- **jaz-api-reference**: Endpoint request/response examples, the endpoint catalog, and search filters
|
|
161
163
|
- **jaz-recipes**: Transaction recipes for complex IFRS scenarios encountered during conversion
|
|
162
164
|
- **jaz-jobs**: Post-conversion operational workflows (month-end close, bank recon, etc.)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jaz-api-reference
|
|
3
|
+
description: >-
|
|
4
|
+
Use this skill to look up exactly what a Jaz REST API endpoint takes and
|
|
5
|
+
returns: method and path, request body fields, response shape, and status
|
|
6
|
+
codes, with request/response examples for every core endpoint by domain
|
|
7
|
+
(master data, transactions, banking and Jaz Magic, schedulers and reports,
|
|
8
|
+
fixed assets and payroll, Quick Fix and bulk edits). Also holds the endpoint
|
|
9
|
+
catalog (about 200 paths) and the search reference: every search filter and
|
|
10
|
+
sort field per endpoint, the `query` search syntax, and the valid enum values
|
|
11
|
+
for each filter field. Load it when building or debugging a request body,
|
|
12
|
+
checking whether an endpoint exists, writing a search filter, or confirming
|
|
13
|
+
an enum value. The numbered API rules, error catalog, and field name mapping
|
|
14
|
+
live in the jaz-api skill: load both together.
|
|
15
|
+
license: MIT
|
|
16
|
+
compatibility: Uses Jaz OAuth by default; organization API keys remain supported. Works with Claude Code, Google Antigravity, OpenAI Codex, GitHub Copilot, Cursor, and any agent that reads markdown. Load the jaz-api skill alongside this one.
|
|
17
|
+
metadata:
|
|
18
|
+
version: "9.9.0"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Jaz API Reference Skill
|
|
22
|
+
|
|
23
|
+
The lookup half of the Jaz REST API docs: what each endpoint takes and returns, and how to search. Everything here is also valid for Juan Accounting (same API).
|
|
24
|
+
|
|
25
|
+
The **jaz-api** skill holds the rest: the numbered rules (production gotchas), the error catalog, the field name mapping, resource creation order, orders, claims and report templates. Read its rules before writing a request; these pages show the wire, the rules say where it bites.
|
|
26
|
+
|
|
27
|
+
- A rule cited here ("rule 107", "SKILL.md rule 107") is a jaz-api rule. The Rule Index in jaz-api's `SKILL.md` names the file that holds it.
|
|
28
|
+
- A file named here without a link (`field-map.md`, `errors.md`, `feature-glossary.md`, `orders.md`, `report-templates.md`, `rules-*.md`) is in jaz-api's `references/`.
|
|
29
|
+
- Inside an MCP host or with the `clio` CLI, call the tools or commands; read these pages for context. Write raw HTTP from them only for a direct integration.
|
|
30
|
+
|
|
31
|
+
## Files
|
|
32
|
+
|
|
33
|
+
| File | Read it for |
|
|
34
|
+
|------|-------------|
|
|
35
|
+
| [references/endpoints.md](references/endpoints.md) | Start here. Conventions every endpoint shares (base URL, auth, date format, pagination, success codes, auto-wrapping) and the index of which file holds each endpoint section |
|
|
36
|
+
| [references/endpoints-master-data.md](references/endpoints-master-data.md) | Organization, chart of accounts, tax profiles, currencies and rates, contacts, items, tags, custom fields, inventory items and balances, contact groups, bookmarks, catalogs, nano classifiers |
|
|
37
|
+
| [references/endpoints-transactions.md](references/endpoints-transactions.md) | Invoices, bills, journals, cash entries, payments and payment records, credit notes and refunds, cash transfers, attachments, transfer trial balance, approvals, jots, unapplied payments, comments and notifications |
|
|
38
|
+
| [references/endpoints-banking-magic.md](references/endpoints-banking-magic.md) | Jaz Magic extraction, bank records, the cashflow ledger search, deposits, bank rules |
|
|
39
|
+
| [references/endpoints-schedules-reports.md](references/endpoints-schedules-reports.md) | Schedulers, subscriptions, reports, export records, report templates |
|
|
40
|
+
| [references/endpoints-assets-payroll.md](references/endpoints-assets-payroll.md) | Fixed assets, deferrals, leases, loans, payrun settings and employee pay |
|
|
41
|
+
| [references/endpoints-bulk-edits.md](references/endpoints-bulk-edits.md) | Quick Fix (with the generated per-entity field lists), Ledger Find & Fix, contacts bulk upsert, background jobs |
|
|
42
|
+
| [references/full-api-surface.md](references/full-api-surface.md) | Endpoint catalog by resource (about 200 paths, more than the examples cover), limits, platform features that change API behavior |
|
|
43
|
+
| [references/search-reference.md](references/search-reference.md) | The `POST /*/search` request shape, operators per field type, and each endpoint's filter and sort fields |
|
|
44
|
+
| [references/search-syntax.md](references/search-syntax.md) | The `query` string syntax: amounts, dates, abs, blanks, wildcards, regex, entity field lists, aliases, examples (auto-synced from the dashboard repo) |
|
|
45
|
+
| [references/search-enums.md](references/search-enums.md) | Valid enum values per search field, nested filter paths, response field mapping |
|
|
46
|
+
|
|
47
|
+
## By task
|
|
48
|
+
|
|
49
|
+
- **Building a create or update body**: the endpoint's section in its domain file (find it in the `endpoints.md` index), then jaz-api's `field-map.md` for names you would guess wrong.
|
|
50
|
+
- **Writing a search**: `search-reference.md` for the fields an endpoint filters and sorts on, `search-enums.md` for the values a field accepts, `search-syntax.md` for a `query` string.
|
|
51
|
+
- **Does an endpoint for X exist?**: `full-api-surface.md`. It catalogues the endpoints clio wraps, not the whole REST surface; its header says where the complete list lives.
|