jaz-cli 2.0.0 → 2.2.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: api
3
- version: 2.0.0
3
+ version: 2.2.0
4
4
  description: Complete reference for the Jaz/Juan REST API — the accounting platform backend. Use this skill whenever building, modifying, debugging, or extending any code that calls the API — including API clients, integrations, data seeding, test data, or new endpoint work. Contains every field name, response shape, error, gotcha, and edge case discovered through live production testing.
5
5
  license: MIT
6
6
  compatibility: Requires Jaz/Juan API key (x-jk-api-key header). Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown.
@@ -55,22 +55,20 @@ All GET list endpoints and POST `/search` endpoints use **`limit`/`offset` pagin
55
55
  ### GET /api/v1/organization
56
56
 
57
57
  ```json
58
- // Response (returns a LIST, not single object):
58
+ // Response (returns a SINGLE OBJECT, not array):
59
59
  {
60
- "totalElements": 1,
61
- "totalPages": 1,
62
- "data": [{
60
+ "data": {
63
61
  "resourceId": "31eb050a-...",
64
62
  "name": "Jaz Global SG",
65
63
  "currency": "SGD",
66
64
  "countryCode": "SG",
67
65
  "status": "ACTIVE",
68
66
  "lockDate": null
69
- }]
67
+ }
70
68
  }
71
69
  ```
72
70
 
73
- Access org via `data[0]`. Check `lockDate` — don't seed transactions before it.
71
+ Access org via `data` directly (single object). The API previously returned an array but now returns a single object. Use `Array.isArray(data) ? data[0] : data` to handle both formats. Check `lockDate` — don't seed transactions before it.
74
72
 
75
73
  ---
76
74
 
