jaz-clio 5.9.0 → 5.10.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/assets/skills/api/SKILL.md +4 -4
- package/assets/skills/api/references/endpoints.md +23 -3
- package/assets/skills/api/references/field-map.md +2 -0
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/cli/references/command-catalog.md +1 -1
- package/assets/skills/cli/references/common-workflows.md +7 -4
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jaz-pseudo-sql/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/practice/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/cli.mjs +263 -263
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-api
|
|
3
|
-
version: 5.
|
|
3
|
+
version: 5.10.0
|
|
4
4
|
description: >-
|
|
5
5
|
Use this skill whenever you call, debug, or review code that touches the Jaz
|
|
6
6
|
REST API. Covers field names, response shapes, 141 production gotchas, error
|
|
@@ -189,9 +189,9 @@ The rest of this skill — field names, gotchas, error catalog, dependency order
|
|
|
189
189
|
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.
|
|
190
190
|
|
|
191
191
|
### Jaz Magic — Extraction & Autofill
|
|
192
|
-
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.
|
|
193
|
-
58. **
|
|
194
|
-
59. **Three required fields + one optional**: `sourceFile`
|
|
192
|
+
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.
|
|
193
|
+
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.
|
|
194
|
+
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"`, or `"SUPPLIER_CREDIT_NOTE"` — `EXPENSE` rejected), `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). 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".
|
|
195
195
|
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`.
|
|
196
196
|
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`.
|
|
197
197
|
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).
|
|
@@ -1118,7 +1118,7 @@ Processing is **asynchronous** — the API response confirms file upload immedia
|
|
|
1118
1118
|
- `CUSTOMER_CREDIT_NOTE` → creates a draft customer CN (response type: `SALE_CREDIT_NOTE`)
|
|
1119
1119
|
- `SUPPLIER_CREDIT_NOTE` → creates a draft supplier CN (response type: `PURCHASE_CREDIT_NOTE`)
|
|
1120
1120
|
|
|
1121
|
-
**
|
|
1121
|
+
**Three modes** — content type depends on `sourceType`:
|
|
1122
1122
|
|
|
1123
1123
|
#### FILE mode (multipart/form-data) — most common
|
|
1124
1124
|
|
|
@@ -1171,6 +1171,26 @@ Content-Type: application/json
|
|
|
1171
1171
|
/ Response: same shape as FILE mode
|
|
1172
1172
|
```
|
|
1173
1173
|
|
|
1174
|
+
#### HTML mode (raw email/document body)
|
|
1175
|
+
|
|
1176
|
+
Use when you hold the invoice/bill as raw HTML (e.g. an email body) rather than a file. The backend renders the HTML to a PDF, then runs the same extraction pipeline.
|
|
1177
|
+
|
|
1178
|
+
```json
|
|
1179
|
+
/ Request:
|
|
1180
|
+
POST /api/v1/magic/createBusinessTransactionFromAttachment
|
|
1181
|
+
Content-Type: application/json
|
|
1182
|
+
|
|
1183
|
+
{
|
|
1184
|
+
"businessTransactionType": "INVOICE",
|
|
1185
|
+
"sourceType": "HTML",
|
|
1186
|
+
"html": "<html>…invoice markup…</html>"
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/ Response: same shape as FILE mode
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
`html` is the raw HTML string (max 5 MB); also works as a multipart field. No file or PDF conversion step is needed.
|
|
1193
|
+
|
|
1174
1194
|
**What Jaz Magic extracts and autofills:**
|
|
1175
1195
|
- Line items (description, quantity, unit price, amounts)
|
|
1176
1196
|
- Contact name and details (matched against existing contacts)
|
|
@@ -1191,8 +1211,8 @@ Content-Type: application/json
|
|
|
1191
1211
|
- JSON body with `sourceType: "FILE"` always fails (400) — MUST use multipart
|
|
1192
1212
|
- `workflowResourceId` in `validFiles[]` is for tracking via `POST /magic/workflows/search`
|
|
1193
1213
|
- `subscriptionFBPath` is the Firebase path for real-time status updates
|
|
1194
|
-
- All three fields (`sourceFile`/`sourceURL
|
|
1195
|
-
- File types confirmed: PDF, JPG/JPEG, PNG, HEIC, XLS, XLSX, EML (max 1 MB)
|
|
1214
|
+
- All three fields (the source — `sourceFile`/`sourceURL`/`html` — plus `businessTransactionType` and `sourceType`) are required — omitting any returns 422
|
|
1215
|
+
- File types confirmed: PDF, JPG/JPEG, PNG, HEIC, XLS, XLSX, EML (max 1 MB). HTML mode (`sourceType: "HTML"`) takes the raw HTML body instead of a file (max 5 MB); an `.eml` file is still FILE mode, not HTML mode.
|
|
1196
1216
|
|
|
1197
1217
|
---
|
|
1198
1218
|
|
|
@@ -398,10 +398,12 @@ DELETE → expects "A" (parentEntityResourceId, via /cash-entries/:id)
|
|
|
398
398
|
| JSON body | multipart/form-data | FILE mode requires multipart — JSON returns 400 |
|
|
399
399
|
| Sync response | Async extraction | Response = upload confirmation; extraction & autofill run async |
|
|
400
400
|
| `status` field | `subscriptionFBPath` | Firebase path for tracking extraction progress |
|
|
401
|
+
| email body → save to file first | `html` + `sourceType: "HTML"` | Raw email/document HTML, rendered to PDF server-side — no file step |
|
|
401
402
|
|
|
402
403
|
**Content-Type depends on sourceType:**
|
|
403
404
|
- `sourceType: "FILE"` → `Content-Type: multipart/form-data` (MUST use multipart)
|
|
404
405
|
- `sourceType: "URL"` → `Content-Type: application/json` (JSON body works)
|
|
406
|
+
- `sourceType: "HTML"` → `html` field (JSON or multipart) carrying the raw HTML body (max 5 MB; rendered to PDF server-side)
|
|
405
407
|
|
|
406
408
|
---
|
|
407
409
|
|
|
@@ -362,7 +362,7 @@ Also: `clio reports pdf` — generate PDF from a message/document.
|
|
|
362
362
|
### `clio magic` — AI document extraction
|
|
363
363
|
| Subcommand | Key flags |
|
|
364
364
|
|------------|-----------|
|
|
365
|
-
| `create <
|
|
365
|
+
| `create` | one of `--file <path>` / `--url <url>` / `--html <string\|@file>`; `--type` (invoice, bill, credit-note-customer, credit-note-supplier); `--merged` (split a multi-doc PDF). `--html` takes raw HTML (e.g. an email body), rendered to a PDF server-side. Encrypted PDFs: `name__pw__password.pdf`. |
|
|
366
366
|
| `status <workflowIds>` | Comma-separated workflow IDs |
|
|
367
367
|
| `search` | `--type`, `--status`, `--from`, `--to`, `--limit`, `--offset` |
|
|
368
368
|
|
|
@@ -232,8 +232,11 @@ Ingest documents, extract data via AI, and review results.
|
|
|
232
232
|
# Ingest a folder of mixed PDFs (invoices, bills, bank statements)
|
|
233
233
|
clio jobs ingest ./inbox/ --json
|
|
234
234
|
|
|
235
|
-
# Or extract a single document
|
|
236
|
-
clio magic create ./invoice-from-supplier.pdf --type bill --
|
|
235
|
+
# Or extract a single document (file, URL, or raw HTML)
|
|
236
|
+
clio magic create --file ./invoice-from-supplier.pdf --type bill --json
|
|
237
|
+
|
|
238
|
+
# From raw HTML — e.g. an email body (rendered to a PDF, then extracted)
|
|
239
|
+
clio magic create --html @./email-body.html --type invoice --json
|
|
237
240
|
|
|
238
241
|
# Check workflow status
|
|
239
242
|
clio magic status "wf-id-1,wf-id-2,wf-id-3" --json
|
|
@@ -241,6 +244,6 @@ clio magic status "wf-id-1,wf-id-2,wf-id-3" --json
|
|
|
241
244
|
# Search past magic workflows
|
|
242
245
|
clio magic search --type bill --status COMPLETED --from 2026-03-01 --json
|
|
243
246
|
|
|
244
|
-
# For encrypted PDFs
|
|
245
|
-
clio magic create ./encrypted-
|
|
247
|
+
# For encrypted PDFs — embed the password in the filename via __pw__
|
|
248
|
+
clio magic create --file ./encrypted-file__pw__secret123.pdf --type invoice --json
|
|
246
249
|
```
|