@@ -627,13 +627,21 @@ To convert response dates: `new Date(epochMs).toISOString().slice(0, 10)` → `Y
627
627
 
628
628
  ### 21. POST /api/v1/organization-users/search
629
629
 
630
- See `organization-users.go`. Standard pattern with limit/offset/filter/sort.
630
+ **Filter fields** (`OrganizationUserFilter`): `name`, `email`, `role`, `status`
631
+
632
+ **Sort fields**: `name`, `email`, `createdAt`
633
+
634
+ Standard pattern with limit/offset/filter/sort. Rarely used in conversions.
631
635
 
632
636
  ---
633
637
 
634
638
  ### 22. POST /api/v1/bank-rules/search
635
639
 
636
- See `bankRule.go`. Standard pattern with limit/offset/filter/sort.
640
+ **Filter fields** (`BankRuleFilter`): `name`, `bankAccountResourceId`, `status`
641
+
642
+ **Sort fields**: `name`, `createdAt`
643
+
644
+ Standard pattern with limit/offset/filter/sort. Used for managing bank reconciliation auto-matching rules.
637
645
 
638
646
  ---
639
647
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: conversion
3
- version: 2.0.0
4
- description: Accounting data conversion skill — migrates customer data from Xero, QuickBooks, Sage, and Excel exports to Jaz. Covers full and quick conversion workflows, Excel parsing, CoA/contact/tax mapping, clearing accounts, TTB, and TB verification.
3
+ version: 2.2.0
4
+ description: Accounting data conversion skill — migrates customer data from Xero, QuickBooks, Sage, MYOB, and Excel exports to Jaz. Covers config, quick, and full conversion workflows, Excel parsing, CoA/contact/tax/items mapping, clearing accounts, TTB, and TB verification.
5
5
  ---
6
6
 
7
7
  # Jaz Conversion Skill
8
8
 
9
- You are performing an **accounting data conversion** — migrating a customer's financial data from their previous accounting software (Xero, QuickBooks, Sage, or Excel-based systems) into Jaz.
9
+ You are performing an **accounting data conversion** — migrating a customer's financial data from their previous accounting software (Xero, QuickBooks, Sage, MYOB, or Excel-based systems) into Jaz.
10
10
 
11
11
  **This skill provides conversion domain knowledge. For API details (field names, endpoints, gotchas), load the `jaz-api` skill alongside this one.**
12
12
 
@@ -19,9 +19,16 @@ You are performing an **accounting data conversion** — migrating a customer's
19
19
  - Verifying post-conversion Trial Balance accuracy
20
20
  - Troubleshooting TB mismatches after a conversion
21
21
 
22
- ## Two Conversion Types
22
+ ## Three Conversion Types
23
23
 
24
- Both types use the **same pipeline** — only the scope (which entity types) differs.
24
+ All types use the **same pipeline** — only the scope (which entity types) differs.
25
+
26
+ ### Config Mode (foundation only)
27
+ - **Scope:** CoA, contacts, items, currencies, tax mapping — NO transactions or journal
28
+ - **Creates:** Foundation entities only (Phases 0-1)
29
+ - **When:** Setting up an org before a conversion, or populating a fresh org with the customer's chart of accounts and contacts
30
+ - **Manifest field:** `"conversionType": "config"`
31
+ - **Requires:** At least one of `coa` or `tb` file (no AR/AP needed)
25
32
 
26
33
  ### Quick Conversion (Option 2 — recommended starting point)
27
34
  - **Scope:** Open AR/AP at FYE + TTB opening balances
@@ -99,12 +106,16 @@ Before any API calls, present a summary for human review:
99
106
 
100
107
  ### Step 6: Execute
101
108
  Create records via Jaz API. Follow the dependency order:
102
- 1. Currencies (must exist before CoA with foreign currency)
103
- 2. CoA (must exist before transactions reference accounts)
104
- 3. Contacts (must exist before invoices/bills reference them)
105
- 4. Tax profiles (read-only just discover and map)
106
- 5. Transactions (invoices, bills, journals)
107
- 6. Payments (must reference existing invoices/bills)
109
+ 1. **Phase 0:** Probe (discover existing resources accounts, contacts, tax profiles)
110
+ 2. **Phase 1A:** Currencies → FX Rates (rates must come AFTER currencies are enabled)
111
+ 3. **Phase 1B:** CoA via `POST /api/v1/chart-of-accounts/bulk-upsert`
112
+ 4. **Phase 1C:** Contacts → Items (items reference accounts + tax profiles)
113
+ 5. **Phase 1D:** Cleanup stale conversions (search + delete CONV-INV-*, CONV-BILL-*, etc.)
114
+ 6. **Phase 2:** Conversion invoices (AR), bills (AP), customer credit notes, supplier credit notes
115
+ 7. **Phase 3:** TTB journal (routes AR/AP through clearing accounts)
116
+ 8. **Phase 4:** Lock dates (per-account, at FYE date)
117
+
118
+ **Rollback:** If Phase 2 or 3 fails, all Phase 2 resources are automatically rolled back.
108
119
 
109
120
  ### Step 7: Verify
110
121
  After execution, pull the Trial Balance from Jaz and compare against the source TB.
@@ -6,7 +6,7 @@
6
6
  Enable currencies and set FYE closing rates before creating any FX transactions:
7
7
 
8
8
  ```
9
- PUT /api/v1/organization/currencies // Enable currency
9
+ POST /api/v1/organization/currencies // Enable currency
10
10
  { "currencies": ["USD"] }
11
11
 
12
12
  POST /api/v1/organization-currencies/USD/rates // Set FYE rate
@@ -85,6 +85,27 @@ Same logic applies for AP Clearing.
85
85
  ### Fix
86
86
  Create a small adjustment journal to bring the clearing account to zero. Document the reason (e.g., "FX rounding adjustment — $0.02").
87
87
 
88
+ ## Idempotency — Stale Conversion Cleanup
89
+
90
+ The pipeline is safe to re-run. Before creating Phase 2 transactions, it searches for and deletes any existing resources with conversion reference patterns:
91
+ - Invoices matching `CONV-INV-*`
92
+ - Bills matching `CONV-BILL-*`
93
+ - Customer credit notes matching `CONV-CCN-*`
94
+ - Supplier credit notes matching `CONV-SCN-*`
95
+ - Journals matching the TTB reference
96
+
97
+ This ensures a clean slate before each execution. The search uses `/api/v1/{entity}/search` with `filter: { reference: { contains: "CONV-INV" } }`.
98
+
99
+ ## CoA Bulk-Upsert Batch Rejection
100
+
101
+ **Gotcha:** `POST /api/v1/chart-of-accounts/bulk-upsert` rejects the **entire batch** if any single account in the batch already exists (returns a `DUPLICATED` error). This is all-or-nothing.
102
+
103
+ The executor handles this by treating the entire batch as "skipped" and then re-fetching all accounts via `/api/v1/chart-of-accounts/search` to get resource IDs.
104
+
105
+ If calling manually, either:
106
+ 1. Filter out existing accounts before sending the batch
107
+ 2. Catch `DUPLICATED` errors and fall through to a search
108
+
88
109
  ## Rounding
89
110
 
90
111
  ### The $0.01 Problem
@@ -141,9 +162,10 @@ When doing a CoA wipe-and-replace on a fresh org:
141
162
 
142
163
  ### Discovery
143
164
  ```
144
- GET /api/v1/accounts
165
+ POST /api/v1/chart-of-accounts/search
166
+ { "limit": 200, "offset": 0 }
145
167
  ```
146
- Check for `isSystemGenerated: true` or equivalent flag. These must be preserved.
168
+ Check for `isSystemGenerated: true` flag. These must be preserved.
147
169
 
148
170
  ### Strategy
149
171
  1. Map source accounts to system accounts where possible (e.g., source "Retained Earnings" → Jaz's system "Retained Earnings")
@@ -155,8 +177,10 @@ Check for `isSystemGenerated: true` or equivalent flag. These must be preserved.
155
177
  If a conversion goes wrong mid-execution:
156
178
 
157
179
  ### For Invoices/Bills
158
- - `POST /api/v1/invoices/<id>/void`voids the document (cannot be undone)
159
- - `DELETE /api/v1/invoices/<id>` — deletes draft invoices only
180
+ - `DELETE /api/v1/invoices/<id>`deletes the invoice (conversion invoices can be deleted directly)
181
+ - `DELETE /api/v1/bills/<id>` — deletes the bill
182
+ - `DELETE /api/v1/customer-credit-notes/<id>` — deletes customer CN
183
+ - `DELETE /api/v1/supplier-credit-notes/<id>` — deletes supplier CN
160
184
 
161
185
  ### For Journals
162
186
  - `DELETE /api/v1/journals/<id>` — deletes the journal entry
@@ -166,9 +190,16 @@ If a conversion goes wrong mid-execution:
166
190
  - `DELETE /api/v1/items/<id>` — only if no transactions reference them
167
191
 
168
192
  ### For CoA
169
- - `DELETE /api/v1/accounts/<id>` — only if no transactions reference them
193
+ - `DELETE /api/v1/chart-of-accounts/<id>` — only if no transactions reference them
194
+
195
+ ### Automatic Rollback (Pipeline)
196
+ The automated pipeline has built-in rollback:
197
+ - **Phase 2 failure:** If any conversion invoice/bill/credit note fails, ALL successfully created Phase 2 resources are automatically deleted, and Phases 3-4 are skipped.
198
+ - **Phase 3 failure:** If the TTB journal fails, ALL Phase 2 resources are automatically rolled back.
199
+ - This ensures the org is left clean — no partial conversions with unbalanced clearing accounts.
170
200
 
171
- ### Rollback Strategy
172
- 1. Delete in reverse order of creation (payments → transactions → contacts → CoA)
201
+ ### Manual Rollback Strategy
202
+ If rolling back manually:
203
+ 1. Delete in reverse order: journal → credit notes → bills → invoices → contacts → CoA
173
204
  2. Some entities may be undeletable if they have dependencies
174
- 3. In worst case, voiding is always available for transactions
205
+ 3. Clearing accounts MUST net to zero never leave a partial conversion in place
@@ -2,7 +2,7 @@
2
2
 
3
3
  Comprehensive catalog of all accounting file types encountered across real customer datasets. Use this to identify and classify files during conversion intake (Pipeline Step 1-2).
4
4
 
5
- **Source data:** 76 files across 10 datasets — Sage 300/Accpac, Xero, QuickBooks, and generic Excel workpapers.
5
+ **Source data:** 76 files across 10 datasets — Sage 300/Accpac, Xero, QuickBooks, MYOB, and generic Excel workpapers.
6
6
 
7
7
  ---
8
8
 
@@ -484,6 +484,7 @@ When analyzing an unknown file, look for these system signatures:
484
484
  | **Sage 300/Accpac** | 17+ metadata rows before headers. Hundreds of merged cells. Account codes `XXXX-100` (with dept suffix). Report IDs like GLTRLR1. Filter parameters in header block. `T` column (I/N doc type). Dual-currency column sections. Two-row headers. |
485
485
  | **Xero** | Clean flat exports. 4-5 metadata rows. Account codes 3-digit. Tax Rate Name column in GL Detail. "Ageing by due date" text. Auto-numbered invoices (INV-XXXX). "Demo Company (Global)" in demo data. |
486
486
  | **QuickBooks** | Grouped/indented sub-accounts. "Total <category>" rows. Template files with instructions sheets. Exchange rate matrices. Account numbers optional. |
487
+ | **MYOB** | 3 preamble rows before data. Per-row aging grouping. Filenames often contain "myob". Classification types: asset, bank, fixed asset, liability, equity, income, cost of sales, expense. |
487
488
  | **Generic Excel / Manual** | Very few merged cells (<10). No report metadata block. Custom layouts. May have been prepared by accountant/auditor for statutory purposes. Named schedules ("Schedule 8"). |
488
489
  | **Jaz Platform** | CSV with snake_case columns. UUIDs. `jaz.ai` email references. `business_transaction_type` enum values. `resource_id` columns. |
489
490
 
@@ -6,9 +6,9 @@
6
6
 
7
7
  When the Jaz org has only default system-generated accounts:
8
8
 
9
- 1. **Discover system accounts:** `GET /api/v1/accounts` — system-generated accounts have `isSystemGenerated: true` or are marked as controlled. These cannot be deleted.
10
- 2. **Delete non-system accounts** that aren't in the source CoA
11
- 3. **Create source accounts** using `POST /api/v1/accounts` with bulk upsert (`accounts` wrapper)
9
+ 1. **Discover system accounts:** `GET /api/v1/chart-of-accounts/search` — system-generated accounts have `isSystemGenerated: true`. These cannot be deleted.
10
+ 2. **Skip accounts that already exist** (matched by name or code from probe)
11
+ 3. **Bulk-upsert source accounts** using `POST /api/v1/chart-of-accounts/bulk-upsert` with `{ accounts: [...] }` wrapper
12
12
  4. **Match by code first, then name** — if a system account has the same code as a source account, map to it
13
13
 
14
14
  ### Existing Org Strategy (Match)
@@ -30,21 +30,22 @@ Source systems use different classification names. Map to Jaz types:
30
30
  | Source (common names) | Jaz `classificationType` |
31
31
  |----------------------|-------------------------|
32
32
  | Cash, Bank | Bank Accounts |
33
- | Accounts Receivable, Trade Debtors | Current Assets |
34
- | Inventory, Stock | Current Assets |
35
- | Prepaid Expenses | Current Assets |
36
- | Fixed Assets, Property/Equipment | Non-Current Assets |
37
- | Accumulated Depreciation | Non-Current Assets |
38
- | Accounts Payable, Trade Creditors | Current Liabilities |
39
- | Accrued Liabilities | Current Liabilities |
40
- | Loans (long-term) | Non-Current Liabilities |
41
- | Owner's Equity, Share Capital | Equity |
42
- | Retained Earnings | Equity |
43
- | Sales, Revenue, Income | Revenue |
44
- | Cost of Goods Sold, COGS | Cost of Sales |
45
- | Operating Expenses | Expenses |
33
+ | Accounts Receivable, Trade Debtors | Current Asset |
34
+ | Inventory, Stock | Inventory |
35
+ | Prepaid Expenses | Current Asset |
36
+ | Fixed Assets, Property/Equipment | Fixed Asset |
37
+ | Accumulated Depreciation | Fixed Asset |
38
+ | Accounts Payable, Trade Creditors | Current Liability |
39
+ | Accrued Liabilities | Current Liability |
40
+ | Loans (long-term) | Non-current Liability |
41
+ | Owner's Equity, Share Capital | Shareholders Equity |
42
+ | Retained Earnings | Shareholders Equity |
43
+ | Sales, Revenue, Income | Operating Revenue |
44
+ | Cost of Goods Sold, COGS | Direct Costs |
45
+ | Operating Expenses | Operating Expense |
46
46
  | Other Income | Other Revenue |
47
- | Other Expenses | Other Expenses |
47
+
48
+ **Valid `classificationType` values (exactly 13):** Bank Accounts, Cash, Current Asset, Fixed Asset, Non-current Asset, Inventory, Current Liability, Non-current Liability, Shareholders Equity, Operating Revenue, Other Revenue, Direct Costs, Operating Expense
48
49
 
49
50
  ### Clearing Account Creation
50
51
 
@@ -54,15 +55,15 @@ For Quick Conversion, create two clearing accounts:
54
55
  {
55
56
  "accounts": [
56
57
  {
57
- "accountName": "AR Conversion Clearing",
58
- "accountCode": "1299",
59
- "classificationType": "Current Assets",
58
+ "name": "AR Conversion Clearing",
59
+ "code": "1299",
60
+ "classificationType": "Current Asset",
60
61
  "description": "Contra account for conversion AR balances — should net to zero"
61
62
  },
62
63
  {
63
- "accountName": "AP Conversion Clearing",
64
- "accountCode": "2199",
65
- "classificationType": "Current Liabilities",
64
+ "name": "AP Conversion Clearing",
65
+ "code": "2199",
66
+ "classificationType": "Current Liability",
66
67
  "description": "Contra account for conversion AP balances — should net to zero"
67
68
  }
68
69
  ]
@@ -79,20 +80,69 @@ Choose codes that don't conflict with existing accounts. Adjust `1299`/`2199` if
79
80
  3. **If no match → create new contact**
80
81
 
81
82
  ### Contact Types
82
- - Source "Customer" Jaz `type: "CUSTOMER"`
83
- - Source "Supplier" / "Vendor" Jaz `type: "SUPPLIER"`
84
- - If both (customer AND supplier) Jaz `type: "CUSTOMER_AND_SUPPLIER"`
83
+ Jaz uses boolean flags, NOT an enum:
84
+ - Source "Customer" → `customer: true, supplier: false`
85
+ - Source "Supplier" / "Vendor" → `customer: false, supplier: true`
86
+ - If both (customer AND supplier) → `customer: true, supplier: true`
85
87
 
86
88
  ### Required Fields
87
- - `companyName` — the contact's business name
88
- - `displayName` — what shows on invoices/bills (often same as companyName)
89
- - `type` — CUSTOMER, SUPPLIER, or CUSTOMER_AND_SUPPLIER
89
+ - `name` — the contact's business name
90
+ - `billingName` — what shows on invoices/bills (often same as name)
91
+ - `customer` — boolean (true if the contact is a customer)
92
+ - `supplier` — boolean (true if the contact is a supplier)
90
93
 
91
94
  ### Optional but Recommended
92
95
  - `email` — for payment reminders
93
96
  - `phone` — **MUST be E.164** if provided (`+65XXXXXXXX` for SG, `+63XXXXXXXXXX` for PH)
94
97
  - `currency` — default currency for this contact (for FX contacts)
95
98
 
99
+ ### Contact API Example
100
+ ```json
101
+ POST /api/v1/contacts
102
+ {
103
+ "name": "Acme Corp",
104
+ "billingName": "Acme Corp",
105
+ "customer": true,
106
+ "supplier": false,
107
+ "email": "billing@acme.com"
108
+ }
109
+ ```
110
+
111
+ ## Items/Products Mapping
112
+
113
+ ### Detection
114
+ The items extractor detects columns for: name, code, description, type (PRODUCT/SERVICE), sale price, sale account, sale tax profile, purchase price, purchase account, purchase tax profile.
115
+
116
+ ### Item Types
117
+ - `PRODUCT` — physical goods (default if type column not present)
118
+ - `SERVICE` — services
119
+
120
+ ### Payload Shape
121
+ ```json
122
+ POST /api/v1/items
123
+ {
124
+ "internalName": "Widget Pro",
125
+ "itemCode": "WGT-001",
126
+ "type": "PRODUCT",
127
+ "appliesToSale": true,
128
+ "saleItemName": "Widget Pro",
129
+ "salePrice": 99.00,
130
+ "saleAccountResourceId": "<revenue account ID>",
131
+ "saleTaxProfileResourceId": "<SR tax profile ID>",
132
+ "appliesToPurchase": true,
133
+ "purchaseItemName": "Widget Pro",
134
+ "purchasePrice": 65.00,
135
+ "purchaseAccountResourceId": "<COGS account ID>",
136
+ "purchaseTaxProfileResourceId": "<TX tax profile ID>"
137
+ }
138
+ ```
139
+
140
+ ### Key Rules
141
+ - Items have **two independent sides** — sale and purchase. Each side has its own account and tax profile.
142
+ - Set `appliesToSale: true` if the item has sale pricing/account. Set `appliesToPurchase: true` if it has purchase pricing/account.
143
+ - Account and tax profile references use template strings (`{{account:Revenue}}`, `{{taxProfile:SR}}`) resolved at execution time via the probe.
144
+ - If the source doesn't distinguish sale vs purchase accounts, use the same account for both.
145
+
96
146
  ## Tax Profile Mapping
97
147
 
98
148
  **Tax profiles are READ-ONLY in Jaz.** They are pre-provisioned per org. You can only discover and map.
@@ -122,6 +172,13 @@ Returns all available tax profiles with `taxTypeCode`, `taxPercentage`, and `des
122
172
  | VAT Exempt | VE | 0% |
123
173
  | Zero Rated | VZ | 0% |
124
174
 
175
+ ### Exempt Tax Profile Split (Sales vs Purchase)
176
+ Jaz has separate exempt tax profiles for sales and purchases. Use the correct one:
177
+ - **Invoices / Customer Credit Notes** → exempt profile where `appliesToSale !== false`
178
+ - **Bills / Supplier Credit Notes** → exempt profile where `appliesToPurchase !== false`
179
+
180
+ The probe discovers both: `exemptSalesTaxProfileId` and `exemptPurchaseTaxProfileId`. Using the wrong one may cause validation errors.
181
+
125
182
  ### Handling "No Tax" / Tax-Free Items
126
183
  If a source line item has no tax, omit `taxProfileResourceId` from the line item payload entirely — do NOT set it to a zero-rate profile unless the source explicitly used one.
127
184
 
@@ -131,20 +188,22 @@ If a source line item has no tax, omit `taxProfileResourceId` from the line item
131
188
  Before creating any FX transactions or CoA entries with foreign currency:
132
189
 
133
190
  ```
134
- PUT /api/v1/organization/currencies
191
+ POST /api/v1/organization/currencies
135
192
  {
136
193
  "currencies": ["USD", "EUR", "JPY"]
137
194
  }
138
195
  ```
139
196
 
197
+ **Note:** This is a POST (not PUT).
198
+
140
199
  ### Set FYE Exchange Rates
141
- For Quick Conversion, all conversion transactions use the FYE closing rate:
200
+ For Quick Conversion, all conversion transactions use the FYE closing rate. Rates MUST be set AFTER currencies are enabled:
142
201
 
143
202
  ```
144
203
  POST /api/v1/organization-currencies/<code>/rates
145
204
  {
146
205
  "rate": 1.35,
147
- "effectiveDate": "2023-12-31"
206
+ "rateApplicableFrom": "2023-12-31"
148
207
  }
149
208
  ```
150
209
 
@@ -152,6 +211,8 @@ POST /api/v1/organization-currencies/<code>/rates
152
211
 
153
212
  **Note:** Rate endpoints use `/organization-currencies` (hyphenated). Enable/disable uses `/organization/currencies` (nested path). These are DIFFERENT endpoints.
154
213
 
214
+ **CRITICAL:** The field is `rateApplicableFrom` (NOT `effectiveDate`). Using the wrong field name will silently fail.
215
+
155
216
  ## Confidence Scoring
156
217
 
157
218
  For each mapping, assign a confidence level:
@@ -1,5 +1,7 @@
1
1
  # Full Conversion (Option 1) — Complete Transaction History
2
2
 
3
+ > **Note:** Full Conversion automation is NOT yet implemented in the pipeline. The `conversionType: "full"` manifest option is reserved for future use. This document describes the **manual process** — an agent or human must execute these steps individually using the API. For automated conversion, use Quick Conversion (`conversionType: "quick"`).
4
+
3
5
  ## Overview
4
6
 
5
7
  The Full Conversion transfers **all transaction details** for FY and FY-1 (typically 2 financial years). This preserves the complete audit trail including individual invoices, bills, payments, journals, and more.
@@ -101,8 +103,8 @@ Apply credit notes to invoices/bills if the source shows them as applied.
101
103
 
102
104
  #### 5.1 Bank Records
103
105
  Import bank statements for reconciliation:
104
- - Via `POST /api/v1/bank-records/import` (multipart form)
105
- - Or via individual `POST /api/v1/bank-records`
106
+ - Via `POST /api/v1/magic/importBankStatementFromAttachment` (multipart form with fields: `sourceFile`, `accountResourceId`, `businessTransactionType: "BANK_STATEMENT"`, `sourceType: "FILE"`)
107
+ - Or via individual `POST /api/v1/bank-records/:accountResourceId` (JSON)
106
108
 
107
109
  #### 5.2 Fixed Assets
108
110
  Transfer existing assets with accumulated depreciation:
@@ -34,8 +34,8 @@ Two modes:
34
34
  3. Delete non-system accounts that aren't in the source CoA
35
35
  4. Create/update accounts to match source CoA
36
36
  5. Create two clearing accounts:
37
- - **"AR Conversion Clearing"** — type: `Other Current Assets`, `classificationType: "Current Assets"`
38
- - **"AP Conversion Clearing"** — type: `Other Current Liabilities`, `classificationType: "Current Liabilities"`
37
+ - **"AR Conversion Clearing"** — `classificationType: "Current Asset"`, code: `1299`
38
+ - **"AP Conversion Clearing"** — `classificationType: "Current Liability"`, code: `2199`
39
39
 
40
40
  **Existing org:**
41
41
  1. GET existing CoA from Jaz
@@ -52,6 +52,17 @@ Two modes:
52
52
  - Create customer and supplier contacts from source data
53
53
  - Ensure each contact has: name, type (customer/supplier/both), currency if FX
54
54
 
55
+ ### Phase 1D: Cleanup Stale Conversions (Idempotency)
56
+
57
+ Before creating new conversion transactions, the executor searches for and deletes any existing resources with matching references:
58
+ - `CONV-INV-*` — stale conversion invoices
59
+ - `CONV-BILL-*` — stale conversion bills
60
+ - `CONV-CCN-*` — stale customer credit notes
61
+ - `CONV-SCN-*` — stale supplier credit notes
62
+ - `TTB-*` — stale TTB journals
63
+
64
+ This makes the pipeline **safe to re-run** — if a previous execution partially completed or needs to be redone, Phase 1D cleans up the old resources first.
65
+
55
66
  ### Phase 2: Conversion Transactions
56
67
 
57
68
  #### 2.1 Conversion Invoices (AR)
@@ -142,7 +153,14 @@ POST /api/v1/journals
142
153
  ### Phase 4: Lock & Verify
143
154
 
144
155
  #### 4.1 Lock Date
145
- Set the accounting lock date to the FYE date to prevent accidental edits to the converted data.
156
+ Set the lock date on **each account individually** to the FYE date:
157
+
158
+ ```
159
+ PUT /api/v1/chart-of-accounts/<accountResourceId>
160
+ { "lockDate": "<FYE date>" }
161
+ ```
162
+
163
+ This is NOT a single org-level call — it requires N API calls (one per account). The lock date prevents accidental edits to the converted data on or before the FYE date.
146
164
 
147
165
  #### 4.2 Verify
148
166
  Pull the Trial Balance from Jaz at the FYE date. Compare against the source TB.
@@ -7,10 +7,16 @@ After all conversion transactions are created, verify accuracy by comparing the
7
7
  ### Step 1: Pull Jaz Trial Balance
8
8
 
9
9
  ```
10
- GET /api/v1/reports/trial-balance?asOnDate=<FYE date>
10
+ POST /api/v1/generate-reports/trial-balance
11
+ {
12
+ "startDate": "<FY start date>",
13
+ "endDate": "<FYE date>"
14
+ }
11
15
  ```
12
16
 
13
- This returns all account balances as at the specified date.
17
+ This returns all account balances for the specified period. The response may be wrapped as `{ data: [...] }` or `{ data: { data: [...] } }` — handle both formats.
18
+
19
+ **Note:** This is a POST to `/generate-reports/trial-balance` (NOT a GET to `/reports/trial-balance`).
14
20
 
15
21
  ### Step 2: Parse Source Trial Balance
16
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaz-cli",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "CLI to install Jaz AI skills for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {