{"version":"1","generatedAt":"2026-12-01T03:59:02.250Z","tools":[{"name":"accounting_create","title":"Create a journal entry","description":"Posts a manual journal entry to the general ledger. Inputs: date, optional memo, and legs (debit/credit lines per account that must balance). Returns the entry with its postings. Rejected when the date falls in a locked period.\n\n(Scope: accounting:write · requires CONTRIBUTOR+ · endpoint: POST /api/journal-entries)","http":{"method":"POST","path":"/api/journal-entries"},"feature":"accounting","verb":"write","scope":"accounting:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"date":{"type":"string"},"memo":{"anyOf":[{"type":"string"},{"type":"null"}]},"legs":{"minItems":2,"type":"array","items":{"type":"object","properties":{"account":{"type":"string","enum":["CASH","AR","AP","REVENUE","EXPENSE","TAX_PAYABLE","TAX_RECEIVABLE","EQUITY","PREPAID_EXPENSE","DEFERRED_REVENUE","SALARY_EXPENSE","STATUTORY_EXPENSE","EMPLOYEE_PAYABLE","STATUTORY_PAYABLE","GOVERNMENT_RECEIVABLE","GPL_FUNDING","UNAPPLIED_PAYMENTS"]},"debit":{"type":"number","minimum":0},"credit":{"type":"number","minimum":0}},"required":["account","debit","credit"],"additionalProperties":false}}},"required":["organizationId","date","legs"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"date":{"type":"string"},"memo":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"postings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account":{"type":"string","enum":["CASH","AR","AP","REVENUE","EXPENSE","TAX_PAYABLE","TAX_RECEIVABLE","EQUITY","PREPAID_EXPENSE","DEFERRED_REVENUE","SALARY_EXPENSE","STATUTORY_EXPENSE","EMPLOYEE_PAYABLE","STATUTORY_PAYABLE","GOVERNMENT_RECEIVABLE","GPL_FUNDING","UNAPPLIED_PAYMENTS"]},"debit":{"type":"number"},"credit":{"type":"number"}},"required":["id","account","debit","credit"],"additionalProperties":false}}},"required":["id","organizationId","date","memo","createdAt","postings"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"accounting_delete","title":"Delete a journal entry","description":"Permanently deletes a manual journal entry and its postings from the ledger by id. Rejected when the entry falls in a locked period. Returns { success }.\n\n(Scope: accounting:write · requires CONTRIBUTOR+ · endpoint: DELETE /api/journal-entries/{id})","http":{"method":"DELETE","path":"/api/journal-entries/{id}"},"feature":"accounting","verb":"write","scope":"accounting:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1}},"required":["id","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"accounting_export_list","title":"Export the ledger as CSV","description":"Downloads the general ledger as a CSV file. Optional from/to dates (YYYY-MM-DD) narrow the period. Returns a CSV file, not JSON.\n\n(Scope: accounting:read · endpoint: GET /api/ledger/export)","http":{"method":"GET","path":"/api/ledger/export"},"feature":"accounting","verb":"read","scope":"accounting:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"from":{"type":"string"},"to":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"accounting_list","title":"List journal entries","description":"Lists the organization's manual journal entries with their debit/credit postings. Optional from/to dates (YYYY-MM-DD) narrow the period. Returns { journalEntries }.\n\n(Scope: accounting:read · endpoint: GET /api/journal-entries)","http":{"method":"GET","path":"/api/journal-entries"},"feature":"accounting","verb":"read","scope":"accounting:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"from":{"type":"string"},"to":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"journalEntries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"date":{"type":"string"},"memo":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"postings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account":{"type":"string","enum":["CASH","AR","AP","REVENUE","EXPENSE","TAX_PAYABLE","TAX_RECEIVABLE","EQUITY","PREPAID_EXPENSE","DEFERRED_REVENUE","SALARY_EXPENSE","STATUTORY_EXPENSE","EMPLOYEE_PAYABLE","STATUTORY_PAYABLE","GOVERNMENT_RECEIVABLE","GPL_FUNDING","UNAPPLIED_PAYMENTS"]},"debit":{"type":"number"},"credit":{"type":"number"}},"required":["id","account","debit","credit"],"additionalProperties":false}}},"required":["id","organizationId","date","memo","createdAt","postings"],"additionalProperties":false}}},"required":["journalEntries"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"accounting_lock_update","title":"Lock the books through a date","description":"Sets the period lock date: no ledger entry dated on or before it can be created, changed or removed afterwards. Input: lockedThrough (YYYY-MM-DD). Requires MANAGER. Returns the new lock date.\n\n(Scope: accounting:write · requires MANAGER+ · endpoint: PATCH /api/ledger/lock)","http":{"method":"PATCH","path":"/api/ledger/lock"},"feature":"accounting","verb":"write","scope":"accounting:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"lockedThrough":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organizationId","lockedThrough"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"lockedThrough":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["lockedThrough"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"accounting_postings_list","title":"List ledger postings","description":"Lists dated ledger postings with account, debit, credit, source and recorded currency. The byCurrency totals cover the entire requested date range, including rows beyond the page limit. unassignedCount counts postings with unknown currency. unresolvedPaymentCount counts settlements whose currency could not be determined. totalDebit and totalCredit are null when the range is mixed or incomplete.\n\n(Scope: accounting:read · endpoint: GET /api/ledger/postings)","http":{"method":"GET","path":"/api/ledger/postings"},"feature":"accounting","verb":"read","scope":"accounting:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"from":{"type":"string"},"to":{"type":"string"},"limit":{"default":200,"type":"integer","minimum":1,"maximum":1000}},"required":["organizationId","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"byCurrency":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"debit":{"type":"number"},"credit":{"type":"number"}},"required":["currency","debit","credit"],"additionalProperties":false}},"unresolvedPaymentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"unassignedCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalDebit":{"anyOf":[{"type":"number"},{"type":"null"}]},"totalCredit":{"anyOf":[{"type":"number"},{"type":"null"}]},"postings":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"kind":{"type":"string","enum":["document","payment","recognition","journal"]},"source":{"type":"string"},"account":{"type":"string"},"accountName":{"type":"string"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"debit":{"type":"number"},"credit":{"type":"number"}},"required":["date","kind","source","account","accountName","currency","debit","credit"],"additionalProperties":false}},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["byCurrency","unresolvedPaymentCount","unassignedCount","totalDebit","totalCredit","postings","total"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"accounting_summary_list","title":"Get ledger summary","description":"Summarizes automatic obligations, settlements and manual entries. Includes the books lock date, debit and credit totals by recorded currency, and counts of postings and settlements with unresolved currencies. totalDebit and totalCredit are null for mixed or incomplete totals.\n\n(Scope: accounting:read · endpoint: GET /api/ledger/summary)","http":{"method":"GET","path":"/api/ledger/summary"},"feature":"accounting","verb":"read","scope":"accounting:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"byCurrency":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"debit":{"type":"number"},"credit":{"type":"number"}},"required":["currency","debit","credit"],"additionalProperties":false}},"unresolvedPaymentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"unassignedCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalDebit":{"anyOf":[{"type":"number"},{"type":"null"}]},"totalCredit":{"anyOf":[{"type":"number"},{"type":"null"}]},"autoObligations":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"autoSettlements":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"manualEntries":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lockedThrough":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["byCurrency","unresolvedPaymentCount","unassignedCount","totalDebit","totalCredit","autoObligations","autoSettlements","manualEntries","lockedThrough"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"attendance_approve","title":"Approve attendance sessions","description":"Approves the work sessions of one employee (counterpartyId) or of everyone, between from and to (YYYY-MM-DD). Records approval on the timesheet data only; it does not pay anyone. Requires MANAGER. Returns { approved, skipped }.\n\n(Scope: attendance:write · requires MANAGER+ · endpoint: POST /api/hr/attendance/approve)","http":{"method":"POST","path":"/api/hr/attendance/approve"},"feature":"attendance","verb":"write","scope":"attendance:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"}},"required":["organizationId","from","to"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"approved":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Sessions left unapproved: the approver's own, and rows in a locked or already-paid month."}},"required":["approved","skipped"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"attendance_check_in","title":"Clock in","description":"Starts a work session for the signed-in employee at the current time. The login must be linked to an employee record in the organization. Returns the new session with its start time and source.\n\n(Scope: attendance:write · requires VIEWER+ · endpoint: POST /api/hr/attendance/check-in)","http":{"method":"POST","path":"/api/hr/attendance/check-in"},"feature":"attendance","verb":"write","scope":"attendance:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"startAt":{"type":"string","description":"ISO instant, server-stamped for a CLOCK punch."},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null ⟺ the session is open (law 18)."},"source":{"type":"string","enum":["CLOCK","MANUAL"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalStartAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalEndAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","counterpartyId","employeeName","startAt","endAt","source","note","approvedAt","approvedByUserId","editedAt","originalStartAt","originalEndAt","hours"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"attendance_check_out","title":"Clock out","description":"Ends the signed-in employee's open work session at the current time. Returns the closed session with its worked hours.\n\n(Scope: attendance:write · requires VIEWER+ · endpoint: POST /api/hr/attendance/check-out)","http":{"method":"POST","path":"/api/hr/attendance/check-out"},"feature":"attendance","verb":"write","scope":"attendance:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"startAt":{"type":"string","description":"ISO instant, server-stamped for a CLOCK punch."},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null ⟺ the session is open (law 18)."},"source":{"type":"string","enum":["CLOCK","MANUAL"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalStartAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalEndAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","counterpartyId","employeeName","startAt","endAt","source","note","approvedAt","approvedByUserId","editedAt","originalStartAt","originalEndAt","hours"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"attendance_sessions_create","title":"Add a work session","description":"Adds a work session by hand. Inputs: counterpartyId (employee), startAt, optional endAt, and a note explaining the manual entry. Returns the created session.\n\n(Scope: attendance:write · requires CONTRIBUTOR+ · endpoint: POST /api/hr/attendance/sessions)","http":{"method":"POST","path":"/api/hr/attendance/sessions"},"feature":"attendance","verb":"write","scope":"attendance:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string"},"startAt":{"type":"string"},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"type":"string","minLength":1}},"required":["organizationId","startAt","note"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"startAt":{"type":"string","description":"ISO instant, server-stamped for a CLOCK punch."},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null ⟺ the session is open (law 18)."},"source":{"type":"string","enum":["CLOCK","MANUAL"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalStartAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalEndAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","counterpartyId","employeeName","startAt","endAt","source","note","approvedAt","approvedByUserId","editedAt","originalStartAt","originalEndAt","hours"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"attendance_sessions_delete","title":"Delete a work session","description":"Deletes one work session by id, removing its hours from the employee's timesheet. Returns { success }.\n\n(Scope: attendance:write · requires CONTRIBUTOR+ · endpoint: DELETE /api/hr/attendance/sessions/{id})","http":{"method":"DELETE","path":"/api/hr/attendance/sessions/{id}"},"feature":"attendance","verb":"write","scope":"attendance:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1}},"required":["id","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"attendance_sessions_list","title":"List work sessions","description":"Lists work sessions between from and to (YYYY-MM-DD), optionally for one employee (counterpartyId), with paging. Each row has start, end, hours, source and approval state. Returns { sessions, pagination }.\n\n(Scope: attendance:read · requires VIEWER+ · endpoint: GET /api/hr/attendance/sessions)","http":{"method":"GET","path":"/api/hr/attendance/sessions"},"feature":"attendance","verb":"read","scope":"attendance:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"from":{"type":"string"},"to":{"type":"string"},"counterpartyId":{"type":"string"},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":25,"type":"integer","minimum":1,"maximum":100}},"required":["organizationId","from","to","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"startAt":{"type":"string","description":"ISO instant, server-stamped for a CLOCK punch."},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null ⟺ the session is open (law 18)."},"source":{"type":"string","enum":["CLOCK","MANUAL"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalStartAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalEndAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","counterpartyId","employeeName","startAt","endAt","source","note","approvedAt","approvedByUserId","editedAt","originalStartAt","originalEndAt","hours"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["sessions","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"attendance_sessions_update","title":"Edit a work session","description":"Edits the start or end time of a work session and records why in the note. The original times are kept for audit. Returns the updated session.\n\n(Scope: attendance:write · requires CONTRIBUTOR+ · endpoint: PATCH /api/hr/attendance/sessions/{id})","http":{"method":"PATCH","path":"/api/hr/attendance/sessions/{id}"},"feature":"attendance","verb":"write","scope":"attendance:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1},"startAt":{"type":"string"},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"type":"string","minLength":1}},"required":["id","organizationId","note"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"startAt":{"type":"string","description":"ISO instant, server-stamped for a CLOCK punch."},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null ⟺ the session is open (law 18)."},"source":{"type":"string","enum":["CLOCK","MANUAL"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalStartAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalEndAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","counterpartyId","employeeName","startAt","endAt","source","note","approvedAt","approvedByUserId","editedAt","originalStartAt","originalEndAt","hours"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"attendance_timesheets_list","title":"Get timesheets","description":"Builds timesheets between from and to (YYYY-MM-DD), optionally for one employee: hours per employee and day, open sessions, pending-approval hours and anomalies. Read-only. Returns { rows, openSessions, pendingHours, anomalies, … }.\n\n(Scope: attendance:read · requires VIEWER+ · endpoint: GET /api/hr/timesheets)","http":{"method":"GET","path":"/api/hr/timesheets"},"feature":"attendance","verb":"read","scope":"attendance:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"from":{"type":"string"},"to":{"type":"string"},"counterpartyId":{"type":"string"}},"required":["organizationId","from","to"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"days":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"totalHours":{"type":"number"},"pendingHours":{"type":"number"},"openSessions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["counterpartyId","employeeName","days","totalHours","pendingHours","openSessions"],"additionalProperties":false}},"timezone":{"type":"string"},"openSessions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pendingHours":{"type":"number"},"ordinaryOnly":{"type":"boolean"},"country":{"type":"string"},"anomalies":{"type":"array","items":{"type":"object","properties":{"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"day":{"type":"string"},"workedHours":{"type":"number"},"leaveKind":{"type":"string"}},"required":["counterpartyId","employeeName","day","workedHours","leaveKind"],"additionalProperties":false}}},"required":["rows","timezone","openSessions","pendingHours","ordinaryOnly","country","anomalies"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_catalog","title":"Get automation building blocks","description":"Returns the building blocks for authoring automations — call this BEFORE automations_create or automations_update. Three catalogs: triggers (event types usable as a TRIGGER block's ref, each with the payload JSON Schema that {{trigger.*}} bindings can reference), actions (every tool usable as an ACTION block's ref — the full MCP tool catalog plus engine-native webhook.post / email.send — each with input/output JSON Schemas for config.input), and filterCatalog (the objects, fields, and follow morphisms a FILTER block's config.spec may range over). Read-only, org-agnostic.","http":{"method":"GET","path":"/api/automations/actions"},"feature":"automations","verb":"read","scope":"automations:read","hasBody":false,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"Event type — use as a TRIGGER block's ref (e.g. \"invoice.paid\", \"schedule.daily\")."},"label":{"type":"string"},"group":{"type":"string"},"payloadSchema":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"JSON Schema for the trigger's event payload — the fields {{trigger.*}} bindings can reference."}},"required":["type","label","group","payloadSchema"],"additionalProperties":false},"description":"Event types usable as a TRIGGER block's ref."},"actions":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Tool name — use as an ACTION block's ref (e.g. \"invoices_send_create\", \"webhook.post\")."},"description":{"type":"string"},"feature":{"type":"string"},"verb":{"type":"string"},"kind":{"type":"string","enum":["system","engine"],"description":"system = an API route invoked as a tool; engine = built into the worker."},"inputSchema":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"JSON Schema (draft-7) for the action's input — the shape an ACTION block's config.input must satisfy."},"outputSchema":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"JSON Schema for the action's output (what downstream {{blocks.<id>.…}} bindings can read), or null for opaque/streamed results."}},"required":["name","description","feature","verb","kind","inputSchema","outputSchema"],"additionalProperties":false},"description":"Tools usable as an ACTION block's ref."},"filterCatalog":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date"]}},"required":["name","type"],"additionalProperties":false}},"morphisms":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["fields","morphisms"],"additionalProperties":false},"description":"Objects a FILTER block's config.spec may range over: object name → readable fields (with primitive types) + follow morphisms (name → target object)."}},"required":["triggers","actions","filterCatalog"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_create","title":"Create an automation","description":"Create an automation: a graph of blocks (nodes) joined by edges. Call automations_catalog FIRST — it lists every valid trigger event type (with the payload fields {{trigger.*}} bindings can reference), every action tool name (with its input schema), and the filterable-object catalog for FILTER blocks. A TRIGGER block sets ref to an event type (e.g. \"invoice.paid\"); an ACTION block sets ref to a tool name (e.g. \"invoices_send_create\" or \"webhook.post\") with its arguments in config.input, where values may embed {{…}} bindings; a FILTER block puts its query in config.spec. The graph needs at least one TRIGGER and must be acyclic. Created in DRAFT status — it does not fire yet: verify it with automations_test_create, then arm it with automations_enable_create. Requires CONTRIBUTOR+.","http":{"method":"POST","path":"/api/automations"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000},"blocks":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"config":{"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"position":{"description":"Editor canvas hint ({ x, y }). Ignored by the engine.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","kind"],"additionalProperties":false}},"edges":{"default":[],"maxItems":300,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","minLength":1,"description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","minLength":1,"description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\").","anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"mode":{"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run.","type":"string","enum":["ONCE","FOR_EACH"]},"order":{"description":"Display ordering only — execution order is topological.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","fromBlockId","toBlockId"],"additionalProperties":false}}},"required":["organizationId","name","blocks","edges"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerUserId":{"type":"string","description":"The run-as identity: when the automation fires, actions execute under this user's current org permissions."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"],"description":"DRAFT = never armed; ENABLED = armed (fires on its trigger; the free tier allows 5 enabled per org); PAUSED = manually disarmed; PAUSED_NO_ACCESS = auto-paused because the owner lost the required org access."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored."},"position":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Editor canvas hint ({ x, y }). Ignored by the engine."}},"required":["id","kind","ref","config","position"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\")."},"mode":{"type":"string","enum":["ONCE","FOR_EACH"],"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run."},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Display ordering only — execution order is topological."}},"required":["id","fromBlockId","toBlockId","cond","mode","order"],"additionalProperties":false}}},"required":["id","organizationId","ownerUserId","name","description","status","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"automations_delete","title":"Delete an automation","description":"Permanently delete an automation, its graph, and its run history (hard delete — cannot be undone). To stop it firing without losing anything, use automations_disable_create instead. Requires MANAGER.","http":{"method":"DELETE","path":"/api/automations/{id}"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_disable_create","title":"Pause an automation","description":"Disarm an automation (status becomes PAUSED): it stops firing on its trigger. The graph and run history are kept, and it can be re-enabled later. Requires CONTRIBUTOR+.","http":{"method":"POST","path":"/api/automations/{id}/disable"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerUserId":{"type":"string","description":"The run-as identity: when the automation fires, actions execute under this user's current org permissions."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"],"description":"DRAFT = never armed; ENABLED = armed (fires on its trigger; the free tier allows 5 enabled per org); PAUSED = manually disarmed; PAUSED_NO_ACCESS = auto-paused because the owner lost the required org access."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored."},"position":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Editor canvas hint ({ x, y }). Ignored by the engine."}},"required":["id","kind","ref","config","position"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\")."},"mode":{"type":"string","enum":["ONCE","FOR_EACH"],"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run."},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Display ordering only — execution order is topological."}},"required":["id","fromBlockId","toBlockId","cond","mode","order"],"additionalProperties":false}}},"required":["id","organizationId","ownerUserId","name","description","status","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_enable_create","title":"Enable an automation","description":"Arm an automation so it fires whenever its TRIGGER event occurs. Requires at least one TRIGGER block. The free tier allows 5 enabled automations per org — enabling past the cap returns 409 CONFLICT. Enabling an already-enabled automation is a no-op. Requires CONTRIBUTOR+.","http":{"method":"POST","path":"/api/automations/{id}/enable"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerUserId":{"type":"string","description":"The run-as identity: when the automation fires, actions execute under this user's current org permissions."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"],"description":"DRAFT = never armed; ENABLED = armed (fires on its trigger; the free tier allows 5 enabled per org); PAUSED = manually disarmed; PAUSED_NO_ACCESS = auto-paused because the owner lost the required org access."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored."},"position":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Editor canvas hint ({ x, y }). Ignored by the engine."}},"required":["id","kind","ref","config","position"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\")."},"mode":{"type":"string","enum":["ONCE","FOR_EACH"],"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run."},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Display ordering only — execution order is topological."}},"required":["id","fromBlockId","toBlockId","cond","mode","order"],"additionalProperties":false}}},"required":["id","organizationId","ownerUserId","name","description","status","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":true}},{"name":"automations_get","title":"Get an automation","description":"Returns one automation by id with its status and full graph (blocks and edges). Read-only. Use automations_catalog to learn what the block refs mean.\n\n(Scope: automations:read · endpoint: GET /api/automations/{id})","http":{"method":"GET","path":"/api/automations/{id}"},"feature":"automations","verb":"read","scope":"automations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerUserId":{"type":"string","description":"The run-as identity: when the automation fires, actions execute under this user's current org permissions."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"],"description":"DRAFT = never armed; ENABLED = armed (fires on its trigger; the free tier allows 5 enabled per org); PAUSED = manually disarmed; PAUSED_NO_ACCESS = auto-paused because the owner lost the required org access."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored."},"position":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Editor canvas hint ({ x, y }). Ignored by the engine."}},"required":["id","kind","ref","config","position"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\")."},"mode":{"type":"string","enum":["ONCE","FOR_EACH"],"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run."},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Display ordering only — execution order is topological."}},"required":["id","fromBlockId","toBlockId","cond","mode","order"],"additionalProperties":false}}},"required":["id","organizationId","ownerUserId","name","description","status","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_list","title":"List automations","description":"Lists the organization's automations, optionally filtered by status (DRAFT, ENABLED, PAUSED), with paging. Returns { automations, pagination } without the graphs.\n\n(Scope: automations:read · endpoint: GET /api/automations)","http":{"method":"GET","path":"/api/automations"},"feature":"automations","verb":"read","scope":"automations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"]},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":20,"type":"integer","minimum":1,"maximum":100}},"required":["organizationId","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerUserId":{"type":"string","description":"The run-as identity: when the automation fires, actions execute under this user's current org permissions."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"],"description":"DRAFT = never armed; ENABLED = armed (fires on its trigger; the free tier allows 5 enabled per org); PAUSED = manually disarmed; PAUSED_NO_ACCESS = auto-paused because the owner lost the required org access."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored."},"position":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Editor canvas hint ({ x, y }). Ignored by the engine."}},"required":["id","kind","ref","config","position"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\")."},"mode":{"type":"string","enum":["ONCE","FOR_EACH"],"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run."},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Display ordering only — execution order is topological."}},"required":["id","fromBlockId","toBlockId","cond","mode","order"],"additionalProperties":false}}},"required":["id","organizationId","ownerUserId","name","description","status","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["automations","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_preview_create","title":"Preview an automation filter","description":"Dry-run a FILTER block's spec against the caller's org data: returns the match count plus up to 5 sample shaped rows (or the scalar). Use it to validate a spec before putting it in a FILTER block's config.spec. {{…}} bindings are NOT resolved here (there is no run scope at edit time) — preview with literal predicate values. Valid objects/fields/morphisms come from automations_catalog's filterCatalog.","http":{"method":"POST","path":"/api/automations/filter/preview"},"feature":"automations","verb":"read","scope":"automations:read","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"spec":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"A FilterSpec: { root, follows?, predicates?, aggregateBy?, extract, shape? }. root names a filterCatalog object; predicates are { object, field, op, value } with op one of eq|ne|gt|gte|lt|lte|in|nin|contains; extract entries are { as, path: \"Object.field\", fn?: \"sum\"|\"count\" }; shape is \"objects\" (default) | \"scalars\" | \"scalar\"."}},"required":["organizationId","spec"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Number of matching rows (capped at 1000)."},"sample":{"type":"array","items":{},"description":"First 5 shaped results (empty for shape: \"scalar\")."},"scalar":{"description":"The single value when the spec's shape is \"scalar\"."}},"required":["count","sample"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_replay_create","title":"Replay a failed automation run","description":"Resume a FAILED run from its failed step. Steps that already succeeded are NOT re-executed — their recorded outputs are reused — and the original trigger payload is kept. Only FAILED runs are replayable. Requires CONTRIBUTOR+.","http":{"method":"POST","path":"/api/automations/{id}/runs/{runId}/replay"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"}},"required":["id","runId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"automationId":{"type":"string"},"organizationId":{"type":"string"},"triggerEventId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The outbox event that fired this run; null for a manual test run."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The trigger payload the run was seeded with — what {{trigger.*}} resolved against."},"status":{"type":"string","enum":["RUNNING","SUCCEEDED","FAILED","CANCELLED"],"description":"FAILED pauses at the first failed step; a FAILED run can be resumed via replay."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string"},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"blockId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The block this step executed; null if that block was later edited out of the graph."},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"],"description":"SKIPPED = no incoming edge had a succeeded source with a passing cond."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The block's resolved input (bindings already substituted)."},"output":{"anyOf":[{},{"type":"null"}],"description":"The block's output — what downstream {{blocks.<id>.…}} bindings read."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"1-based; transient action failures are retried."},"latencyMs":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","blockId","status","input","output","error","attempt","latencyMs","startedAt","finishedAt"],"additionalProperties":false}}},"required":["id","automationId","organizationId","triggerEventId","input","status","error","startedAt","finishedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"automations_run","title":"Get an automation run","description":"Get a single run with its step-by-step timeline: each block's resolved input, output, status, error, and latency. Use it to inspect what a run actually did, or to debug a FAILED run before automations_replay_create.","http":{"method":"GET","path":"/api/automations/{id}/runs/{runId}"},"feature":"automations","verb":"read","scope":"automations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"}},"required":["id","runId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"automationId":{"type":"string"},"organizationId":{"type":"string"},"triggerEventId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The outbox event that fired this run; null for a manual test run."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The trigger payload the run was seeded with — what {{trigger.*}} resolved against."},"status":{"type":"string","enum":["RUNNING","SUCCEEDED","FAILED","CANCELLED"],"description":"FAILED pauses at the first failed step; a FAILED run can be resumed via replay."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string"},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"blockId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The block this step executed; null if that block was later edited out of the graph."},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"],"description":"SKIPPED = no incoming edge had a succeeded source with a passing cond."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The block's resolved input (bindings already substituted)."},"output":{"anyOf":[{},{"type":"null"}],"description":"The block's output — what downstream {{blocks.<id>.…}} bindings read."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"1-based; transient action failures are retried."},"latencyMs":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","blockId","status","input","output","error","attempt","latencyMs","startedAt","finishedAt"],"additionalProperties":false}}},"required":["id","automationId","organizationId","triggerEventId","input","status","error","startedAt","finishedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"automations_runs","title":"List automation runs","description":"List one automation's runs (history), newest first. Returns ONE page — default 25 rows, max 100 via `limit` — and renders as an interactive widget that pages in place. Fetch a single page; do not call this repeatedly to walk every page unless the user explicitly asks for the full history.","http":{"method":"GET","path":"/api/automations/{id}/runs"},"feature":"automations","verb":"read","scope":"automations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":25,"type":"integer","minimum":1,"maximum":100}},"required":["id","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"automationId":{"type":"string"},"organizationId":{"type":"string"},"triggerEventId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The outbox event that fired this run; null for a manual test run."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The trigger payload the run was seeded with — what {{trigger.*}} resolved against."},"status":{"type":"string","enum":["RUNNING","SUCCEEDED","FAILED","CANCELLED"],"description":"FAILED pauses at the first failed step; a FAILED run can be resumed via replay."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string"},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"blockId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The block this step executed; null if that block was later edited out of the graph."},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"],"description":"SKIPPED = no incoming edge had a succeeded source with a passing cond."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The block's resolved input (bindings already substituted)."},"output":{"anyOf":[{},{"type":"null"}],"description":"The block's output — what downstream {{blocks.<id>.…}} bindings read."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"1-based; transient action failures are retried."},"latencyMs":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","blockId","status","input","output","error","attempt","latencyMs","startedAt","finishedAt"],"additionalProperties":false}}},"required":["id","automationId","organizationId","triggerEventId","input","status","error","startedAt","finishedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["runs","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/automation-runs"},"ui/resourceUri":"ui://guliel/automation-runs","openai/outputTemplate":"ui://guliel/automation-runs"}},{"name":"automations_test_create","title":"Test an automation","description":"Execute an automation synchronously with a sample trigger payload and return the finished run with its per-step results. Works on DRAFT automations — use it to verify a flow before enabling. Pass payload shaped like the trigger's payloadSchema from automations_catalog; if omitted it defaults to {} and {{trigger.*}} bindings resolve to nothing. ACTIONS REALLY EXECUTE (this is not a dry run). Runs under the automation OWNER's permissions, so the caller must be the owner or a MANAGER.","http":{"method":"POST","path":"/api/automations/{id}/test"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"payload":{"description":"Sample trigger payload — the value {{trigger.*}} bindings resolve against. Shape it like the trigger's payloadSchema from automations_catalog. Defaults to {}.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"automationId":{"type":"string"},"organizationId":{"type":"string"},"triggerEventId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The outbox event that fired this run; null for a manual test run."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The trigger payload the run was seeded with — what {{trigger.*}} resolved against."},"status":{"type":"string","enum":["RUNNING","SUCCEEDED","FAILED","CANCELLED"],"description":"FAILED pauses at the first failed step; a FAILED run can be resumed via replay."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string"},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"blockId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The block this step executed; null if that block was later edited out of the graph."},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"],"description":"SKIPPED = no incoming edge had a succeeded source with a passing cond."},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The block's resolved input (bindings already substituted)."},"output":{"anyOf":[{},{"type":"null"}],"description":"The block's output — what downstream {{blocks.<id>.…}} bindings read."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"1-based; transient action failures are retried."},"latencyMs":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","blockId","status","input","output","error","attempt","latencyMs","startedAt","finishedAt"],"additionalProperties":false}}},"required":["id","automationId","organizationId","triggerEventId","input","status","error","startedAt","finishedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"automations_update","title":"Update an automation","description":"Update an automation's name/description and/or replace its graph. Graph edits are whole-graph replacement: pass BOTH blocks AND edges together (same format as automations_create — at least one TRIGGER, acyclic); passing only one of the two is a 400. Historical run steps survive a graph edit. Requires CONTRIBUTOR+.","http":{"method":"PATCH","path":"/api/automations/{id}"},"feature":"automations","verb":"write","scope":"automations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"blocks":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"config":{"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"position":{"description":"Editor canvas hint ({ x, y }). Ignored by the engine.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","kind"],"additionalProperties":false}},"edges":{"maxItems":300,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","minLength":1,"description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","minLength":1,"description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\").","anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"mode":{"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run.","type":"string","enum":["ONCE","FOR_EACH"]},"order":{"description":"Display ordering only — execution order is topological.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","fromBlockId","toBlockId"],"additionalProperties":false}}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerUserId":{"type":"string","description":"The run-as identity: when the automation fires, actions execute under this user's current org permissions."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["DRAFT","ENABLED","PAUSED","PAUSED_NO_ACCESS"],"description":"DRAFT = never armed; ENABLED = armed (fires on its trigger; the free tier allows 5 enabled per org); PAUSED = manually disarmed; PAUSED_NO_ACCESS = auto-paused because the owner lost the required org access."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation. Edges reference blocks by this id, and downstream blocks read this block's output via {{blocks.<id>.…}} bindings."},"kind":{"type":"string","enum":["TRIGGER","FILTER","ACTION","CUSTOM"],"description":"TRIGGER starts the flow when its event fires (every automation needs at least one); FILTER queries org data and outputs a shaped list/value; ACTION invokes a tool; CUSTOM is reserved and not executable in v1."},"ref":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What the block invokes. TRIGGER: an event type from the catalog, e.g. \"invoice.paid\" or \"schedule.daily\" (GET /api/automations/actions lists them). ACTION: an MCP tool name, e.g. \"invoices_send_create\", or engine-native \"webhook.post\" / \"email.send\". FILTER: omit — the query lives in config.spec."},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Kind-specific configuration. ACTION: { input: { … } } — the arguments for the tool named by ref, matching that tool's inputSchema from the catalog; values may embed {{…}} bindings ({{trigger.*}}, {{blocks.<id>.*}}, {{item.*}} under a FOR_EACH edge, {{context.now}}, {{context.today}}, {{context.orgId}}) — a whole-string binding like \"{{trigger.total}}\" keeps the value's native type, inline bindings interpolate into the string. FILTER: { spec: { root, follows?, predicates?, aggregateBy?, extract, shape? } } over the served filter catalog. TRIGGER: ignored."},"position":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Editor canvas hint ({ x, y }). Ignored by the engine."}},"required":["id","kind","ref","config","position"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Client-chosen id, unique within the automation."},"fromBlockId":{"type":"string","description":"Id of the source block. The graph must be a DAG — self-loops and cycles are rejected."},"toBlockId":{"type":"string","description":"Id of the target block. The target runs only after the source step succeeds and the cond (if any) passes."},"cond":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Optional guard — null/omitted means the edge is always followed. Leaf: { left, op, right? } with op one of eq | ne | gt | gte | lt | lte | in | nin | contains | exists | empty; compose with { all: […] }, { any: […] }, { not: … }. Operands may be literals or {{…}} bindings; comparisons are type-light (100 equals \"100\")."},"mode":{"type":"string","enum":["ONCE","FOR_EACH"],"description":"ONCE (default) passes the source output downstream as-is; FOR_EACH fans a list-valued source output out, running the target once per element (exposed as {{item.*}}) — a non-list source falls back to a single run."},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Display ordering only — execution order is topological."}},"required":["id","fromBlockId","toBlockId","cond","mode","order"],"additionalProperties":false}}},"required":["id","organizationId","ownerUserId","name","description","status","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":true}},{"name":"bank_accounts_create","title":"Add a bank account","description":"Stores a bank account on the organization so it can be printed on invoices. Inputs: accountName, bankName, currencies, and the identifiers the country needs (accountNumber, branchCode, IBAN, SWIFT, routing number). Records details only; there is no bank connection. Returns the saved account.\n\n(Scope: bank_accounts:write · requires CONTRIBUTOR+ · endpoint: POST /api/bank-accounts)","http":{"method":"POST","path":"/api/bank-accounts"},"feature":"bank_accounts","verb":"write","scope":"bank_accounts:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"accountName":{"type":"string","minLength":1},"bankName":{"type":"string","minLength":1},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"default":["USD"],"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"internationalBankName":{"anyOf":[{"type":"string","maxLength":255,"pattern":"^[^\\p{Cc}\\p{Zl}\\p{Zp}\\p{Bidi_Control}]*$"},{"type":"null"}]},"internationalBeneficiaryName":{"anyOf":[{"type":"string","maxLength":255,"pattern":"^[^\\p{Cc}\\p{Zl}\\p{Zp}\\p{Bidi_Control}]*$"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"default":false,"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organizationId","accountName","bankName","currencies","isDefault"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"accountName":{"type":"string"},"bankName":{"type":"string"},"internationalBankName":{"anyOf":[{"type":"string"},{"type":"null"}]},"internationalBeneficiaryName":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","accountName","bankName","internationalBankName","internationalBeneficiaryName","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"bank_accounts_delete","title":"Delete a bank account","description":"Permanently deletes a stored bank account by id. Requires MANAGER. Returns { success }.\n\n(Scope: bank_accounts:write · endpoint: DELETE /api/bank-accounts/{id})","http":{"method":"DELETE","path":"/api/bank-accounts/{id}"},"feature":"bank_accounts","verb":"write","scope":"bank_accounts:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"bank_accounts_directory_list","title":"Find banks and branches","description":"Returns published bank names, branch identifiers and available BICs for a country. Empty lists allow manual entry.\n\n(Scope: bank_accounts:read · endpoint: GET /api/bank-accounts/directory)","http":{"method":"GET","path":"/api/bank-accounts/directory"},"feature":"bank_accounts","verb":"read","scope":"bank_accounts:read","hasBody":false,"inputSchema":{"type":"object","properties":{"country":{"type":"string","pattern":"^[A-Z]{2}$"}},"required":["country"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"banks":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"nameHe":{"type":"string"},"swiftCode":{"type":"string"},"address":{"type":"string"}},"required":["code","name"],"additionalProperties":false}},"branches":{"type":"array","items":{"type":"object","properties":{"bankCode":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"nameHe":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"}},"required":["bankCode","code","name"],"additionalProperties":false}}},"required":["banks","branches"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"bank_accounts_get","title":"Get a bank account","description":"Returns one stored bank account (names, currencies, account and routing identifiers, default flag) by id.\n\n(Scope: bank_accounts:read · endpoint: GET /api/bank-accounts/{id})","http":{"method":"GET","path":"/api/bank-accounts/{id}"},"feature":"bank_accounts","verb":"read","scope":"bank_accounts:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"accountName":{"type":"string"},"bankName":{"type":"string"},"internationalBankName":{"anyOf":[{"type":"string"},{"type":"null"}]},"internationalBeneficiaryName":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","accountName","bankName","internationalBankName","internationalBeneficiaryName","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"bank_accounts_list","title":"List bank accounts","description":"Lists the bank accounts stored on the organization for printing on invoices. Read-only; renders as an interactive widget. Returns { bankAccounts }.\n\n(Scope: bank_accounts:read · endpoint: GET /api/bank-accounts)","http":{"method":"GET","path":"/api/bank-accounts"},"feature":"bank_accounts","verb":"read","scope":"bank_accounts:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"bankAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"accountName":{"type":"string"},"bankName":{"type":"string"},"internationalBankName":{"anyOf":[{"type":"string"},{"type":"null"}]},"internationalBeneficiaryName":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","accountName","bankName","internationalBankName","internationalBeneficiaryName","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false}}},"required":["bankAccounts"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/bank-accounts"},"ui/resourceUri":"ui://guliel/bank-accounts","openai/outputTemplate":"ui://guliel/bank-accounts"}},{"name":"bank_accounts_update","title":"Update a bank account","description":"Changes the supplied fields of a stored bank account (names, currencies, identifiers, default flag, notes); omitted fields are untouched. Returns the updated account.\n\n(Scope: bank_accounts:write · endpoint: PATCH /api/bank-accounts/{id})","http":{"method":"PATCH","path":"/api/bank-accounts/{id}"},"feature":"bank_accounts","verb":"write","scope":"bank_accounts:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"accountName":{"type":"string","minLength":1},"bankName":{"type":"string","minLength":1},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"internationalBankName":{"anyOf":[{"type":"string","maxLength":255,"pattern":"^[^\\p{Cc}\\p{Zl}\\p{Zp}\\p{Bidi_Control}]*$"},{"type":"null"}]},"internationalBeneficiaryName":{"anyOf":[{"type":"string","maxLength":255,"pattern":"^[^\\p{Cc}\\p{Zl}\\p{Zp}\\p{Bidi_Control}]*$"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"accountName":{"type":"string"},"bankName":{"type":"string"},"internationalBankName":{"anyOf":[{"type":"string"},{"type":"null"}]},"internationalBeneficiaryName":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","accountName","bankName","internationalBankName","internationalBeneficiaryName","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_delete_session","title":"Delete a companion chat","description":"Permanently deletes one AI Companion chat session with its messages and run log by id. Returns { success }.\n\n(Scope: companion:write · endpoint: DELETE /api/companion/sessions/{id})","http":{"method":"DELETE","path":"/api/companion/sessions/{id}"},"feature":"companion","verb":"write","scope":"companion:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_read_export","title":"Export a companion chat","description":"Downloads one AI Companion chat session as an exportable transcript file. Read-only.\n\n(Scope: companion:read · endpoint: GET /api/companion/sessions/{id}/export)","http":{"method":"GET","path":"/api/companion/sessions/{id}/export"},"feature":"companion","verb":"read","scope":"companion:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_read_runlog","title":"Get companion run log","description":"Returns the step-by-step run log (tool calls, results, tokens) of one AI Companion session, with paging. Returns { steps, pagination }.\n\n(Scope: companion:read · endpoint: GET /api/companion/sessions/{id}/runlog)","http":{"method":"GET","path":"/api/companion/sessions/{id}/runlog"},"feature":"companion","verb":"read","scope":"companion:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":50,"type":"integer","minimum":1,"maximum":200}},"required":["id","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["TOOL","AGENT","WORKFLOW","TEXT"]},"ref":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{},"output":{"anyOf":[{},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"turnRunId":{"type":"string"}},"required":["id","kind","ref","parentId","order","input","output","status","error","turnRunId"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["steps","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_read_session","title":"Get a companion chat","description":"Returns one AI Companion chat session by id with its messages, steps and the id of any turn still running.\n\n(Scope: companion:read · endpoint: GET /api/companion/sessions/{id})","http":{"method":"GET","path":"/api/companion/sessions/{id}"},"feature":"companion","verb":"read","scope":"companion:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string"},"archived":{"type":"boolean"},"lastActivityAt":{"type":"string"},"createdAt":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","assistant"]},"index":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"attachments":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"number"},"type":{"type":"string"},"storageKey":{"type":"string"}},"required":["name","size","type","storageKey"],"additionalProperties":false}},{"type":"null"}]},"turnRunId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","role","index","text","attachments","turnRunId","createdAt"],"additionalProperties":false}},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["TOOL","AGENT","WORKFLOW","TEXT"]},"ref":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{},"output":{"anyOf":[{},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"turnRunId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","kind","ref","parentId","order","input","output","status","error","turnRunId"],"additionalProperties":false}},"activeTurnRunId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","title","icon","archived","lastActivityAt","createdAt","messages","steps","activeTurnRunId"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_read_sessions","title":"List companion chats","description":"Lists the caller's AI Companion chat sessions for the organization, most recent first. Returns { sessions }.\n\n(Scope: companion:read · endpoint: GET /api/companion/sessions)","http":{"method":"GET","path":"/api/companion/sessions"},"feature":"companion","verb":"read","scope":"companion:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string"},"lastActivityAt":{"type":"string"},"archived":{"type":"boolean"},"live":{"type":"boolean"}},"required":["id","title","icon","lastActivityAt","archived","live"],"additionalProperties":false}}},"required":["sessions"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_read_stream","title":"Stream a companion chat","description":"Streams live events of a running AI Companion session as server-sent events; pass lastEventId to resume. Intended for chat UIs rather than agents.\n\n(Scope: companion:read · endpoint: GET /api/companion/sessions/{id}/stream)","http":{"method":"GET","path":"/api/companion/sessions/{id}/stream"},"feature":"companion","verb":"read","scope":"companion:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"lastEventId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_read_turn","title":"Get a companion turn","description":"Returns the status, steps and token usage of one AI Companion turn by id; afterSeq returns only steps after that sequence number. Read-only.\n\n(Scope: companion:read · endpoint: GET /api/companion/turns/{id})","http":{"method":"GET","path":"/api/companion/turns/{id}"},"feature":"companion","verb":"read","scope":"companion:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"afterSeq":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"turnRunId":{"type":"string"},"sessionId":{"type":"string"},"status":{"type":"string","enum":["RUNNING","SUCCEEDED","FAILED","CANCELLED"]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["TOOL","AGENT","WORKFLOW","TEXT"]},"ref":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{},"output":{"anyOf":[{},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","RUNNING","SUCCEEDED","FAILED","SKIPPED"]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"turnRunId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","kind","ref","parentId","order","input","output","status","error","turnRunId"],"additionalProperties":false}},"tokens":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stepId":{"anyOf":[{"type":"string"},{"type":"null"}]},"delta":{"type":"string"}},"required":["seq","stepId","delta"],"additionalProperties":false}}},"required":["turnRunId","sessionId","status","startedAt","finishedAt","error","steps","tokens"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_write_cancel_turn","title":"Cancel a companion turn","description":"Cancels a running AI Companion turn by id. Work already done by its tool calls is not undone. Returns { id, status }.\n\n(Scope: companion:write · requires CONTRIBUTOR+ · endpoint: POST /api/companion/turns/{id}/cancel)","http":{"method":"POST","path":"/api/companion/turns/{id}/cancel"},"feature":"companion","verb":"write","scope":"companion:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id","status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"companion_write_messages","title":"Send a companion message","description":"Sends a user message (text plus optional attachments) into an existing AI Companion session and starts a turn. The assistant may then call tools on the user's behalf. Returns { turnRunId }.\n\n(Scope: companion:write · requires CONTRIBUTOR+ · endpoint: POST /api/companion/sessions/{id}/messages)","http":{"method":"POST","path":"/api/companion/sessions/{id}/messages"},"feature":"companion","verb":"write","scope":"companion:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"text":{"type":"string","minLength":1},"attachments":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"number"},"type":{"type":"string"},"storageKey":{"type":"string"}},"required":["name","size","type","storageKey"],"additionalProperties":false}}},"required":["id","text"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"turnRunId":{"type":"string"}},"required":["turnRunId"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"companion_write_session","title":"Rename a companion chat","description":"Renames one AI Companion chat session (title). Returns the updated session summary.\n\n(Scope: companion:write · endpoint: PATCH /api/companion/sessions/{id})","http":{"method":"PATCH","path":"/api/companion/sessions/{id}"},"feature":"companion","verb":"write","scope":"companion:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["id","title"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string"},"lastActivityAt":{"type":"string"},"archived":{"type":"boolean"},"live":{"type":"boolean"}},"required":["id","title","icon","lastActivityAt","archived","live"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"companion_write_sessions","title":"Start a companion chat","description":"Creates an AI Companion session with a client-chosen sessionId and its first user message (text, optional title, icon, attachments), then starts the first turn. Returns { sessionId, turnRunId }.\n\n(Scope: companion:write · requires CONTRIBUTOR+ · endpoint: POST /api/companion/sessions)","http":{"method":"POST","path":"/api/companion/sessions"},"feature":"companion","verb":"write","scope":"companion:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"sessionId":{"type":"string","minLength":1},"text":{"type":"string","minLength":1},"title":{"type":"string"},"icon":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"number"},"type":{"type":"string"},"storageKey":{"type":"string"}},"required":["name","size","type","storageKey"],"additionalProperties":false}}},"required":["organizationId","sessionId","text"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"sessionId":{"type":"string"},"turnRunId":{"type":"string"}},"required":["sessionId","turnRunId"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"customers_create","title":"Create a customer","description":"Adds a customer (a business or an individual) to the organization. Inputs: name, optional email, phone, address, country, registration number, default currencies and kind. Returns the customer.\n\n(Scope: customers:write · requires CONTRIBUTOR+ · endpoint: POST /api/customers)","http":{"method":"POST","path":"/api/customers"},"feature":"customers","verb":"write","scope":"customers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},"phone":{"type":"string"},"address":{"type":"string"},"country":{"type":"string","minLength":1},"registrationNumber":{"type":"string"},"defaultCurrencies":{"default":["USD"],"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"kind":{"default":"ORGANIZATION","type":"string","enum":["ORGANIZATION","INDIVIDUAL"]}},"required":["organizationId","name","country","defaultCurrencies","kind"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}],"description":"Which party kind this counterparty edge points at."},"displayName":{"type":"string","description":"Resolved through the consolidation morphism — from the linked Organization or Individual."},"displayAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayRegistrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasDeliverableEmail":{"type":"boolean","description":"Whether this customer can be emailed — a display email OR at least one recipient. Same rule the send route enforces."},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"_count":{"type":"object","properties":{"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","phone","address","country","registrationNumber","defaultCurrencies","preferredDocumentLanguage","organizationId","kind","displayName","displayAddress","displayCountry","displayRegistrationNumber","hasDeliverableEmail","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"customers_delete","title":"Delete a customer","description":"Removes a customer by id. When the same party is also a supplier or an employee, only the customer role is dropped and the record stays. Requires MANAGER. Returns { success }.\n\n(Scope: customers:write · endpoint: DELETE /api/customers/{id})","http":{"method":"DELETE","path":"/api/customers/{id}"},"feature":"customers","verb":"write","scope":"customers:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"customers_get","title":"Get a customer","description":"Returns one customer by id with contact details, registration number, default currencies, status and document counts. Read-only; renders as an interactive widget.\n\n(Scope: customers:read · endpoint: GET /api/customers/{id})","http":{"method":"GET","path":"/api/customers/{id}"},"feature":"customers","verb":"read","scope":"customers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}],"description":"Which party kind this counterparty edge points at."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","ACTIVE","INACTIVE"]},"displayName":{"type":"string"},"displayAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayRegistrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasDeliverableEmail":{"type":"boolean","description":"Whether this customer can be emailed — a display email OR at least one recipient. Same rule the send route enforces."},"_count":{"type":"object","properties":{"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","phone","address","country","registrationNumber","defaultCurrencies","preferredDocumentLanguage","organizationId","kind","notes","status","displayName","displayAddress","displayCountry","displayRegistrationNumber","hasDeliverableEmail","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/customer-detail"},"ui/resourceUri":"ui://guliel/customer-detail","openai/outputTemplate":"ui://guliel/customer-detail"}},{"name":"customers_list","title":"List customers","description":"Lists the organization's customers with paging and search. Filters: search text, kind, inSystem (customers that are Guliel organizations themselves), sortBy/sortOrder. Returns { customers, pagination }.\n\n(Scope: customers:read · endpoint: GET /api/customers)","http":{"method":"GET","path":"/api/customers"},"feature":"customers","verb":"read","scope":"customers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":10,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"},"inSystem":{"anyOf":[{"type":"string","const":"true"},{"type":"string","const":"false"},{"type":"string","const":""}]},"kind":{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},"sortBy":{"default":"createdAt","type":"string","enum":["name","email","createdAt","updatedAt"]},"sortOrder":{"default":"desc","type":"string","enum":["asc","desc"]}},"required":["organizationId","page","limit","search","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}],"description":"Which party kind this counterparty edge points at."},"displayName":{"type":"string","description":"Resolved through the consolidation morphism — from the linked Organization or Individual."},"displayAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayRegistrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasDeliverableEmail":{"type":"boolean","description":"Whether this customer can be emailed — a display email OR at least one recipient. Same rule the send route enforces."},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"_count":{"type":"object","properties":{"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","phone","address","country","registrationNumber","defaultCurrencies","preferredDocumentLanguage","organizationId","kind","displayName","displayAddress","displayCountry","displayRegistrationNumber","hasDeliverableEmail","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["customers","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"customers_recipients_create","title":"Add a customer email recipient","description":"Adds an extra email recipient (email, optional name) to a customer. Documents sent to the customer are copied to every recipient. Returns the recipient.\n\n(Scope: customers:write · endpoint: POST /api/customers/{id}/recipients)","http":{"method":"POST","path":"/api/customers/{id}/recipients"},"feature":"customers","verb":"write","scope":"customers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"type":"string"}},"required":["id","email"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","customerId","email","name","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"customers_recipients_delete","title":"Remove a customer email recipient","description":"Removes one additional email recipient (recipientId) from a customer. The customer itself is untouched. Returns { success }.\n\n(Scope: customers:write · endpoint: DELETE /api/customers/{id}/recipients)","http":{"method":"DELETE","path":"/api/customers/{id}/recipients"},"feature":"customers","verb":"write","scope":"customers:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"recipientId":{"type":"string"}},"required":["id","recipientId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"customers_recipients_list","title":"List customer email recipients","description":"Lists the additional email recipients that receive copies of documents sent to the customer. Returns an array of { id, email, name }.\n\n(Scope: customers:read · endpoint: GET /api/customers/{id}/recipients)","http":{"method":"GET","path":"/api/customers/{id}/recipients"},"feature":"customers","verb":"read","scope":"customers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","customerId","email","name","createdAt","updatedAt"],"additionalProperties":false}},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"customers_replace","title":"Replace a customer","description":"Overwrites the supplied customer fields (name, contact details, registration number, default currencies, notes, status) in one call. Fields that are omitted keep their value. Returns the customer.\n\n(Scope: customers:write · endpoint: PUT /api/customers/{id})","http":{"method":"PUT","path":"/api/customers/{id}"},"feature":"customers","verb":"write","scope":"customers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"email":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string","minLength":1},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","ACTIVE","INACTIVE"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}],"description":"Which party kind this counterparty edge points at."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","ACTIVE","INACTIVE"]},"displayName":{"type":"string"},"displayAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayRegistrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasDeliverableEmail":{"type":"boolean","description":"Whether this customer can be emailed — a display email OR at least one recipient. Same rule the send route enforces."},"_count":{"type":"object","properties":{"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","phone","address","country","registrationNumber","defaultCurrencies","preferredDocumentLanguage","organizationId","kind","notes","status","displayName","displayAddress","displayCountry","displayRegistrationNumber","hasDeliverableEmail","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"customers_update","title":"Update a customer","description":"Edits the supplied customer fields (name, contact details, registration number, default currencies, notes, status); omitted fields keep their value. Returns the customer.\n\n(Scope: customers:write · endpoint: PATCH /api/customers/{id})","http":{"method":"PATCH","path":"/api/customers/{id}"},"feature":"customers","verb":"write","scope":"customers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"email":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string","minLength":1},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","ACTIVE","INACTIVE"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}],"description":"Which party kind this counterparty edge points at."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","ACTIVE","INACTIVE"]},"displayName":{"type":"string"},"displayAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayRegistrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasDeliverableEmail":{"type":"boolean","description":"Whether this customer can be emailed — a display email OR at least one recipient. Same rule the send route enforces."},"_count":{"type":"object","properties":{"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","phone","address","country","registrationNumber","defaultCurrencies","preferredDocumentLanguage","organizationId","kind","notes","status","displayName","displayAddress","displayCountry","displayRegistrationNumber","hasDeliverableEmail","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"dashboard_get","title":"Get dashboard summary","description":"Returns the organization's financial dashboard for a year or a from/to range: revenue, outstanding and pending amounts, expenses, net and margin, growth, cash flow by month, top customers and vendors, and low-stock counts. Read-only; renders as an interactive widget.\n\n(Scope: invoices:read · endpoint: GET /api/dashboard)","http":{"method":"GET","path":"/api/dashboard"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"year":{"type":"integer","minimum":2000,"maximum":2100},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"totalInvoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalRevenue":{"type":"number"},"outstandingAmount":{"type":"number"},"pendingAmount":{"type":"number"},"invoicesByStatus":{"type":"object","properties":{"draft":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unsent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["draft","unsent","sent","paid"],"additionalProperties":false,"description":"Per-status counts of the org's invoices for the requested year."},"revenueByMonth":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"revenue":{"type":"number"},"sent":{"type":"number"},"unsent":{"type":"number"},"draft":{"type":"number"}},"required":["month","revenue","sent","unsent","draft"],"additionalProperties":false}},"revenueByCustomer":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"revenue":{"type":"number"},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["name","revenue","count"],"additionalProperties":false},"description":"Top customers by revenue, sorted descending. Currency-converted to `displayCurrency`. `count` is that client's own number of PAID invoices."},"growth":{"type":"number","description":"YoY revenue growth percentage."},"displayCurrency":{"type":"string","description":"Currency that all monetary fields are converted to (the organization's primary currency)."},"exchangeRateDate":{"type":"string","description":"Date of the FX-rate snapshot used for conversions."},"pendingPaymentsList":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"description":"Open invoices awaiting payment, sorted by due date."},"expenseTotal":{"type":"number"},"expensesByMonth":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"expensesByVendor":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"expensesByEmployee":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"amount":{"type":"number"}},"required":["name","amount"],"additionalProperties":false},"description":"Employer payroll cost per employee (Σ EARNING + Σ EMPR_CONTRIBUTION over APPROVED+PAID payslips), converted to displayCurrency, sorted descending. A distinct party edge from vendors — PAYROLL_PLAN.md rule 8b. Σ(expensesByVendor) + Σ(expensesByEmployee) = approved expense total. Payroll-sensitive (HR ARCHITECTURE law 33c): without scope `payroll:read` AND role MANAGER this collapses to a single aggregate `Payroll (n employees)` row of the same total."},"paidInvoicesCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approvedExpensesCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"expenseGrowth":{"type":"number"},"netTotal":{"type":"number","description":"Revenue minus expenses, in displayCurrency."},"netGrowth":{"type":"number"},"marginPercent":{"type":"number"},"pendingExpensesTotal":{"type":"number"},"pendingExpensesCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pendingExpensesGrowth":{"type":"number"},"cashFlowByMonth":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"lowStockItemsCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeItemsCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"fxIncomplete":{"description":"True when one or more source currencies could not be converted to `displayCurrency` (missing FX rate). Those amounts were summed at face value — totals are approximate. Surfaced in ALL environments (data quality, not a diagnostic).","type":"boolean"},"fxMissingCurrencies":{"description":"Source currencies that lacked a usable rate to `displayCurrency`. Present (and non-empty) iff `fxIncomplete` is true.","type":"array","items":{"type":"string"}}},"required":["totalInvoices","totalRevenue","outstandingAmount","pendingAmount","invoicesByStatus","revenueByMonth","revenueByCustomer","growth","displayCurrency","exchangeRateDate","pendingPaymentsList","expenseTotal","expensesByMonth","expensesByVendor","expensesByEmployee","paidInvoicesCount","approvedExpensesCount","expenseGrowth","netTotal","netGrowth","marginPercent","pendingExpensesTotal","pendingExpensesCount","pendingExpensesGrowth","cashFlowByMonth","lowStockItemsCount","activeItemsCount"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/dashboard"},"ui/resourceUri":"ui://guliel/dashboard","openai/outputTemplate":"ui://guliel/dashboard"}},{"name":"expense_categories_create","title":"Create an expense category","description":"Creates an expense category (name, optional color) for classifying expenses. Returns the category.\n\n(Scope: expenses:write · requires CONTRIBUTOR+ · endpoint: POST /api/expense-categories)","http":{"method":"POST","path":"/api/expense-categories"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"color":{"type":"string"}},"required":["organizationId","name"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"isFallback":{"type":"boolean"},"_count":{"type":"object","properties":{"expenses":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["expenses"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","color","isDefault","isFallback","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"expense_categories_delete","title":"Delete an expense category","description":"Deletes an expense category by id; expenses that used it move to the organization's fallback category. The default and fallback categories cannot be deleted. Requires MANAGER. Returns { success }.\n\n(Scope: expenses:write · endpoint: DELETE /api/expense-categories/{id})","http":{"method":"DELETE","path":"/api/expense-categories/{id}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"expense_categories_list","title":"List expense categories","description":"Lists the organization's expense categories with their colors and default/fallback flags. Returns { categories }.\n\n(Scope: expenses:read · endpoint: GET /api/expense-categories)","http":{"method":"GET","path":"/api/expense-categories"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"isFallback":{"type":"boolean"},"_count":{"type":"object","properties":{"expenses":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["expenses"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","color","isDefault","isFallback","createdAt","updatedAt"],"additionalProperties":false}}},"required":["categories"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expense_categories_replace","title":"Replace an expense category","description":"Overwrites an expense category's name and color by id. Returns the category.\n\n(Scope: expenses:write · endpoint: PUT /api/expense-categories/{id})","http":{"method":"PUT","path":"/api/expense-categories/{id}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"isFallback":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","color","isDefault","isFallback","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"expense_categories_update","title":"Update an expense category","description":"Edits an expense category's name and/or color by id. Returns the category.\n\n(Scope: expenses:write · endpoint: PATCH /api/expense-categories/{id})","http":{"method":"PATCH","path":"/api/expense-categories/{id}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"isFallback":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","color","isDefault","isFallback","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_attachments_get","title":"Download an expense attachment","description":"Streams the original file (receipt, invoice scan or PDF) attached to an expense, by attachment id. Returns the file, not JSON.\n\n(Scope: expenses:read · endpoint: GET /api/expenses/attachments/{id})","http":{"method":"GET","path":"/api/expenses/attachments/{id}"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_create","title":"Create an expense","description":"Records an incoming document (expense). Inputs: amount, currency, date, plus optional vendor, title, category, tax amount/rate, payment method, recognition period, document type and number, attachments, and employee-paid details. Returns the created expense.\n\n(Scope: expenses:write · requires CONTRIBUTOR+ · endpoint: POST /api/expenses)","http":{"method":"POST","path":"/api/expenses"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"title":{"type":"string"},"vendor":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0},"currency":{"type":"string","minLength":1},"date":{"type":"string","minLength":1},"categoryId":{"type":"string"},"notes":{"type":"string"},"attachments":{"description":"Up to five PDF/image attachments (base64 or public URL). Any file/download failure aborts the entire expense creation.","maxItems":5,"type":"array","items":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false}},"taxAmount":{"type":"number"},"taxRate":{"type":"number"},"paymentMethod":{"type":"string"},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"default":"MANUAL","type":"string","enum":["MANUAL","SCAN","EMAIL"]},"documentType":{"default":"INVOICE","type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"customerIds":{"type":"array","items":{"type":"string"}},"employeeCounterpartyId":{"description":"Attribute this expense to an employee (a Counterparty id, isEmployee).","anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"description":"The employee fronted the money, so it is owed to THEM, not the vendor. Requires `employeeCounterpartyId`.","type":"boolean"},"benefitType":{"description":"Benefit-in-kind class; must be one of the country's benefit catalogue values.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organizationId","amount","currency","date","source","documentType"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number"},"subtotal":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string"},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAmount":{"type":"number"},"openBalance":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"source":{"type":"string"},"status":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountingTreatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"obligationState":{"type":"string","enum":["OPEN","PARTIALLY_FULFILLED","FULFILLED","NOT_APPLICABLE"]},"fulfilledAmount":{"type":"number"},"identifiers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"evidenceLinks":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"lineItems":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"fileName":{"type":"string"},"fileType":{"type":"string"},"fileSize":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"evidenceKind":{"type":"string","enum":["SUPPORTING","OFFICIAL_DOCUMENT","INLINE_OFFICIAL_CONTENT"]},"scanStatus":{"anyOf":[{"type":"string","enum":["PENDING","COMPLETED","FAILED"]},{"type":"null"}]},"scanError":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","documentId","fileName","fileType","fileSize","evidenceKind"],"additionalProperties":false}},"customers":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["customerId","customer"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimKind":{"type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]},"employee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","description","amount","subtotal","currency","date","category","vendor","paymentMethod","recognitionStart","recognitionEnd","paidAmount","openBalance","payments","source","status","documentType","officialDocumentNumber","accountingTreatment","obligationState","fulfilledAmount","identifiers","evidenceLinks","lineItems","createdBy","employeeCounterpartyId","paidByEmployee","benefitType","claimKind","employee","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"expenses_csv_list","title":"Export expenses as CSV","description":"Downloads the organization's expenses as a CSV file. Accepts the same filters as the list tool (status, source, category, treatment, date range, employee, claims). Returns a CSV file, not JSON.\n\n(Scope: expenses:read · endpoint: GET /api/expenses/export/csv)","http":{"method":"GET","path":"/api/expenses/export/csv"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"status":{"type":"string"},"source":{"type":"string"},"categoryId":{"type":"string"},"treatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"dateFrom":{"type":"string"},"dateTo":{"type":"string"},"employeeCounterpartyId":{"type":"string"},"claims":{"type":"string","enum":["true","false"]},"claimKind":{"type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]}},"required":["organizationId"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_customers_create","title":"Link customers to an expense","description":"Links one or more customers (customerIds) to an expense, for re-billing or job costing. Returns the updated links.\n\n(Scope: expenses:write · endpoint: POST /api/expenses/{id}/customers)","http":{"method":"POST","path":"/api/expenses/{id}/customers"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"customerIds":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}}},"required":["id","customerIds"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated expense with its full `customers` relation. See /api/expenses/[id] GET for the canonical shape."},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"expenses_customers_delete","title":"Unlink a customer from an expense","description":"Removes the link between an expense and one customer (customerId). Neither record is deleted. Returns { success }.\n\n(Scope: expenses:write · endpoint: DELETE /api/expenses/{id}/customers)","http":{"method":"DELETE","path":"/api/expenses/{id}/customers"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string","minLength":1}},"required":["id","customerId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_delete","title":"Delete an expense","description":"Permanently deletes an expense (an incoming document) and its attachments by id. Rejected when the expense is booked into a locked period. Requires MANAGER. Returns { success }.\n\n(Scope: expenses:write · endpoint: DELETE /api/expenses/{id})","http":{"method":"DELETE","path":"/api/expenses/{id}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_email_poll_create","title":"Fetch receipts from an inbox","description":"Reads the connected mailbox (connectionId), optionally between dateFrom and dateTo, and creates expenses from the receipts and invoices it finds. Contacts the external mail provider and sends attachments to the AI scanner. Returns { runId, status }.\n\n(Scope: expenses:write · requires CONTRIBUTOR+ · endpoint: POST /api/expenses/email-poll)","http":{"method":"POST","path":"/api/expenses/email-poll"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"connectionId":{"type":"string","minLength":1},"dateFrom":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"dateTo":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["organizationId","connectionId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"runId":{"type":"string","description":"IngestionRun id — poll /api/expenses/fetch-logs to track it."},"status":{"type":"string","enum":["PENDING"],"description":"Always PENDING — queued for the worker; never executes in this request."}},"required":["runId","status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"expenses_get","title":"Get an expense","description":"Returns one expense by id with vendor, amounts, tax, payments, open balance, category, line items, attachments, linked customers and the linked purchase order. Read-only.\n\n(Scope: expenses:read · endpoint: GET /api/expenses/{id})","http":{"method":"GET","path":"/api/expenses/{id}"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number"},"subtotal":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountingTreatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"obligationState":{"type":"string","enum":["OPEN","PARTIALLY_FULFILLED","FULFILLED","NOT_APPLICABLE"]},"fulfilledAmount":{"type":"number"},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAmount":{"type":"number"},"openBalance":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"emailMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","color"],"additionalProperties":false},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"evidenceLinks":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"lineItems":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"customers":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["customerId","customer"],"additionalProperties":false}},"attachments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimKind":{"type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]},"employee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"},"subtotal":{"type":"number"},"currency":{"type":"string"},"orderDate":{"type":"string"},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","supplierOrganization"],"additionalProperties":false},{"type":"null"}]}},"required":["id","orderNumber","status","subtotal","currency","orderDate","supplier"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","title","description","vendor","amount","subtotal","currency","date","status","documentType","officialDocumentNumber","accountingTreatment","obligationState","fulfilledAmount","paymentMethod","paidAmount","openBalance","payments","taxAmount","taxRate","recognitionStart","recognitionEnd","notes","source","emailMessageId","category","identifiers","evidenceLinks","lineItems","customers","attachments","createdBy","employeeCounterpartyId","paidByEmployee","benefitType","claimKind","employee","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_links_update","title":"Review an expense link","description":"Confirms or rejects a suggested link (linkId) between an expense and another document by setting its status; optionally set the allocatedAmount. Returns the link.\n\n(Scope: expenses:write · endpoint: PATCH /api/expenses/{id}/links/{linkId})","http":{"method":"PATCH","path":"/api/expenses/{id}/links/{linkId}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"linkId":{"type":"string"},"status":{"type":"string","enum":["CONFIRMED","REJECTED"]},"allocatedAmount":{"type":"number","exclusiveMinimum":0}},"required":["id","linkId","status"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_list","title":"List expenses","description":"List an organization's expenses (incoming documents), newest first. Returns ONE page — default 25 rows, max 100 via `limit` — and renders as an interactive widget that pages in place. Fetch a single page and let the user page within the widget; do not call this repeatedly to walk every page unless they explicitly ask to export or total the entire list.","http":{"method":"GET","path":"/api/expenses"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":25,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"},"categoryId":{"type":"string"},"status":{"type":"string"},"source":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"treatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"dateFrom":{"type":"string"},"dateTo":{"type":"string"},"minAmount":{"type":"string"},"maxAmount":{"type":"string"},"customerId":{"type":"string"},"employeeCounterpartyId":{"description":"Only expenses attributed to this employee (a Counterparty id).","type":"string"},"claims":{"description":"`true` ⇒ only expenses attributed to some employee.","type":"string","enum":["true","false"]},"claimKind":{"description":"The attribution quadrant, deduced from (paid out of pocket, benefit class): NONE / REIMBURSEMENT / BENEFIT / TAXABLE_REIMBURSEMENT.","type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]},"sortBy":{"default":"date","type":"string","enum":["date","amount","vendor","createdAt"]},"sortOrder":{"default":"desc","type":"string","enum":["asc","desc"]}},"required":["organizationId","page","limit","search","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"expenses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number"},"subtotal":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string"},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAmount":{"type":"number"},"openBalance":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"source":{"type":"string"},"status":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountingTreatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"obligationState":{"type":"string","enum":["OPEN","PARTIALLY_FULFILLED","FULFILLED","NOT_APPLICABLE"]},"fulfilledAmount":{"type":"number"},"identifiers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"evidenceLinks":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"lineItems":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"fileName":{"type":"string"},"fileType":{"type":"string"},"fileSize":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"evidenceKind":{"type":"string","enum":["SUPPORTING","OFFICIAL_DOCUMENT","INLINE_OFFICIAL_CONTENT"]},"scanStatus":{"anyOf":[{"type":"string","enum":["PENDING","COMPLETED","FAILED"]},{"type":"null"}]},"scanError":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","documentId","fileName","fileType","fileSize","evidenceKind"],"additionalProperties":false}},"customers":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["customerId","customer"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimKind":{"type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]},"employee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","description","amount","subtotal","currency","date","category","vendor","paymentMethod","recognitionStart","recognitionEnd","paidAmount","openBalance","payments","source","status","documentType","officialDocumentNumber","accountingTreatment","obligationState","fulfilledAmount","identifiers","evidenceLinks","lineItems","createdBy","employeeCounterpartyId","paidByEmployee","benefitType","claimKind","employee","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["expenses","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/expenses-list"},"ui/resourceUri":"ui://guliel/expenses-list","openai/outputTemplate":"ui://guliel/expenses-list"}},{"name":"expenses_manifest_list","title":"Get expense export manifest","description":"Returns the manifest used to build an expense archive: organization, generation time and each expense's metadata and files. Filters: ids, status, source, category, treatment, date range. Read-only.\n\n(Scope: expenses:read · endpoint: GET /api/expenses/export/manifest)","http":{"method":"GET","path":"/api/expenses/export/manifest"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"ids":{"type":"string"},"status":{"type":"string"},"source":{"type":"string"},"categoryId":{"type":"string"},"treatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"dateFrom":{"type":"string"},"dateTo":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"generatedAt":{"type":"string"},"expenses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string"},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"string","description":"Decimal serialized as string to avoid float drift."},"currency":{"type":"string"},"taxAmount":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"source":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"fileName":{"type":"string"},"fileType":{"anyOf":[{"type":"string"},{"type":"null"}]},"fileSize":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","fileName","fileType","fileSize"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["id","date","vendor","title","category","amount","currency","taxAmount","taxRate","paymentMethod","status"],"additionalProperties":false}}},"required":["organization","generatedAt","expenses"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_match_review_create","title":"Run expense matching","description":"Runs the matcher over a batch of incoming documents (limit per call, cursor to continue) and writes suggested links to purchase orders and payments. Requires MANAGER. Returns counts and nextCursor; call again until done is true.\n\n(Scope: expenses:write · requires MANAGER+ · endpoint: POST /api/expenses/match-review)","http":{"method":"POST","path":"/api/expenses/match-review"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"cursor":{"type":"string","maxLength":2000},"limit":{"default":10,"type":"integer","minimum":1,"maximum":20}},"required":["organizationId","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"forcedMode":{"type":"string","const":"suggest"},"processed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"succeeded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"candidateCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"linksWritten":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"done":{"type":"boolean"}},"required":["forcedMode","processed","succeeded","failed","candidateCount","linksWritten","nextCursor","done"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"expenses_match_review_list","title":"List expense match suggestions","description":"Lists the matcher's suggested links between incoming documents and purchase orders or payments, with scores and blockers, for human review. Requires MANAGER. Returns { suggestions, pagination, summary }.\n\n(Scope: expenses:read · requires MANAGER+ · endpoint: GET /api/expenses/match-review)","http":{"method":"GET","path":"/api/expenses/match-review"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":25,"type":"integer","minimum":1,"maximum":50}},"required":["organizationId","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"runtimeMode":{"type":"string","enum":["report","suggest","auto"]},"suggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["FULFILLS","EVIDENCES_PAYMENT","SUMMARIZES"]},"status":{"type":"string","const":"SUGGESTED"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}]},"method":{"type":"string","enum":["EXACT_REFERENCE","SCORING"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"evidence":{"type":"object","properties":{"score":{"anyOf":[{"type":"number"},{"type":"null"}]},"runnerUpScore":{"anyOf":[{"type":"number"},{"type":"null"}]},"margin":{"anyOf":[{"type":"number"},{"type":"null"}]},"exactReference":{"type":"boolean"},"signals":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"points":{"type":"number"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["name","points","detail"],"additionalProperties":false}},"blockers":{"type":"array","items":{"type":"string"}}},"required":["score","runnerUpScore","margin","exactReference","signals","blockers"],"additionalProperties":false},"fromDocument":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string"},"issueDate":{"type":"string"}},"required":["id","title","vendor","documentType","total","currency","issueDate"],"additionalProperties":false},"toDocument":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string"},"issueDate":{"type":"string"}},"required":["id","title","vendor","documentType","total","currency","issueDate"],"additionalProperties":false}},"required":["id","type","status","confidence","method","createdAt","updatedAt","evidence","fromDocument","toDocument"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false},"summary":{"type":"object","properties":{"pending":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"confirmed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rejected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reviewed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"acceptanceRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"automaticConfirmed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"byRelation":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["FULFILLS","EVIDENCES_PAYMENT","SUMMARIZES"]},"pending":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"confirmed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rejected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reviewed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"acceptanceRate":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["type","pending","confirmed","rejected","reviewed","acceptanceRate"],"additionalProperties":false}}},"required":["pending","confirmed","rejected","reviewed","acceptanceRate","automaticConfirmed","byRelation"],"additionalProperties":false}},"required":["runtimeMode","suggestions","pagination","summary"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_payments_create","title":"Record an expense payment","description":"Records that an expense was paid: amount, paidAt date and optional method. It only updates the books; no money is moved. Set allowUnallocated to accept a payment larger than the open balance. Returns the payment and updated balance.\n\n(Scope: expenses:write · requires CONTRIBUTOR+ · endpoint: POST /api/expenses/{id}/payments)","http":{"method":"POST","path":"/api/expenses/{id}/payments"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"allowUnallocated":{"type":"boolean"}},"required":["id","amount","paidAt"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated expense row after settlement."},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"expenses_replace","title":"Replace an expense","description":"Overwrites the supplied expense fields (vendor, amount, currency, date, category, tax, document type and number, notes, employee-paid details) in one call. Omitted fields keep their value. Returns the expense.\n\n(Scope: expenses:write · endpoint: PUT /api/expenses/{id})","http":{"method":"PUT","path":"/api/expenses/{id}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number","exclusiveMinimum":0},"currency":{"type":"string","minLength":1},"date":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"categoryId":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number"},"subtotal":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountingTreatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"obligationState":{"type":"string","enum":["OPEN","PARTIALLY_FULFILLED","FULFILLED","NOT_APPLICABLE"]},"fulfilledAmount":{"type":"number"},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAmount":{"type":"number"},"openBalance":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"emailMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","color"],"additionalProperties":false},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"evidenceLinks":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"lineItems":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"customers":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["customerId","customer"],"additionalProperties":false}},"attachments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimKind":{"type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]},"employee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"},"subtotal":{"type":"number"},"currency":{"type":"string"},"orderDate":{"type":"string"},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","supplierOrganization"],"additionalProperties":false},{"type":"null"}]}},"required":["id","orderNumber","status","subtotal","currency","orderDate","supplier"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","title","description","vendor","amount","subtotal","currency","date","status","documentType","officialDocumentNumber","accountingTreatment","obligationState","fulfilledAmount","paymentMethod","paidAmount","openBalance","payments","taxAmount","taxRate","recognitionStart","recognitionEnd","notes","source","emailMessageId","category","identifiers","evidenceLinks","lineItems","customers","attachments","createdBy","employeeCounterpartyId","paidByEmployee","benefitType","claimKind","employee","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_scan_create","title":"Scan an expense document","description":"Runs AI extraction on an uploaded attachment (attachmentId) and creates or updates the expense with vendor, amounts, tax, date and line items, matching it to a vendor and purchase order when possible. Sends the file to the configured scan provider. Returns the expense id and the extracted data.\n\n(Scope: expenses:write · endpoint: POST /api/expenses/scan)","http":{"method":"POST","path":"/api/expenses/scan"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"attachmentId":{"type":"string","minLength":1}},"required":["attachmentId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"expenseId":{"type":"string","description":"Id of the scanned expense document."},"mergedIntoOrder":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"orderNumber":{"type":"string"}},"required":["id","orderNumber"],"additionalProperties":false},{"type":"null"}],"description":"When the scan matched an open purchase order, the order it was linked to — the scanned document joins that order's document chain."},"orderTransition":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"extractedData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Raw OCR / AI extraction output (vendor, line items, totals, etc.). Empty object when the scan failed."},"vendorMatch":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"providerId":{"type":"string"},"scanStatus":{"type":"string","enum":["COMPLETED","FAILED"],"description":"Whether the scan produced usable data and fields were applied (COMPLETED) or not (FAILED — empty/unreadable result, unsupported type, provider error, or duplicate)."},"scanError":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Human-readable reason when scanStatus is FAILED; null on success."},"duplicateOfId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When the scan was rejected as a duplicate (same org + externalDocId + vendor), the id of the existing document it duplicates; null otherwise."},"matching":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["expenseId","mergedIntoOrder","extractedData","providerId","scanStatus","scanError","duplicateOfId"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"expenses_status_update","title":"Set an expense status","description":"Moves an expense to DRAFT, PENDING_REVIEW, APPROVED or REJECTED, with an optional reason. Approving needs an official document number and source evidence; approving or rejecting out of PENDING_REVIEW requires MANAGER. Returns the updated expense.\n\n(Scope: expenses:write · endpoint: PATCH /api/expenses/{id}/status)","http":{"method":"PATCH","path":"/api/expenses/{id}/status"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["DRAFT","PENDING_REVIEW","APPROVED","REJECTED"]},"reason":{"type":"string"}},"required":["id","status"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated expense row with category/customers/attachments joined. See /api/expenses/[id] GET for the canonical shape."},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_update","title":"Update an expense","description":"Edits the supplied expense fields (vendor, amount, currency, date, category, tax, document type and number, notes, employee-paid details); omitted fields keep their value. Returns the expense.\n\n(Scope: expenses:write · endpoint: PATCH /api/expenses/{id})","http":{"method":"PATCH","path":"/api/expenses/{id}"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number","exclusiveMinimum":0},"currency":{"type":"string","minLength":1},"date":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"categoryId":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"number"},"subtotal":{"type":"number"},"currency":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"officialDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountingTreatment":{"type":"string","enum":["BOOKABLE","OBLIGATION","PAYMENT_EVIDENCE","AGGREGATE"]},"obligationState":{"type":"string","enum":["OPEN","PARTIALLY_FULFILLED","FULFILLED","NOT_APPLICABLE"]},"fulfilledAmount":{"type":"number"},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAmount":{"type":"number"},"openBalance":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"emailMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","color"],"additionalProperties":false},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"evidenceLinks":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"lineItems":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"customers":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["customerId","customer"],"additionalProperties":false}},"attachments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"employeeCounterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidByEmployee":{"type":"boolean"},"benefitType":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimKind":{"type":"string","enum":["NONE","REIMBURSEMENT","BENEFIT","TAXABLE_REIMBURSEMENT"]},"employee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"},"subtotal":{"type":"number"},"currency":{"type":"string"},"orderDate":{"type":"string"},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","supplierOrganization"],"additionalProperties":false},{"type":"null"}]}},"required":["id","orderNumber","status","subtotal","currency","orderDate","supplier"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","title","description","vendor","amount","subtotal","currency","date","status","documentType","officialDocumentNumber","accountingTreatment","obligationState","fulfilledAmount","paymentMethod","paidAmount","openBalance","payments","taxAmount","taxRate","recognitionStart","recognitionEnd","notes","source","emailMessageId","category","identifiers","evidenceLinks","lineItems","customers","attachments","createdBy","employeeCounterpartyId","paidByEmployee","benefitType","claimKind","employee","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"expenses_upload_create","title":"Upload an expense attachment","description":"Uploads a file to an expense (expenseId) or as a new unattached upload. Returns the attachment id, which can be passed to expenses_scan_create.\n\n(Scope: expenses:write · requires CONTRIBUTOR+ · endpoint: POST /api/expenses/upload)","http":{"method":"POST","path":"/api/expenses/upload"},"feature":"expenses","verb":"write","scope":"expenses:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"expenseId":{"type":"string","minLength":1},"file":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false}},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"expenseId":{"type":"string"},"fileName":{"type":"string"},"fileType":{"anyOf":[{"type":"string"},{"type":"null"}]},"fileSize":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","expenseId","fileName","fileType","fileSize"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"expenses_usage_list","title":"Get expense scan usage","description":"Returns how many AI expense scans the organization has used in the current period and its plan limit. Returns { used, limit, period }.\n\n(Scope: expenses:read · endpoint: GET /api/expenses/usage)","http":{"method":"GET","path":"/api/expenses/usage"},"feature":"expenses","verb":"read","scope":"expenses:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Scans consumed in the current billing period."},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Allowed scans for the org's plan."},"period":{"type":"string","description":"Billing period the counters cover, e.g. \"2026-05\"."}},"required":["used","limit","period"],"additionalProperties":false,"description":"Snapshot of the org's monthly OCR/scan quota usage."},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employee_events_create","title":"Add an employee note","description":"Adds a note to an employee's timeline (counterpartyId plus note body). Visible to managers only. Requires MANAGER. Returns the new note id.\n\n(Scope: hr:write · requires MANAGER+ · endpoint: POST /api/hr/employee-events)","http":{"method":"POST","path":"/api/hr/employee-events"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"body":{"type":"string","minLength":1,"maxLength":4000}},"required":["organizationId","counterpartyId","body"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"hr_employee_events_delete","title":"Delete an employee note","description":"Deletes one employee timeline note by id. Requires MANAGER. Returns { success }.\n\n(Scope: hr:write · requires MANAGER+ · endpoint: DELETE /api/hr/employee-events)","http":{"method":"DELETE","path":"/api/hr/employee-events"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employee_events_list","title":"List employee notes","description":"Lists timeline notes for one employee (counterpartyId), newest first, with a cursor for paging. Requires MANAGER. Returns { notes, nextCursor }.\n\n(Scope: hr:read · requires MANAGER+ · endpoint: GET /api/hr/employee-events)","http":{"method":"GET","path":"/api/hr/employee-events"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"cursor":{"description":"The id of the last row of the previous page.","type":"string"},"limit":{"type":"integer","minimum":1,"maximum":100}},"required":["organizationId","counterpartyId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":"string"},"body":{"type":"string"},"actorUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"actorName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","createdAt","body","actorUserId","actorName"],"additionalProperties":false}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["notes","nextCursor"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employees_create","title":"Create an employee","description":"Creates an employee record with a first employment term. Inputs: name plus optional email, date of birth, employee code, national ID, probation end, job title, pay basis, start date, rate and currency. Stores HR data only; does not run payroll. Returns the employee (national ID masked).\n\n(Scope: hr:write · requires CONTRIBUTOR+ · endpoint: POST /api/employees)","http":{"method":"POST","path":"/api/employees"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employeeCode":{"type":"string","maxLength":64},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}]},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}]},"nationalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only — the account salary is credited to; null clears it (law 37a).","anyOf":[{"type":"object","properties":{"bankName":{"type":"string","minLength":1,"maxLength":80},"accountNumber":{"type":"string","pattern":"^[\\d\\s-]{4,34}$"}},"required":["bankName","accountNumber"],"additionalProperties":false},{"type":"null"}]},"title":{"description":"Job title of the first position.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"basis":{"description":"Pay basis; defaults to MONTHLY.","type":"string","enum":["MONTHLY","HOURLY"]},"startDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}]},"rate":{"description":"Monthly wage, or hourly wage when `basis` is HOURLY.","anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string"},"employmentData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["organizationId","name"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string","description":"The Counterparty id — an employee is a Counterparty edge."},"individualId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employmentStart":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"First day of the earliest employment term."},"employmentEnd":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The LAST EMPLOYED DAY; null while any term is open (law 2b)."},"active":{"type":"boolean","description":"Some employment term covers today."},"currentTerm":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData"],"additionalProperties":false},{"type":"null"}],"description":"The open term, else the most recent closed one."},"employeeCode":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"This tenant's employee number — unique per org, never reassigned (law 30)."},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}],"description":"Statutory eligibility input; MANAGER write, member read."},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Probation end (exclusive)."},"inProbation":{"type":"boolean","description":"Fold: employmentStart ≤ today < probationEndsOn."},"maskedNationalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The DEFAULT projection of the national identifier (law 32) — the mask, on every surface including lists, exports, MCP and the admin panel."},"nationalId":{"type":"string"},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only; accountNumber only with ?reveal=true (law 37b). Key absent below MANAGER.","anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits."},"accountNumber":{"type":"string"}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"photoAssetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"selfServiceActive":{"type":"boolean"}},"required":["id","individualId","name","email","dateOfBirth","employmentStart","employmentEnd","active","currentTerm","employeeCode","gender","probationEndsOn","inProbation","maskedNationalId","photoAssetId","selfServiceActive"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"hr_employees_delete","title":"End employment or purge an employee","description":"Ends the employee's employment by closing the open term on lastDay (default today); the record and its payroll history stay. With purge=true it instead destroys the record: requires MANAGER, only for an employee who already has a last day, and refused when ledger history exists. Returns the employee.\n\n(Scope: hr:write · endpoint: DELETE /api/employees/{id})","http":{"method":"DELETE","path":"/api/employees/{id}"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"lastDay":{"type":"string"},"purge":{"description":"MANAGER only — permanently delete a deactivated employee with no ledger history.","type":"string","enum":["true","false"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string","description":"The Counterparty id — an employee is a Counterparty edge."},"individualId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employmentStart":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"First day of the earliest employment term."},"employmentEnd":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The LAST EMPLOYED DAY; null while any term is open (law 2b)."},"active":{"type":"boolean","description":"Some employment term covers today."},"currentTerm":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData"],"additionalProperties":false},{"type":"null"}],"description":"The open term, else the most recent closed one."},"employeeCode":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"This tenant's employee number — unique per org, never reassigned (law 30)."},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}],"description":"Statutory eligibility input; MANAGER write, member read."},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Probation end (exclusive)."},"inProbation":{"type":"boolean","description":"Fold: employmentStart ≤ today < probationEndsOn."},"maskedNationalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The DEFAULT projection of the national identifier (law 32) — the mask, on every surface including lists, exports, MCP and the admin panel."},"nationalId":{"type":"string"},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only; accountNumber only with ?reveal=true (law 37b). Key absent below MANAGER.","anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits."},"accountNumber":{"type":"string"}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"photoAssetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"selfServiceActive":{"type":"boolean"}},"required":["id","individualId","name","email","dateOfBirth","employmentStart","employmentEnd","active","currentTerm","employeeCode","gender","probationEndsOn","inProbation","maskedNationalId","photoAssetId","selfServiceActive"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employees_get","title":"Get an employee","description":"Returns one employee by id: contact details, current employment term, employment dates, probation state and masked national ID. Set reveal=true to include the full national ID, which is access-logged.\n\n(Scope: hr:read · endpoint: GET /api/employees/{id})","http":{"method":"GET","path":"/api/employees/{id}"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"reveal":{"description":"MANAGER only — return the unmasked national identifier (law 32) and the salary account number (law 37b).","type":"string","enum":["true","false"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string","description":"The Counterparty id — an employee is a Counterparty edge."},"individualId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employmentStart":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"First day of the earliest employment term."},"employmentEnd":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The LAST EMPLOYED DAY; null while any term is open (law 2b)."},"active":{"type":"boolean","description":"Some employment term covers today."},"currentTerm":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData"],"additionalProperties":false},{"type":"null"}],"description":"The open term, else the most recent closed one."},"employeeCode":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"This tenant's employee number — unique per org, never reassigned (law 30)."},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}],"description":"Statutory eligibility input; MANAGER write, member read."},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Probation end (exclusive)."},"inProbation":{"type":"boolean","description":"Fold: employmentStart ≤ today < probationEndsOn."},"maskedNationalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The DEFAULT projection of the national identifier (law 32) — the mask, on every surface including lists, exports, MCP and the admin panel."},"nationalId":{"type":"string"},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only; accountNumber only with ?reveal=true (law 37b). Key absent below MANAGER.","anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits."},"accountNumber":{"type":"string"}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"photoAssetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"selfServiceActive":{"type":"boolean"}},"required":["id","individualId","name","email","dateOfBirth","employmentStart","employmentEnd","active","currentTerm","employeeCode","gender","probationEndsOn","inProbation","maskedNationalId","photoAssetId","selfServiceActive"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employees_list","title":"List employees","description":"Lists the organization's employees with current term and employment dates; search filters by name, includeInactive adds former employees. Returns { employees } with masked national IDs.\n\n(Scope: hr:read · endpoint: GET /api/employees)","http":{"method":"GET","path":"/api/employees"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"search":{"default":"","type":"string"},"includeInactive":{"type":"string","enum":["true","false"]}},"required":["organizationId","search"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"employees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The Counterparty id — an employee is a Counterparty edge."},"individualId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employmentStart":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"First day of the earliest employment term."},"employmentEnd":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The LAST EMPLOYED DAY; null while any term is open (law 2b)."},"active":{"type":"boolean","description":"Some employment term covers today."},"currentTerm":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData"],"additionalProperties":false},{"type":"null"}],"description":"The open term, else the most recent closed one."},"employeeCode":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"This tenant's employee number — unique per org, never reassigned (law 30)."},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}],"description":"Statutory eligibility input; MANAGER write, member read."},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Probation end (exclusive)."},"inProbation":{"type":"boolean","description":"Fold: employmentStart ≤ today < probationEndsOn."},"maskedNationalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The DEFAULT projection of the national identifier (law 32) — the mask, on every surface including lists, exports, MCP and the admin panel."},"nationalId":{"type":"string"},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only; accountNumber only with ?reveal=true (law 37b). Key absent below MANAGER.","anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits."},"accountNumber":{"type":"string"}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"photoAssetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"selfServiceActive":{"type":"boolean"}},"required":["id","individualId","name","email","dateOfBirth","employmentStart","employmentEnd","active","currentTerm","employeeCode","gender","probationEndsOn","inProbation","maskedNationalId","photoAssetId","selfServiceActive"],"additionalProperties":false}}},"required":["employees"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employees_photo_delete","title":"Remove an employee photo","description":"Removes an employee's profile photo by employee id. Returns { success }.\n\n(Scope: hr:write · endpoint: DELETE /api/employees/{id}/photo)","http":{"method":"DELETE","path":"/api/employees/{id}/photo"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employees_photo_get","title":"Get an employee photo","description":"Streams an employee's profile photo image by employee id. Returns the image file, not JSON.\n\n(Scope: hr:read · endpoint: GET /api/employees/{id}/photo)","http":{"method":"GET","path":"/api/employees/{id}/photo"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"asset":{"description":"The asset id; the URL is immutable per asset.","type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_employees_photo_upload","title":"Upload an employee photo","description":"Uploads a profile photo (file) for an employee. Returns { photoAssetId, url }.\n\n(Scope: hr:write · endpoint: POST /api/employees/{id}/photo)","http":{"method":"POST","path":"/api/employees/{id}/photo"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"file":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"photoAssetId":{"type":"string"},"url":{"type":"string","description":"Same-origin URL where the freshly-uploaded photo can be fetched."}},"required":["photoAssetId","url"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"hr_employees_update","title":"Update an employee","description":"Edits the supplied employee fields (name, contact details, employee code, national ID, probation end, current employment term, rate, currency). Use rehireFrom to reopen a former employee. Stores HR data only. Returns the employee.\n\n(Scope: hr:write · endpoint: PATCH /api/employees/{id})","http":{"method":"PATCH","path":"/api/employees/{id}"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"email":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employeeCode":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}]},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}]},"nationalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only — the account salary is credited to; null clears it (law 37a).","anyOf":[{"type":"object","properties":{"bankName":{"type":"string","minLength":1,"maxLength":80},"accountNumber":{"type":"string","pattern":"^[\\d\\s-]{4,34}$"}},"required":["bankName","accountNumber"],"additionalProperties":false},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"type":"string"},"rate":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string"},"employmentData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"rehireFrom":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string","description":"The Counterparty id — an employee is a Counterparty edge."},"individualId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string"},{"type":"null"}]},"employmentStart":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"First day of the earliest employment term."},"employmentEnd":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The LAST EMPLOYED DAY; null while any term is open (law 2b)."},"active":{"type":"boolean","description":"Some employment term covers today."},"currentTerm":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData"],"additionalProperties":false},{"type":"null"}],"description":"The open term, else the most recent closed one."},"employeeCode":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"This tenant's employee number — unique per org, never reassigned (law 30)."},"gender":{"anyOf":[{"type":"string","enum":["FEMALE","MALE","OTHER"]},{"type":"null"}],"description":"Statutory eligibility input; MANAGER write, member read."},"probationEndsOn":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Probation end (exclusive)."},"inProbation":{"type":"boolean","description":"Fold: employmentStart ≤ today < probationEndsOn."},"maskedNationalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The DEFAULT projection of the national identifier (law 32) — the mask, on every surface including lists, exports, MCP and the admin panel."},"nationalId":{"type":"string"},"personData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payeeAccount":{"description":"MANAGER only; accountNumber only with ?reveal=true (law 37b). Key absent below MANAGER.","anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits."},"accountNumber":{"type":"string"}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"photoAssetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"selfServiceActive":{"type":"boolean"}},"required":["id","individualId","name","email","dateOfBirth","employmentStart","employmentEnd","active","currentTerm","employeeCode","gender","probationEndsOn","inProbation","maskedNationalId","photoAssetId","selfServiceActive"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_leaves_balances","title":"Get leave balances","description":"Returns an employee's (counterpartyId) leave balances per leave kind as of a date (default today): accrued, used and remaining. Read-only. Returns { basis, balances }.\n\n(Scope: hr:read · endpoint: GET /api/hr/leaves/balances)","http":{"method":"GET","path":"/api/hr/leaves/balances"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"at":{"type":"string"}},"required":["organizationId","counterpartyId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"counterpartyId":{"type":"string"},"basis":{"type":"string","enum":["STATUTORY","COMPANY_POLICY"]},"balances":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"label":{"type":"string"},"windowStart":{"type":"string"},"windowEnd":{"type":"string"},"entitled":{"type":"number"},"carriedIn":{"type":"number"},"used":{"type":"number"},"balance":{"type":"number"},"capped":{"type":"boolean"}},"required":["kind","label","windowStart","windowEnd","entitled","carriedIn","used","balance","capped"],"additionalProperties":false}}},"required":["counterpartyId","basis","balances"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_leaves_cancel","title":"Cancel a leave request","description":"Cancels a requested or approved leave request by id with an optional decisionNote. An approved leave inside a month whose payslip is already paid is refused until that payslip is voided. Returns { id, status }.\n\n(Scope: hr:write · requires CONTRIBUTOR+ · endpoint: POST /api/hr/leaves/{id}/cancel)","http":{"method":"POST","path":"/api/hr/leaves/{id}/cancel"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1},"decisionNote":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","const":"CANCELLED"}},"required":["id","status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"hr_leaves_create","title":"Create a leave request","description":"Records a leave request for an employee (counterpartyId). Inputs: kind (e.g. vacation, sick), startDate, lastDay, days, optional hours and note. It stays pending until a manager decides it. Returns the request id.\n\n(Scope: hr:write · requires CONTRIBUTOR+ · endpoint: POST /api/hr/leaves)","http":{"method":"POST","path":"/api/hr/leaves"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"kind":{"type":"string","minLength":1},"startDate":{"type":"string"},"lastDay":{"type":"string"},"days":{"type":"number","exclusiveMinimum":0},"hours":{"type":"number","exclusiveMinimum":0},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["organizationId","counterpartyId","kind","startDate","lastDay","days"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"hr_leaves_decide","title":"Approve or reject leave","description":"Approves or rejects a pending leave request (status APPROVED or REJECTED) with an optional decisionNote. Requires MANAGER. Returns { id, status }.\n\n(Scope: hr:write · requires MANAGER+ · endpoint: POST /api/hr/leaves/{id}/decide)","http":{"method":"POST","path":"/api/hr/leaves/{id}/decide"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1},"status":{"type":"string","enum":["APPROVED","REJECTED"]},"decisionNote":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organizationId","id","status"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["APPROVED","REJECTED"]}},"required":["id","status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"hr_leaves_get","title":"Get a leave request","description":"Returns one leave request by id: employee, kind, dates, days, status, note and the manager's decision. Read-only.\n\n(Scope: hr:read · endpoint: GET /api/hr/leaves/{id})","http":{"method":"GET","path":"/api/hr/leaves/{id}"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"type":"string"},"kind":{"type":"string"},"startDate":{"type":"string"},"lastDay":{"type":"string"},"days":{"type":"number"},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]},"status":{"type":"string","enum":["REQUESTED","APPROVED","REJECTED","CANCELLED"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"decidedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"decisionNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","counterpartyId","employeeName","kind","startDate","lastDay","days","hours","status","note","decidedAt","decisionNote"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_leaves_list","title":"List leave requests","description":"Lists leave requests, optionally filtered by employee (counterpartyId), status, and a from/to date range. Returns { leaves } with kind, dates, days and status.\n\n(Scope: hr:read · endpoint: GET /api/hr/leaves)","http":{"method":"GET","path":"/api/hr/leaves"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string"},"status":{"type":"string","enum":["REQUESTED","APPROVED","REJECTED","CANCELLED"]},"from":{"type":"string"},"to":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"leaves":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"type":"string"},"kind":{"type":"string"},"startDate":{"type":"string"},"lastDay":{"type":"string"},"days":{"type":"number"},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]},"status":{"type":"string","enum":["REQUESTED","APPROVED","REJECTED","CANCELLED"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"decidedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"decisionNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","counterpartyId","employeeName","kind","startDate","lastDay","days","hours","status","note","decidedAt","decisionNote"],"additionalProperties":false}}},"required":["leaves"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_leaves_update","title":"Update a leave request","description":"Edits the dates, days, hours or note of a leave request by id. Returns the request id.\n\n(Scope: hr:write · requires CONTRIBUTOR+ · endpoint: PATCH /api/hr/leaves/{id})","http":{"method":"PATCH","path":"/api/hr/leaves/{id}"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1},"startDate":{"type":"string"},"lastDay":{"type":"string"},"days":{"type":"number","exclusiveMinimum":0},"hours":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_me_get","title":"Get my attendance summary","description":"Returns the signed-in employee's own record: name, employee code, any open work session, hours today and hours for the from/to period.\n\n(Scope: hr:read · requires VIEWER+ · endpoint: GET /api/hr/me)","http":{"method":"GET","path":"/api/hr/me"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"from":{"type":"string"},"to":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"counterpartyId":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"employeeCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"openSession":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"counterpartyId":{"type":"string"},"employeeName":{"anyOf":[{"type":"string"},{"type":"null"}]},"startAt":{"type":"string","description":"ISO instant, server-stamped for a CLOCK punch."},"endAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null ⟺ the session is open (law 18)."},"source":{"type":"string","enum":["CLOCK","MANUAL"]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalStartAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"originalEndAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"hours":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","counterpartyId","employeeName","startAt","endAt","source","note","approvedAt","approvedByUserId","editedAt","originalStartAt","originalEndAt","hours"],"additionalProperties":false},{"type":"null"}]},"todayHours":{"type":"number"},"periodHours":{"type":"number"},"timezone":{"type":"string"}},"required":["counterpartyId","name","employeeCode","openSession","todayHours","periodHours","timezone"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_me_payslips_list","title":"List my payslips","description":"Lists the signed-in employee's own payslips for a year (default current), with period and amounts. Read-only; a person only ever sees their own.\n\n(Scope: payroll:read · endpoint: GET /api/hr/me/payslips)","http":{"method":"GET","path":"/api/hr/me/payslips"},"feature":"payroll","verb":"read","scope":"payroll:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"year":{"type":"integer","minimum":2000,"maximum":2200}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"payslips":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"total":{"type":"number"},"periodStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"periodEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"issueDate":{"type":"string"}},"required":["id","status","currency","total","periodStart","periodEnd","issueDate"],"additionalProperties":false}}},"required":["payslips"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_terms_create","title":"Add an employment term","description":"Adds an employment term for an employee (counterpartyId): startDate, optional lastDay, job title, pay basis, rate, currency and leave grants. Records HR data only. Requires MANAGER. Returns the employee's terms, positions and career events.\n\n(Scope: hr:write · requires MANAGER+ · endpoint: POST /api/hr/terms)","http":{"method":"POST","path":"/api/hr/terms"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string"},"employmentData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"leaveGrants":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]}},"required":["organizationId","counterpartyId","startDate"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"terms":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"leaveGrants":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData","leaveGrants"],"additionalProperties":false}},"positions":{"type":"array","items":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last day held; null while the position is current."},"current":{"type":"boolean"},"termIds":{"type":"array","items":{"type":"string"},"description":"The terms coalesced into this position, in order — join against `terms`."}},"required":["title","startDate","lastDay","current","termIds"],"additionalProperties":false}},"careerEvents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["HIRED","REHIRED","TITLE_CHANGE","TRACK_CHANGE","RATE_CHANGE","TERMINATED"]},"date":{"type":"string","description":"The day the change took effect; for TERMINATED, the last employed day."},"termId":{"type":"string"},"facts":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},"previous":{"anyOf":[{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},{"type":"null"}],"description":"The preceding term's facts; null at HIRED / REHIRED."}},"required":["type","date","termId","facts","previous"],"additionalProperties":false}}},"required":["terms","positions","careerEvents"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"hr_terms_delete","title":"Delete an employment term","description":"Deletes one employment term by id. Requires MANAGER. Returns the employee's remaining terms, positions and career events.\n\n(Scope: hr:write · requires MANAGER+ · endpoint: DELETE /api/hr/terms/{id})","http":{"method":"DELETE","path":"/api/hr/terms/{id}"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string","minLength":1}},"required":["id","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"terms":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"leaveGrants":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData","leaveGrants"],"additionalProperties":false}},"positions":{"type":"array","items":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last day held; null while the position is current."},"current":{"type":"boolean"},"termIds":{"type":"array","items":{"type":"string"},"description":"The terms coalesced into this position, in order — join against `terms`."}},"required":["title","startDate","lastDay","current","termIds"],"additionalProperties":false}},"careerEvents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["HIRED","REHIRED","TITLE_CHANGE","TRACK_CHANGE","RATE_CHANGE","TERMINATED"]},"date":{"type":"string","description":"The day the change took effect; for TERMINATED, the last employed day."},"termId":{"type":"string"},"facts":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},"previous":{"anyOf":[{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},{"type":"null"}],"description":"The preceding term's facts; null at HIRED / REHIRED."}},"required":["type","date","termId","facts","previous"],"additionalProperties":false}}},"required":["terms","positions","careerEvents"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_terms_list","title":"List employment terms","description":"Lists one employee's (counterpartyId) employment terms, positions and career events. Read-only. Returns { terms, positions, careerEvents }.\n\n(Scope: hr:read · endpoint: GET /api/hr/terms)","http":{"method":"GET","path":"/api/hr/terms"},"feature":"hr","verb":"read","scope":"hr:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1}},"required":["organizationId","counterpartyId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"terms":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"leaveGrants":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData","leaveGrants"],"additionalProperties":false}},"positions":{"type":"array","items":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last day held; null while the position is current."},"current":{"type":"boolean"},"termIds":{"type":"array","items":{"type":"string"},"description":"The terms coalesced into this position, in order — join against `terms`."}},"required":["title","startDate","lastDay","current","termIds"],"additionalProperties":false}},"careerEvents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["HIRED","REHIRED","TITLE_CHANGE","TRACK_CHANGE","RATE_CHANGE","TERMINATED"]},"date":{"type":"string","description":"The day the change took effect; for TERMINATED, the last employed day."},"termId":{"type":"string"},"facts":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},"previous":{"anyOf":[{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},{"type":"null"}],"description":"The preceding term's facts; null at HIRED / REHIRED."}},"required":["type","date","termId","facts","previous"],"additionalProperties":false}}},"required":["terms","positions","careerEvents"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"hr_terms_update","title":"Update an employment term","description":"Edits an employment term by id (dates, job title, pay basis, rate, currency, leave grants); omitted fields keep their value. Requires MANAGER. Returns the employee's terms, positions and career events.\n\n(Scope: hr:write · requires MANAGER+ · endpoint: PATCH /api/hr/terms/{id})","http":{"method":"PATCH","path":"/api/hr/terms/{id}"},"feature":"hr","verb":"write","scope":"hr:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string","minLength":1},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string"},"employmentData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"leaveGrants":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]}},"required":["id","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"terms":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The INCLUSIVE last employed day; null while the term is open (law 2b)."},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monthly wage for MONTHLY, hourly wage for HOURLY."},"currency":{"type":"string"},"employmentData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"leaveGrants":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},{"type":"null"}]}},"required":["id","title","startDate","lastDay","basis","rate","currency","employmentData","leaveGrants"],"additionalProperties":false}},"positions":{"type":"array","items":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"type":"string"},"lastDay":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last day held; null while the position is current."},"current":{"type":"boolean"},"termIds":{"type":"array","items":{"type":"string"},"description":"The terms coalesced into this position, in order — join against `terms`."}},"required":["title","startDate","lastDay","current","termIds"],"additionalProperties":false}},"careerEvents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["HIRED","REHIRED","TITLE_CHANGE","TRACK_CHANGE","RATE_CHANGE","TERMINATED"]},"date":{"type":"string","description":"The day the change took effect; for TERMINATED, the last employed day."},"termId":{"type":"string"},"facts":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},"previous":{"anyOf":[{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["MONTHLY","HOURLY"]},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string"}},"required":["title","basis","rate","currency"],"additionalProperties":false},{"type":"null"}],"description":"The preceding term's facts; null at HIRED / REHIRED."}},"required":["type","date","termId","facts","previous"],"additionalProperties":false}}},"required":["terms","positions","careerEvents"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"imports_cancel_create","title":"Cancel an import","description":"Cancels an import run that has not been committed, discarding its staged records. Requires MANAGER. Returns { id, status }.\n\n(Scope: imports:write · requires MANAGER+ · endpoint: POST /api/imports/{id}/cancel)","http":{"method":"POST","path":"/api/imports/{id}/cancel"},"feature":"imports","verb":"write","scope":"imports:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id","status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"imports_columns_list","title":"Map import columns","description":"Reads an uploaded spreadsheet (upload id) against a mapping profile (profileId) and reports detected headers, row count, mapped and unmapped columns, and missing required columns. Read-only. Requires MANAGER.\n\n(Scope: imports:read · requires MANAGER+ · endpoint: GET /api/imports/upload/{id}/columns)","http":{"method":"GET","path":"/api/imports/upload/{id}/columns"},"feature":"imports","verb":"read","scope":"imports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1},"profileId":{"type":"string","minLength":1}},"required":["id","organizationId","profileId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"headers":{"type":"array","items":{"type":"string"}},"rowCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"mapped":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"missingRequired":{"type":"array","items":{"type":"string"}},"unmapped":{"type":"array","items":{"type":"string"}}},"required":["headers","rowCount","mapped","missingRequired","unmapped"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"imports_commit_create","title":"Commit an import","description":"Writes the staged records of an import run into the organization's books (customers, suppliers, documents and so on, as chosen in review). Requires MANAGER. Returns { status, committed, skipped, failed }.\n\n(Scope: imports:write · requires MANAGER+ · endpoint: POST /api/imports/{id}/commit)","http":{"method":"POST","path":"/api/imports/{id}/commit"},"feature":"imports","verb":"write","scope":"imports:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"committed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","status","committed","skipped","failed"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"imports_create","title":"Start an import","description":"Starts an import from another provider or an uploaded file. Inputs: sourceId, scope, and for file imports an uploadId and profileId. Stages records for review; nothing is written until the import is committed. Requires MANAGER. Returns the run.\n\n(Scope: imports:write · requires MANAGER+ · endpoint: POST /api/imports)","http":{"method":"POST","path":"/api/imports"},"feature":"imports","verb":"write","scope":"imports:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"sourceId":{"type":"string","minLength":1},"scope":{"type":"object","properties":{"entityTypes":{"minItems":1,"type":"array","items":{"type":"string","enum":["CLIENT","ITEM","DOCUMENT","EXPENSE"]}}},"required":["entityTypes"],"additionalProperties":false},"uploadId":{"type":"string"},"profileId":{"type":"string"}},"required":["organizationId","sourceId","scope"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"sourceId":{"type":"string"},"status":{"type":"string"},"entityTypes":{"type":"array","items":{"type":"string"}},"uploadId":{"anyOf":[{"type":"string"},{"type":"null"}]},"profileId":{"anyOf":[{"type":"string"},{"type":"null"}]},"counts":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"fetched":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"staged":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invalid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["fetched","staged","invalid"],"additionalProperties":false}},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","sourceId","status","entityTypes","uploadId","profileId","counts","errorMessage","startedAt","completedAt"],"additionalProperties":false}},"required":["run"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"imports_get","title":"Get an import","description":"Returns one import run with its status and staged records. Read-only.\n\n(Scope: imports:read · endpoint: GET /api/imports/{id})","http":{"method":"GET","path":"/api/imports/{id}"},"feature":"imports","verb":"read","scope":"imports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"sourceId":{"type":"string"},"status":{"type":"string"},"entityTypes":{"type":"array","items":{"type":"string"}},"uploadId":{"anyOf":[{"type":"string"},{"type":"null"}]},"profileId":{"anyOf":[{"type":"string"},{"type":"null"}]},"counts":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"fetched":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"staged":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invalid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["fetched","staged","invalid"],"additionalProperties":false}},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","sourceId","status","entityTypes","uploadId","profileId","counts","errorMessage","startedAt","completedAt"],"additionalProperties":false},"records":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"willImport":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"byClassification":{"type":"object","propertyNames":{"type":"string","enum":["NEW","EXACT_DUPLICATE","PROBABLE_MATCH","INVALID"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["NEW","EXACT_DUPLICATE","PROBABLE_MATCH","INVALID"]},"byDecision":{"type":"object","propertyNames":{"type":"string","enum":["PENDING","IMPORT","SKIP","MERGE"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["PENDING","IMPORT","SKIP","MERGE"]}},"required":["total","willImport","byClassification","byDecision"],"additionalProperties":false}},"required":["run","records"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"imports_records_list","title":"List import records","description":"Lists the staged records of an import run, filtered by entityType or classification (new, duplicate, conflict), with paging. Returns { records, pagination }.\n\n(Scope: imports:read · endpoint: GET /api/imports/{id}/records)","http":{"method":"GET","path":"/api/imports/{id}/records"},"feature":"imports","verb":"read","scope":"imports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"entityType":{"type":"string","enum":["CLIENT","ITEM","DOCUMENT","EXPENSE"]},"classification":{"type":"string","enum":["NEW","EXACT_DUPLICATE","PROBABLE_MATCH","INVALID"]},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":10,"type":"integer","minimum":1,"maximum":200}},"required":["id","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entityType":{"type":"string"},"externalId":{"type":"string"},"normalized":{},"classification":{"type":"string"},"matchedLocalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"matchConfidence":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"matchEvidence":{"anyOf":[{},{"type":"null"}]},"decision":{"type":"string"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}]},"localId":{"anyOf":[{"type":"string"},{"type":"null"}]},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","entityType","externalId","normalized","classification","matchedLocalId","matchConfidence","matchEvidence","decision","outcome","localId","errorMessage"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["records","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"imports_records_update","title":"Review import records","description":"Sets the decision (import or skip) on staged records of a run, either for the listed recordIds or for every record matching entityType/classification. Requires MANAGER. Returns { updated }.\n\n(Scope: imports:write · requires MANAGER+ · endpoint: PATCH /api/imports/{id}/records)","http":{"method":"PATCH","path":"/api/imports/{id}/records"},"feature":"imports","verb":"write","scope":"imports:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"decision":{"type":"string","enum":["IMPORT","SKIP","MERGE"]},"entityType":{"type":"string","enum":["CLIENT","ITEM","DOCUMENT","EXPENSE"]},"classification":{"type":"string","enum":["NEW","EXACT_DUPLICATE","PROBABLE_MATCH","INVALID"]},"recordIds":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"string","minLength":1}}},"required":["id","decision"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"updated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["updated"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"imports_upload_create","title":"Upload an import file","description":"Uploads a spreadsheet or export file for importing. Returns { upload } with the upload id to pass to imports_create. Requires MANAGER.\n\n(Scope: imports:write · requires MANAGER+ · endpoint: POST /api/imports/upload)","http":{"method":"POST","path":"/api/imports/upload"},"feature":"imports","verb":"write","scope":"imports:write","hasBody":true,"inputSchema":{"type":"object","properties":{"file":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false},"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"upload":{"type":"object","properties":{"id":{"type":"string"},"filename":{"type":"string"},"byteSize":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","filename","byteSize"],"additionalProperties":false}},"required":["upload"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"integrations_auto_scan_create","title":"Set inbox auto-scan","description":"Turn scheduled inbox auto-scan on (DAILY/WEEKLY/MONTHLY) or off (OFF) for an email connection. ON seeds + enables an ordinary automation (schedule.* → expenses_email_poll_create) that counts toward the per-org automation cap; past the cap returns 409. OFF deletes it.","http":{"method":"POST","path":"/api/expenses/email-settings/{id}/auto-scan"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1},"cadence":{"type":"string","enum":["OFF","DAILY","WEEKLY","MONTHLY"]}},"required":["organizationId","id","cadence"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"connectionId":{"type":"string"},"automationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cadence":{"type":"string","enum":["OFF","DAILY","WEEKLY","MONTHLY"]},"automationStatus":{"anyOf":[{"type":"string","enum":["ENABLED","DISABLED","PAUSED_NO_ACCESS"]},{"type":"null"}]}},"required":["connectionId","automationId","cadence","automationStatus"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_auto_scan_delete","title":"Turn off inbox auto-scan","description":"Turns scheduled auto-scan off for an email connection and deletes the automation that drove it. Returns the connection's auto-scan state (cadence OFF).\n\n(Scope: integrations:write · requires CONTRIBUTOR+ · endpoint: DELETE /api/expenses/email-settings/{id}/auto-scan)","http":{"method":"DELETE","path":"/api/expenses/email-settings/{id}/auto-scan"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"connectionId":{"type":"string"},"automationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cadence":{"type":"string","enum":["OFF","DAILY","WEEKLY","MONTHLY"]},"automationStatus":{"anyOf":[{"type":"string","enum":["ENABLED","DISABLED","PAUSED_NO_ACCESS"]},{"type":"null"}]}},"required":["connectionId","automationId","cadence","automationStatus"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_auto_scan_list","title":"Get inbox auto-scan","description":"Returns whether scheduled auto-scan is on for an email connection: cadence (OFF, DAILY, WEEKLY, MONTHLY), the backing automation and its status. Read-only.\n\n(Scope: integrations:read · requires VIEWER+ · endpoint: GET /api/expenses/email-settings/{id}/auto-scan)","http":{"method":"GET","path":"/api/expenses/email-settings/{id}/auto-scan"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"connectionId":{"type":"string"},"automationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cadence":{"type":"string","enum":["OFF","DAILY","WEEKLY","MONTHLY"]},"automationStatus":{"anyOf":[{"type":"string","enum":["ENABLED","DISABLED","PAUSED_NO_ACCESS"]},{"type":"null"}]}},"required":["connectionId","automationId","cadence","automationStatus"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_connections_list","title":"List provider connections","description":"Lists the organization's connections to external providers with their status and environment. Credentials are never returned. Returns { connections }.\n\n(Scope: integrations:read · endpoint: GET /api/organizations/{id}/connections)","http":{"method":"GET","path":"/api/organizations/{id}/connections"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"providerId":{"type":"string"},"displayName":{"type":"string"},"category":{"type":"string","enum":["TAX_AUTHORITY","EMAIL_INBOX","ACCOUNTING","OTHER"]},"authKind":{"type":"string","enum":["OAUTH_AUTHORIZATION_CODE","OAUTH_CLIENT_CREDENTIALS","API_KEY","BASIC"]},"environment":{"type":"string","enum":["sandbox","production"]},"required":{"type":"boolean","description":"Deduced from the org country handler (R1)"},"isConfigured":{"type":"boolean","description":"Platform env config present for this provider"},"status":{"type":"string","enum":["ACTIVE","NEEDS_RECONNECT","DISABLED","NOT_CONNECTED"]},"severity":{"anyOf":[{"type":"string","enum":["ok","expiring","reconnect","temporary_failure","platform_config"]},{"type":"null"}]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO timestamp of the lifecycle wall"},"daysLeft":{"anyOf":[{"type":"number"},{"type":"null"}]},"connectedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastRefreshedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastError":{"anyOf":[{"type":"string"},{"type":"null"}]},"health":{"type":"object","properties":{"authorization":{"type":"object","properties":{"checkedAt":{"type":"string"},"result":{"type":"string","enum":["ok","failure"]},"errorClass":{"type":"string","enum":["TRANSIENT","PLATFORM_CONFIG"]}},"required":["checkedAt","result"],"additionalProperties":false},"service":{"type":"object","properties":{"checkedAt":{"type":"string"},"result":{"type":"string","enum":["ok","failure"]},"errorClass":{"type":"string","enum":["TRANSIENT","PLATFORM_CONFIG"]}},"required":["checkedAt","result"],"additionalProperties":false}},"additionalProperties":false},"scopes":{"type":"array","items":{"type":"string"}},"fields":{"description":"Static-credential form fields (non-OAuth providers only)","type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","password"]},"required":{"type":"boolean"},"placeholder":{"type":"string"}},"required":["key","label","type","required"],"additionalProperties":false}}},"required":["providerId","displayName","category","authKind","environment","required","isConfigured","status","severity","statusReason","expiresAt","daysLeft","connectedAt","lastRefreshedAt","lastUsedAt","lastError","scopes"],"additionalProperties":false}}},"required":["connections"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_email_settings_delete","title":"Delete an email inbox connection","description":"Deletes an email inbox connection by id, discarding its stored credentials. Expenses already created from it remain. Requires MANAGER. Returns { success }.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: DELETE /api/expenses/email-settings)","http":{"method":"DELETE","path":"/api/expenses/email-settings"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1}},"required":["id","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_email_settings_list","title":"List email inbox connections","description":"Lists the receipt-fetching inbox connections (Gmail, Outlook, IMAP) or returns one by id: provider, folder, filters, polling settings and last poll time. Passwords and tokens are never returned.\n\n(Scope: integrations:read · endpoint: GET /api/expenses/email-settings)","http":{"method":"GET","path":"/api/expenses/email-settings"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"anyOf":[{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"enabled":{"type":"boolean"},"tokenExpiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"host":{"anyOf":[{"type":"string"},{"type":"null"}]},"port":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"useTls":{"type":"boolean"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasPassword":{"type":"boolean","description":"Whether an IMAP/POP3 password is stored. The password itself is never returned."},"folderOrLabel":{"anyOf":[{"type":"string"},{"type":"null"}]},"subjectFilter":{"anyOf":[{"type":"string"},{"type":"null"}]},"senderWhitelist":{"type":"array","items":{"type":"string"}},"autoPollEnabled":{"type":"boolean"},"pollIntervalDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastPolledAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","provider","enabled","tokenExpiresAt","host","port","useTls","username","hasPassword","folderOrLabel","subjectFilter","senderWhitelist","autoPollEnabled","pollIntervalDays","lastPolledAt","createdAt","updatedAt"],"additionalProperties":false},{"type":"null"}]},{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"enabled":{"type":"boolean"},"tokenExpiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"host":{"anyOf":[{"type":"string"},{"type":"null"}]},"port":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"useTls":{"type":"boolean"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasPassword":{"type":"boolean","description":"Whether an IMAP/POP3 password is stored. The password itself is never returned."},"folderOrLabel":{"anyOf":[{"type":"string"},{"type":"null"}]},"subjectFilter":{"anyOf":[{"type":"string"},{"type":"null"}]},"senderWhitelist":{"type":"array","items":{"type":"string"}},"autoPollEnabled":{"type":"boolean"},"pollIntervalDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastPolledAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","provider","enabled","tokenExpiresAt","host","port","useTls","username","hasPassword","folderOrLabel","subjectFilter","senderWhitelist","autoPollEnabled","pollIntervalDays","lastPolledAt","createdAt","updatedAt"],"additionalProperties":false}}},"required":["connections"],"additionalProperties":false}],"description":"Returns a single connection (when `id` is given) or `{ connections: [...] }` for the list view. Secrets are never included; `hasPassword` reports whether a credential is on file."},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_enrollments_create","title":"Start expense bot enrollment","description":"Starts enrolling a phone number (phone, isReplacement) as the organization's single Telegram expense-bot sender and returns the enrollment plus a Telegram activationLink the phone's owner must open to finish verification. Sends nothing itself. Requires MANAGER.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: POST /api/expense-bot/enrollments)","http":{"method":"POST","path":"/api/expense-bot/enrollments"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"phone":{"type":"string","minLength":1,"maxLength":64},"isReplacement":{"default":false,"type":"boolean"}},"required":["organizationId","phone","isReplacement"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"enrollment":{"type":"object","properties":{"id":{"type":"string"},"maskedPhone":{"type":"string"},"provider":{"type":"string","const":"TELEGRAM"},"status":{"type":"string","enum":["PENDING","AWAITING_CONTACT","AWAITING_OTP"]},"isReplacement":{"type":"boolean"},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"activationLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"required":["id","maskedPhone","provider","status","isReplacement","expiresAt","activationLink"],"additionalProperties":false},"activationLink":{"type":"string","format":"uri"}},"required":["enrollment","activationLink"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"integrations_enrollments_delete","title":"Cancel expense bot enrollment","description":"Cancels a pending expense-bot enrollment by id so its activation link stops working. Requires MANAGER. Returns { success }.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: DELETE /api/expense-bot/enrollments/{id})","http":{"method":"DELETE","path":"/api/expense-bot/enrollments/{id}"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_fetch_logs_list","title":"List inbox fetch runs","description":"Lists past and running receipt-fetch runs, optionally for one connection (connectionId), with counts and errors. Returns { runs }.\n\n(Scope: integrations:read · endpoint: GET /api/expenses/fetch-logs)","http":{"method":"GET","path":"/api/expenses/fetch-logs"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"connectionId":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"connectionId":{"type":"string"},"status":{"type":"string","enum":["PENDING","RUNNING","DONE","ERROR","MANUAL_STOP"]},"dateFrom":{"type":"string"},"dateTo":{"type":"string"},"emailsScanned":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"emailsDetected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"expensesCreated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string"},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When a worker claimed the run; null on a legacy sync run"},"lastProgressAt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Heartbeat — bumped per processed message"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"messageId":{"type":"string"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"type":"string","enum":["CREATED","DUPLICATE","SKIPPED_NOT_EXPENSE","DROPPED_NO_DATA","FAILED"]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Short human-readable disposition reason"},"processedAt":{"type":"string"}},"required":["id","messageId","subject","outcome","reason","processedAt"],"additionalProperties":false}}},"required":["id","connectionId","status","dateFrom","dateTo","emailsScanned","emailsDetected","expensesCreated","errorMessage","startedAt","completedAt","claimedAt","lastProgressAt","messages"],"additionalProperties":false}}},"required":["runs"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_health_list","title":"Get connection health","description":"Lists connections that need attention (expired token, failed probe, revoked access) so the user can reconnect them. Read-only. Returns { issues }.\n\n(Scope: integrations:read · endpoint: GET /api/organizations/{id}/connections/health)","http":{"method":"GET","path":"/api/organizations/{id}/connections/health"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"issues":{"type":"array","items":{"type":"object","properties":{"providerId":{"type":"string"},"displayName":{"type":"string"},"severity":{"type":"string","enum":["missing","expiring","reconnect","temporary_failure","platform_config"]},"daysLeft":{"type":"number"},"environment":{"type":"string"},"expiresAt":{"type":"string"},"connectedAt":{"type":"string"},"observedAt":{"type":"string"}},"required":["providerId","displayName","severity","environment"],"additionalProperties":false}}},"required":["issues"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_list","title":"Get expense bot settings","description":"Returns the organization's Telegram expense-bot settings: whether the provider is available, the one-sender limit and usage, the active sender (masked phone, locale) and any pending enrollment. Read-only. Requires MANAGER.\n\n(Scope: integrations:read · requires MANAGER+ · endpoint: GET /api/expense-bot)","http":{"method":"GET","path":"/api/expense-bot"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"limit":{"type":"number","const":1},"used":{"type":"integer","minimum":0,"maximum":9007199254740991},"providers":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","const":"TELEGRAM"},"enabled":{"type":"boolean"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["provider","enabled","username"],"additionalProperties":false}},"activeSender":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"maskedPhone":{"type":"string"},"status":{"type":"string","const":"ACTIVE"},"locale":{"type":"string","enum":["EN","HE"]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["id","maskedPhone","status","locale","createdAt"],"additionalProperties":false},{"type":"null"}]},"pendingEnrollment":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"maskedPhone":{"type":"string"},"provider":{"type":"string","const":"TELEGRAM"},"status":{"type":"string","enum":["PENDING","AWAITING_CONTACT","AWAITING_OTP"]},"isReplacement":{"type":"boolean"},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"activationLink":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"required":["id","maskedPhone","provider","status","isReplacement","expiresAt","activationLink"],"additionalProperties":false},{"type":"null"}]}},"required":["limit","used","providers","activeSender","pendingEnrollment"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_senders_delete","title":"Revoke expense bot sender","description":"Revokes the active Telegram expense-bot sender by id: messages from that account are no longer accepted for the organization and its in-flight submissions are cancelled. Expenses already created remain. Requires MANAGER. Returns { success }.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: DELETE /api/expense-bot/senders/{id})","http":{"method":"DELETE","path":"/api/expense-bot/senders/{id}"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"id":{"type":"string","minLength":1}},"required":["organizationId","id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_stop_create","title":"Stop an inbox fetch run","description":"Asks a running receipt-fetch run (id) to stop. Returns { success }.\n\n(Scope: integrations:write · endpoint: POST /api/expenses/fetch-logs/{id}/stop)","http":{"method":"POST","path":"/api/expenses/fetch-logs/{id}/stop"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"integrations_tax_authority_delete","title":"Remove tax authority credentials","description":"Removes the stored credentials of a tax-authority integration for the organization; invoices can no longer be submitted for clearance until credentials are added again. Requires MANAGER.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: DELETE /api/organizations/{id}/tax-authority/{integrationId})","http":{"method":"DELETE","path":"/api/organizations/{id}/tax-authority/{integrationId}"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"integrationId":{"type":"string"}},"required":["id","integrationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_tax_authority_get","title":"Get a tax authority integration","description":"Returns one tax-authority integration: its name, required credential fields, environment and whether credentials are configured. Credential values are never returned. Requires MANAGER.\n\n(Scope: integrations:read · requires MANAGER+ · endpoint: GET /api/organizations/{id}/tax-authority/{integrationId})","http":{"method":"GET","path":"/api/organizations/{id}/tax-authority/{integrationId}"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"integrationId":{"type":"string"}},"required":["id","integrationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"integrationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"requiredFields":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"environment":{"type":"string","description":"sandbox | production"},"status":{"type":"object","properties":{"exists":{"type":"boolean"},"isActive":{"type":"boolean"},"isValidated":{"type":"boolean"},"lastValidatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"validationError":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["exists","isActive","isValidated","lastValidatedAt","validationError"],"additionalProperties":false}},"required":["integrationId","name","description","requiredFields","environment","status"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_tax_authority_list","title":"List tax authority integrations","description":"Lists the tax-authority integrations available for the organization's country and whether each is configured. Returns { integrations }.\n\n(Scope: integrations:read · endpoint: GET /api/organizations/{id}/tax-authority)","http":{"method":"GET","path":"/api/organizations/{id}/tax-authority"},"feature":"integrations","verb":"read","scope":"integrations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"integrations":{"type":"array","items":{"type":"object","properties":{"integrationId":{"type":"string","description":"Stable identifier of the tax-authority integration (e.g. \"israel-shaam\")."},"name":{"type":"string"},"country":{"type":"string"},"connected":{"type":"boolean"},"lastValidatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["integrationId","name","country","connected","lastValidatedAt"],"additionalProperties":false}}},"required":["integrations"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"integrations_validate_create","title":"Validate tax authority credentials","description":"Calls the tax authority with the stored credentials to check they are accepted, without submitting any invoice. Requires MANAGER. Returns { valid, error, details }.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: POST /api/organizations/{id}/tax-authority/{integrationId}/validate)","http":{"method":"POST","path":"/api/organizations/{id}/tax-authority/{integrationId}/validate"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"integrationId":{"type":"string"}},"required":["id","integrationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"valid":{"type":"boolean"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"details":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["valid"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"invitations_create","title":"Invite a user","description":"Invites someone to the organization by email with a role (MANAGER, CONTRIBUTOR or VIEWER) and sends them an invitation email. Requires MANAGER. Returns the invitation.\n\n(Scope: users:write · requires MANAGER+ · endpoint: POST /api/invitations)","http":{"method":"POST","path":"/api/invitations"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"type":"string"},"role":{"type":"string","enum":["MANAGER","CONTRIBUTOR","VIEWER"]},"organizationId":{"type":"string"}},"required":["email","role","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"type":"string"},"status":{"type":"string","description":"PENDING | ACCEPTED | DECLINED | EXPIRED"},"invitedById":{"type":"string"},"acceptedById":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invitedBy":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false},{"type":"null"}]},"acceptedBy":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false},{"type":"null"}]},"organization":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","organizationId","email","name","role","status","invitedById","acceptedById","expiresAt","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invitations_delete","title":"Cancel an invitation","description":"Cancels a pending invitation by id so its link stops working. Returns { success }.\n\n(Scope: users:write · endpoint: DELETE /api/invitations/{id})","http":{"method":"DELETE","path":"/api/invitations/{id}"},"feature":"users","verb":"write","scope":"users:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"invitations_list","title":"List invitations","description":"Lists the organization's invitations with email, role, status and expiry. Requires MANAGER. Returns { invitations }.\n\n(Scope: users:read · requires MANAGER+ · endpoint: GET /api/invitations)","http":{"method":"GET","path":"/api/invitations"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"invitations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"type":"string"},"status":{"type":"string","description":"PENDING | ACCEPTED | DECLINED | EXPIRED"},"invitedById":{"type":"string"},"acceptedById":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"invitedBy":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false},{"type":"null"}]},"acceptedBy":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false},{"type":"null"}]},"organization":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false},{"type":"null"}]}},"required":["id","organizationId","email","name","role","status","invitedById","acceptedById","expiresAt","createdAt","updatedAt"],"additionalProperties":false}}},"required":["invitations"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"invoices_cancel_create","title":"Cancel an issued document","description":"Cancels an issued, numbered document by issuing a cancellation document against it, with an optional reason; restock (default true) returns its items to inventory. For clearance countries the cancellation is also submitted to the tax authority. Returns { voidedAt, cancellationDocument, cancellationClearance }.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/cancel)","http":{"method":"POST","path":"/api/documents/{id}/cancel"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"reason":{"type":"string","maxLength":500},"restock":{"type":"boolean"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"voidedAt":{"type":"string"},"cancellationDocument":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"cancellationClearance":{"type":"object","properties":{"required":{"type":"boolean"},"status":{"type":"string"},"stale":{"type":"boolean"},"allocationNumber":{"type":"string"}},"required":["required","status"],"additionalProperties":false}},"required":["success","voidedAt","cancellationDocument"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_clearance_create","title":"Submit a document for clearance","description":"Submits an invoice to the national tax authority (for example Israel's SHAAM) to obtain its allocation number; action is submit or retry. Contacts the authority and cannot be recalled. Returns { success, result }.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/clearance)","http":{"method":"POST","path":"/api/documents/{id}/clearance"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string","enum":["submit","retry"]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","description":"True iff the country handler reports APPROVED on this submission."},"result":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Full clearance result from the country handler."}},"required":["success","result"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_clearance_list","title":"Get clearance status","description":"Returns the tax-authority clearance status of a document: state, allocation number, timestamps and the attempt history. Fields depend on the country. Read-only.\n\n(Scope: invoices:read · endpoint: GET /api/documents/{id}/clearance)","http":{"method":"GET","path":"/api/documents/{id}/clearance"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Country-specific clearance status — fields depend on the country handler (Israel returns `status`, `vatAllocationNumber`, `submittedAt`, etc.). See `clearanceService.getClearanceStatus`."},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"invoices_create","title":"Create an invoice or receipt","description":"Creates a document (invoice, receipt, invoice-receipt, payment request, credit or debit memo) for a customer. Inputs: customerId, currency, documentType, items, subtotal, taxRate, taxAmount, total, status, and optional due date, bank account and notes. A non-draft status assigns the official number; in Israel an invoice above the threshold is also submitted for clearance. Returns the document.\n\n(Scope: invoices:write · requires CONTRIBUTOR+ · endpoint: POST /api/documents)","http":{"method":"POST","path":"/api/documents"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"customerId":{"type":"string","minLength":1},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"status":{"default":"DRAFT","type":"string","enum":["DRAFT","UNSENT","SENT","PAID"]},"documentType":{"default":"INVOICE","type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST"]},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string","minLength":1},"quantity":{"type":"number","minimum":0},"unitPrice":{"type":"number","minimum":0},"amount":{"type":"number"}},"required":["id","description","quantity","unitPrice","amount"],"additionalProperties":false}},"subtotal":{"type":"number"},"taxRate":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organizationId","customerId","currency","status","documentType","items","subtotal","taxRate","taxAmount","total"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"documentType":{"type":"string"},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancellationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"family":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentType":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"cancelled":{"type":"boolean"},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","documentType","invoiceNumber","total","cancelled","relatedDocumentId"],"additionalProperties":false}},"issueDate":{"type":"string"},"invoiceDate":{"type":"string","description":"Legacy alias for issueDate."},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"subtotal":{"type":"number"},"taxRate":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"allocationPending":{"type":"boolean"},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]}},"required":["id","name","email","country","preferredDocumentLanguage"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"}},"required":["id","description","quantity","unitPrice","amount"],"additionalProperties":false}},"payments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"attachments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"clearance":{"description":"Present only when a clearance flow applies to this document (spec §7.3).","type":"object","properties":{"required":{"type":"boolean"},"status":{"type":"string","description":"APPROVED | PENDING | ERROR | REJECTED | MANUAL | NOT_REQUIRED"},"reason":{"description":"\"reconnect_required\" | \"held\" | an ITA error code","type":"string"},"details":{"type":"array","items":{"type":"string"}},"allocationNumber":{"type":"string"},"stale":{"type":"boolean"}},"required":["required","status"],"additionalProperties":false}},"required":["id","organizationId","customerId","documentType","invoiceNumber","status","inDispute","cancelled","cancellationDocumentId","cancellationNumber","cancelsDocumentId","relatedDocumentId","family","issueDate","invoiceDate","dueDate","recognitionStart","recognitionEnd","currency","exchangeRate","subtotal","taxRate","taxAmount","total","paidAmount","notes","vatAllocationNumber","allocationPending","countrySpecificData","renderProfileSnapshot","createdAt","updatedAt","customer","items","createdBy"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_delete","title":"Delete a draft document","description":"Permanently deletes a document by id. Only unissued drafts can be deleted; issued documents must be voided or cancelled instead. Returns { success }.\n\n(Scope: invoices:write · endpoint: DELETE /api/documents/{id})","http":{"method":"DELETE","path":"/api/documents/{id}"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"invoices_events_create","title":"Add a document event","description":"Appends a user event (DISPUTED, DISPUTE_COUNTERED, DISPUTE_RESOLVED, COMMENTED, APPROVED, REJECTED) with an optional payload to a document's event log. Returns the event.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/events)","http":{"method":"POST","path":"/api/documents/{id}/events"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["DISPUTED","DISPUTE_COUNTERED","DISPUTE_RESOLVED","COMMENTED","APPROVED","REJECTED"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"organizationId":{"type":"string"},"type":{"type":"string","description":"DocumentEventType — see DOCUMENT_EVENTS.md §4."},"actorUserId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null = a system event."},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"payload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Event-specific data — shape depends on `type` (§4)."},"createdAt":{"type":"string"}},"required":["id","documentId","organizationId","type","actorUserId","actor","payload","createdAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"invoices_events_list","title":"List document events","description":"Lists a document's event log (created, sent, paid, disputed, commented and so on), newest first, with paging. Returns { events, pagination }.\n\n(Scope: invoices:read · endpoint: GET /api/documents/{id}/events)","http":{"method":"GET","path":"/api/documents/{id}/events"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":50,"type":"integer","minimum":1,"maximum":100}},"required":["id","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"organizationId":{"type":"string"},"type":{"type":"string","description":"DocumentEventType — see DOCUMENT_EVENTS.md §4."},"actorUserId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"null = a system event."},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"payload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Event-specific data — shape depends on `type` (§4)."},"createdAt":{"type":"string"}},"required":["id","documentId","organizationId","type","actorUserId","actor","payload","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["events","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"invoices_get","title":"Get a document","description":"Returns one document by id with its number, status, customer, line items, totals, payments, linked receipts, tax-authority clearance and country-specific data. Read-only; renders as an interactive widget.\n\n(Scope: invoices:read · endpoint: GET /api/documents/{id})","http":{"method":"GET","path":"/api/documents/{id}"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"receiptSettlement":{"anyOf":[{"type":"object","properties":{"sourceDocumentId":{"type":"string"},"sourceDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["allocations","invoice-reference"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceLineItemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"lineType":{"type":"string"},"allocated":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","sourceLineItemId","description","lineType","allocated"],"additionalProperties":false}}},"required":["sourceDocumentId","sourceDocumentNumber","basis","lines"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancellationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"family":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentType":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"cancelled":{"type":"boolean"},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","documentType","invoiceNumber","total","cancelled","relatedDocumentId"],"additionalProperties":false}},"currency":{"type":"string"},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"issueDate":{"type":"string"},"paymentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","invoiceNumber","total","issueDate","paymentId","paymentDate","paymentMethod","cancelled","cancellationDocumentId"],"additionalProperties":false}},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedDocument":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"}},"required":["id","invoiceNumber","documentType"],"additionalProperties":false},{"type":"null"}]},"receiptEmailRecipients":{"type":"array","items":{"type":"string"}},"subtotal":{"type":"number"},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method","documentId"],"additionalProperties":false}},"payslipIdentity":{"anyOf":[{"type":"object","properties":{"employeeRef":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"payee":{"anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits — never the full number."}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"leave":{"anyOf":[{"type":"object","properties":{"basis":{"type":"string","enum":["STATUTORY","COMPANY_POLICY"]},"asAt":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"balance":{"type":"number"}},"required":["label","balance"],"additionalProperties":false}}},"required":["basis","asAt","rows"],"additionalProperties":false},{"type":"null"}]}},"required":["employeeRef","role","payee","leave"],"additionalProperties":false},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"organization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","documentDesignProfile"],"additionalProperties":false},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","phone","address","country","registrationNumber"],"additionalProperties":false},{"type":"null"}]},"bankAccount":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"fileName":{"type":"string"},"fileType":{"type":"string"},"evidenceKind":{"type":"string","enum":["SUPPORTING","OFFICIAL_DOCUMENT","INLINE_OFFICIAL_CONTENT"]}},"required":["id","fileName","fileType","evidenceKind"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","customerId","bankAccountId","invoiceNumber","documentType","status","direction","inDispute","cancelled","cancellationDocumentId","cancellationNumber","cancelsDocumentId","currency","exchangeRate","issueDate","dueDate","payUntil","recognitionStart","recognitionEnd","paymentMethod","paymentDate","receiptNumber","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","renderProfileSnapshot","vatAllocationNumber","countrySpecificData","items","organization","customer","bankAccount","createdBy","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/invoice-detail"},"ui/resourceUri":"ui://guliel/invoice-detail","openai/outputTemplate":"ui://guliel/invoice-detail"}},{"name":"invoices_invoice_create","title":"Create an invoice from a customer order","description":"Supplier side: turns an APPROVED purchase order that a customer placed with the caller's organization (id) into an invoice document addressed to that customer. Returns { invoice, redirectUrl }.\n\n(Scope: invoices:write · requires CONTRIBUTOR+ · endpoint: POST /api/orders/{id}/invoice)","http":{"method":"POST","path":"/api/orders/{id}/invoice"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"invoice":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The freshly-created invoice. See /api/documents/[id] GET for the canonical shape."},"redirectUrl":{"type":"string","description":"Path the UI should navigate to so the user can edit the new invoice."}},"required":["invoice","redirectUrl"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_israel_list","title":"Look up an Israeli exchange rate","description":"Returns a Bank of Israel representative rate in ILS per unit of the selected currency, together with its published observation date when available.\n\n(Scope: invoices:read · endpoint: GET /api/exchange-rates/israel)","http":{"method":"GET","path":"/api/exchange-rates/israel"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["organizationId","currency","date"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"quote":{"anyOf":[{"type":"object","properties":{"currency":{"type":"string"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","const":"Bank of Israel"}},"required":["currency","rate","date","source"],"additionalProperties":false},{"type":"null"}]}},"required":["quote"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"invoices_list","title":"List invoices and receipts","description":"List an organization's documents (invoices & receipts), newest first. Returns ONE page — default 25 rows, max 100 via `limit` — and renders as an interactive widget that pages in place. Fetch a single page and let the user page within the widget; do not call this repeatedly to walk every page unless they explicitly ask to export or total the entire list.","http":{"method":"GET","path":"/api/documents"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":25,"type":"integer","minimum":1,"maximum":100},"status":{"type":"string","enum":["DRAFT","UNSENT","SENT","PAID"]},"documentType":{"type":"string"},"search":{"default":"","type":"string"},"customerId":{"type":"string"},"disputed":{"type":"string","enum":["true","false"]},"cancelled":{"type":"string","enum":["true","false"]},"sortBy":{"default":"issueDate","type":"string","enum":["issueDate","dueDate","total","status","documentNumber","customerName"]},"sortOrder":{"default":"desc","type":"string","enum":["asc","desc"]}},"required":["organizationId","page","limit","search","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"documentType":{"type":"string"},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancellationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"family":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentType":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"cancelled":{"type":"boolean"},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","documentType","invoiceNumber","total","cancelled","relatedDocumentId"],"additionalProperties":false}},"issueDate":{"type":"string"},"invoiceDate":{"type":"string","description":"Legacy alias for issueDate."},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"subtotal":{"type":"number"},"taxRate":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"allocationPending":{"type":"boolean"},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]}},"required":["id","name","email","country","preferredDocumentLanguage"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"}},"required":["id","description","quantity","unitPrice","amount"],"additionalProperties":false}},"payments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"attachments":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["id","organizationId","customerId","documentType","invoiceNumber","status","inDispute","cancelled","cancellationDocumentId","cancellationNumber","cancelsDocumentId","relatedDocumentId","family","issueDate","invoiceDate","dueDate","recognitionStart","recognitionEnd","currency","exchangeRate","subtotal","taxRate","taxAmount","total","paidAmount","notes","vatAllocationNumber","allocationPending","countrySpecificData","renderProfileSnapshot","createdAt","updatedAt","customer","items","createdBy"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["invoices","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/documents-list"},"ui/resourceUri":"ui://guliel/documents-list","openai/outputTemplate":"ui://guliel/documents-list"}},{"name":"invoices_manual_allocation_create","title":"Enter a manual allocation number","description":"Records a tax-authority allocation number (at least 9 digits) on a document when it was obtained outside Guliel. Does not contact the authority. Returns { success, allocationNumber }.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/manual-allocation)","http":{"method":"POST","path":"/api/documents/{id}/manual-allocation"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"allocationNumber":{"type":"string","minLength":9}},"required":["id","allocationNumber"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"allocationNumber":{"type":"string","description":"Digits-only allocation number after stripping non-digit characters."}},"required":["success","allocationNumber"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"invoices_mark_paid_create","title":"Mark a document as paid","description":"Marks a document as paid in full on paymentDate by paymentMethod, optionally generating a receipt (generateReceipt, generateTaxFreeReceipt) and emailing it (sendReceiptEmail). For an Israeli foreign-currency receipt supply receiptExchangeRate.exchangeRate, the payment-date ILS per unit received. It records the payment in the books; no money is moved. Returns the updated document.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/mark-paid)","http":{"method":"POST","path":"/api/documents/{id}/mark-paid"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"paymentDate":{"type":"string"},"paymentMethod":{"type":"string"},"receiptExchangeRate":{"type":"object","properties":{"exchangeRate":{"type":"number","exclusiveMinimum":0,"description":"ILS per unit of payable foreign currency"},"exchangeRateDate":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"exchangeRateSource":{"type":"string","minLength":1,"maxLength":128}},"required":["exchangeRate"],"additionalProperties":false},"generateReceipt":{"type":"boolean"},"generateTaxFreeReceipt":{"type":"boolean"},"sendReceiptEmail":{"default":false,"type":"boolean"}},"required":["id","paymentDate","paymentMethod","sendReceiptEmail"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated invoice row plus `receiptNumber`, `emailsSent`, `emailsFailed` counts. See /api/documents/[id] GET for the canonical invoice shape."},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_payments_create","title":"Record a payment on a document","description":"Records a (possibly partial) payment against a document: amount, paidAt and optional method; can generate a receipt and email it to additional recipients. For an Israeli foreign-currency receipt supply receiptExchangeRate.exchangeRate, the payment-date ILS per unit received. It records a payment that already happened; no money is moved. Returns { payment, receipt, emailsSent, emailsFailed }.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/payments)","http":{"method":"POST","path":"/api/documents/{id}/payments"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptExchangeRate":{"type":"object","properties":{"exchangeRate":{"type":"number","exclusiveMinimum":0,"description":"ILS per unit of payable foreign currency"},"exchangeRateDate":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"exchangeRateSource":{"type":"string","minLength":1,"maxLength":128}},"required":["exchangeRate"],"additionalProperties":false},"generateReceipt":{"default":true,"type":"boolean"},"sendReceiptEmail":{"default":false,"type":"boolean"},"additionalEmails":{"maxItems":20,"type":"array","items":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}}},"required":["id","amount","paidAt","generateReceipt","sendReceiptEmail"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"payment":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"amount":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"allocations":{"type":"array","items":{"type":"object","properties":{"lineId":{"type":"string"},"amount":{"type":"number"}},"required":["lineId","amount"],"additionalProperties":false}},"unallocated":{"type":"number"},"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"paidAmount":{"type":"number"},"total":{"type":"number"}},"required":["id","status","paidAmount","total"],"additionalProperties":false}},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","amount","paidAt","method","allocations","unallocated","documents","receiptNumber","receiptDocumentId"],"additionalProperties":false},"sourceDocument":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentNumber":{"type":"string"},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"issueDate":{"type":"string"},"paymentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","invoiceNumber","total","issueDate","paymentId","paymentDate","paymentMethod","cancelled","cancellationDocumentId"],"additionalProperties":false}},"subtotal":{"type":"number"},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method","documentId"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"organization":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","phone","address","country","registrationNumber"],"additionalProperties":false},{"type":"null"}]},"bankAccount":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","customerId","bankAccountId","invoiceNumber","documentNumber","documentType","status","direction","inDispute","cancelled","cancellationDocumentId","cancelsDocumentId","currency","exchangeRate","vatAllocationNumber","issueDate","dueDate","payUntil","recognitionStart","recognitionEnd","paymentMethod","paymentDate","receiptNumber","receipts","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","renderProfileSnapshot","countrySpecificData","items","organization","customer","bankAccount","createdBy","createdAt","updatedAt"],"additionalProperties":false},"receipt":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentNumber":{"type":"string"},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"issueDate":{"type":"string"},"paymentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","invoiceNumber","total","issueDate","paymentId","paymentDate","paymentMethod","cancelled","cancellationDocumentId"],"additionalProperties":false}},"subtotal":{"type":"number"},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method","documentId"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"organization":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","phone","address","country","registrationNumber"],"additionalProperties":false},{"type":"null"}]},"bankAccount":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","customerId","bankAccountId","invoiceNumber","documentNumber","documentType","status","direction","inDispute","cancelled","cancellationDocumentId","cancelsDocumentId","currency","exchangeRate","vatAllocationNumber","issueDate","dueDate","payUntil","recognitionStart","recognitionEnd","paymentMethod","paymentDate","receiptNumber","receipts","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","renderProfileSnapshot","countrySpecificData","items","organization","customer","bankAccount","createdBy","createdAt","updatedAt"],"additionalProperties":false},{"type":"null"}]},"emailsSent":{"type":"number"},"emailsFailed":{"type":"number"}},"required":["payment","sourceDocument","receipt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_pdf_get","title":"Download an issued document PDF","description":"Download the PDF that email delivery would render for an issued outgoing document. Pass language for a translated copy. This is a read-only operation.","http":{"method":"GET","path":"/api/documents/{id}/pdf"},"feature":"invoices","verb":"read","scope":"invoices:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"language":{"type":"string","enum":["english","hebrew","thai"]},"download":{"type":"string","enum":["true","false"]}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"invoices_replace","title":"Replace a document","description":"Overwrites the supplied fields of a document (customer, currency, items, totals, dates, notes, payment details). Issued documents are largely immutable and most edits are refused; cancel and reissue instead. Omitted fields keep their value. Returns the document.\n\n(Scope: invoices:write · endpoint: PUT /api/documents/{id})","http":{"method":"PUT","path":"/api/documents/{id}"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string","minLength":1},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"status":{"type":"string","enum":["DRAFT","UNSENT","SENT","PAID"]},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST"]},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string","minLength":1},"quantity":{"type":"number","minimum":0},"unitPrice":{"type":"number","minimum":0},"amount":{"type":"number"}},"required":["id","description","quantity","unitPrice","amount"],"additionalProperties":false}},"subtotal":{"type":"number"},"taxRate":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"clearReceiptInfo":{"type":"boolean"},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"receiptSettlement":{"anyOf":[{"type":"object","properties":{"sourceDocumentId":{"type":"string"},"sourceDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["allocations","invoice-reference"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceLineItemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"lineType":{"type":"string"},"allocated":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","sourceLineItemId","description","lineType","allocated"],"additionalProperties":false}}},"required":["sourceDocumentId","sourceDocumentNumber","basis","lines"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancellationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"family":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentType":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"cancelled":{"type":"boolean"},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","documentType","invoiceNumber","total","cancelled","relatedDocumentId"],"additionalProperties":false}},"currency":{"type":"string"},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"issueDate":{"type":"string"},"paymentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","invoiceNumber","total","issueDate","paymentId","paymentDate","paymentMethod","cancelled","cancellationDocumentId"],"additionalProperties":false}},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedDocument":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"}},"required":["id","invoiceNumber","documentType"],"additionalProperties":false},{"type":"null"}]},"receiptEmailRecipients":{"type":"array","items":{"type":"string"}},"subtotal":{"type":"number"},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method","documentId"],"additionalProperties":false}},"payslipIdentity":{"anyOf":[{"type":"object","properties":{"employeeRef":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"payee":{"anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits — never the full number."}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"leave":{"anyOf":[{"type":"object","properties":{"basis":{"type":"string","enum":["STATUTORY","COMPANY_POLICY"]},"asAt":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"balance":{"type":"number"}},"required":["label","balance"],"additionalProperties":false}}},"required":["basis","asAt","rows"],"additionalProperties":false},{"type":"null"}]}},"required":["employeeRef","role","payee","leave"],"additionalProperties":false},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"organization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","documentDesignProfile"],"additionalProperties":false},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","phone","address","country","registrationNumber"],"additionalProperties":false},{"type":"null"}]},"bankAccount":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"fileName":{"type":"string"},"fileType":{"type":"string"},"evidenceKind":{"type":"string","enum":["SUPPORTING","OFFICIAL_DOCUMENT","INLINE_OFFICIAL_CONTENT"]}},"required":["id","fileName","fileType","evidenceKind"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"clearance":{"description":"Present only when a clearance flow applies to this document (spec §7.3).","type":"object","properties":{"required":{"type":"boolean"},"status":{"type":"string","description":"APPROVED | PENDING | ERROR | REJECTED | MANUAL | NOT_REQUIRED"},"reason":{"description":"\"reconnect_required\" | \"held\" | an ITA error code","type":"string"},"details":{"type":"array","items":{"type":"string"}},"allocationNumber":{"type":"string"},"stale":{"type":"boolean"}},"required":["required","status"],"additionalProperties":false}},"required":["id","organizationId","customerId","bankAccountId","invoiceNumber","documentType","status","direction","inDispute","currency","exchangeRate","issueDate","dueDate","payUntil","recognitionStart","recognitionEnd","paymentMethod","paymentDate","receiptNumber","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","renderProfileSnapshot","vatAllocationNumber","countrySpecificData","items","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":true}},{"name":"invoices_send_create","title":"Email a document","description":"Renders the document as a PDF in its issued language and emails it to the selected recipients. Set `language` to send a supported translation and `recipients` to select saved customer addresses. A successful delivery marks the document as sent. Returns { sent, failed, totalRecipients }.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/send)","http":{"method":"POST","path":"/api/documents/{id}/send"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"language":{"description":"PDF language for this copy. Omit to use the document language.","type":"string","enum":["english","hebrew","thai"]},"recipients":{"description":"Subset of the customer's deliverable addresses to send to (party email + saved recipients). Omit to send to all. Unknown addresses are rejected.","type":"array","items":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalRecipients":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["success","sent","failed","totalRecipients"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"invoices_update","title":"Update a document","description":"Edits the supplied fields of a document (customer, currency, items, totals, dates, notes, payment details). Issued documents are largely immutable and most edits are refused; cancel and reissue instead. Omitted fields keep their value. Returns the document.\n\n(Scope: invoices:write · endpoint: PATCH /api/documents/{id})","http":{"method":"PATCH","path":"/api/documents/{id}"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string","minLength":1},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"status":{"type":"string","enum":["DRAFT","UNSENT","SENT","PAID"]},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST"]},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string","minLength":1},"quantity":{"type":"number","minimum":0},"unitPrice":{"type":"number","minimum":0},"amount":{"type":"number"}},"required":["id","description","quantity","unitPrice","amount"],"additionalProperties":false}},"subtotal":{"type":"number"},"taxRate":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"clearReceiptInfo":{"type":"boolean"},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"receiptSettlement":{"anyOf":[{"type":"object","properties":{"sourceDocumentId":{"type":"string"},"sourceDocumentNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"basis":{"type":"string","enum":["allocations","invoice-reference"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceLineItemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"lineType":{"type":"string"},"allocated":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","sourceLineItemId","description","lineType","allocated"],"additionalProperties":false}}},"required":["sourceDocumentId","sourceDocumentNumber","basis","lines"],"additionalProperties":false},{"type":"null"}]},"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancellationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelsDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"family":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentType":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"cancelled":{"type":"boolean"},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","documentType","invoiceNumber","total","cancelled","relatedDocumentId"],"additionalProperties":false}},"currency":{"type":"string"},"documentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionStart":{"anyOf":[{"type":"string"},{"type":"null"}]},"recognitionEnd":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"issueDate":{"type":"string"},"paymentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","invoiceNumber","total","issueDate","paymentId","paymentDate","paymentMethod","cancelled","cancellationDocumentId"],"additionalProperties":false}},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedDocument":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"}},"required":["id","invoiceNumber","documentType"],"additionalProperties":false},{"type":"null"}]},"receiptEmailRecipients":{"type":"array","items":{"type":"string"}},"subtotal":{"type":"number"},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method","documentId"],"additionalProperties":false}},"payslipIdentity":{"anyOf":[{"type":"object","properties":{"employeeRef":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"payee":{"anyOf":[{"type":"object","properties":{"bankName":{"type":"string"},"accountMasked":{"type":"string","description":"\"••••\" + the last 4 digits — never the full number."}},"required":["bankName","accountMasked"],"additionalProperties":false},{"type":"null"}]},"leave":{"anyOf":[{"type":"object","properties":{"basis":{"type":"string","enum":["STATUTORY","COMPANY_POLICY"]},"asAt":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"balance":{"type":"number"}},"required":["label","balance"],"additionalProperties":false}}},"required":["basis","asAt","rows"],"additionalProperties":false},{"type":"null"}]}},"required":["employeeRef","role","payee","leave"],"additionalProperties":false},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"renderProfileSnapshot":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"organization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","documentDesignProfile"],"additionalProperties":false},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferredDocumentLanguage":{"anyOf":[{"type":"string","enum":["english","hebrew","thai"]},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","phone","address","country","registrationNumber"],"additionalProperties":false},{"type":"null"}]},"bankAccount":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"fileName":{"type":"string"},"fileType":{"type":"string"},"evidenceKind":{"type":"string","enum":["SUPPORTING","OFFICIAL_DOCUMENT","INLINE_OFFICIAL_CONTENT"]}},"required":["id","fileName","fileType","evidenceKind"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"clearance":{"description":"Present only when a clearance flow applies to this document (spec §7.3).","type":"object","properties":{"required":{"type":"boolean"},"status":{"type":"string","description":"APPROVED | PENDING | ERROR | REJECTED | MANUAL | NOT_REQUIRED"},"reason":{"description":"\"reconnect_required\" | \"held\" | an ITA error code","type":"string"},"details":{"type":"array","items":{"type":"string"}},"allocationNumber":{"type":"string"},"stale":{"type":"boolean"}},"required":["required","status"],"additionalProperties":false}},"required":["id","organizationId","customerId","bankAccountId","invoiceNumber","documentType","status","direction","inDispute","currency","exchangeRate","issueDate","dueDate","payUntil","recognitionStart","recognitionEnd","paymentMethod","paymentDate","receiptNumber","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","renderProfileSnapshot","vatAllocationNumber","countrySpecificData","items","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":true}},{"name":"invoices_void_create","title":"Void an invoice","description":"Voids an issued, unpaid outgoing document: its status becomes REJECTED, but the row, official number and audit trail are kept. Paid documents must have their payments reversed first. Cannot be undone. Requires MANAGER. Returns { status }.\n\n(Scope: invoices:write · endpoint: POST /api/documents/{id}/void)","http":{"method":"POST","path":"/api/documents/{id}/void"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"logistics_create","title":"Create an inventory item","description":"Adds an inventory item. Inputs: name and currency, plus optional sku, description, unit price, opening quantity, low-stock threshold and whether suppliers' customers can order it externally. Returns the item.\n\n(Scope: logistics:write · requires CONTRIBUTOR+ · endpoint: POST /api/items)","http":{"method":"POST","path":"/api/items"},"feature":"logistics","verb":"write","scope":"logistics:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sku":{"type":"string"},"unitPrice":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"default":"USD","type":"string"},"quantity":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"lowStockThreshold":{"default":5,"type":"integer","minimum":0,"maximum":9007199254740991},"availableForExternalOrder":{"default":false,"type":"boolean"}},"required":["organizationId","name","currency","lowStockThreshold","availableForExternalOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Unit price in `currency`; null when the item has no default price."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Stock on hand. Null means the item is not stock-tracked."},"lowStockThreshold":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","sku","unitPrice","currency","quantity","lowStockThreshold","isActive","availableForExternalOrder","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"logistics_delete","title":"Deactivate an inventory item","description":"Soft-deletes an inventory item by id: it is marked inactive and disappears from active lists, while its stock history and past documents stay intact. Requires MANAGER. Returns { success }.\n\n(Scope: logistics:write · endpoint: DELETE /api/items/{id})","http":{"method":"DELETE","path":"/api/items/{id}"},"feature":"logistics","verb":"write","scope":"logistics:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"logistics_get","title":"Get an inventory item","description":"Returns one inventory item by id: sku, unit price, currency, quantity on hand, low-stock threshold and active flag.\n\n(Scope: logistics:read · endpoint: GET /api/items/{id})","http":{"method":"GET","path":"/api/items/{id}"},"feature":"logistics","verb":"read","scope":"logistics:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"lowStockThreshold":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","sku","unitPrice","currency","quantity","lowStockThreshold","isActive","availableForExternalOrder","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"logistics_list","title":"List inventory items","description":"List an organization's inventory items with stock levels and low-stock flags. Returns ONE page — default 25 rows, max 100 via `limit` — and renders as an interactive widget that pages in place. Fetch a single page and let the user page within the widget; do not call this repeatedly to walk every page unless they explicitly ask to export or total the entire list.","http":{"method":"GET","path":"/api/items"},"feature":"logistics","verb":"read","scope":"logistics:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":25,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"},"isActive":{"type":"string"},"hasStock":{"type":"string"},"currency":{"type":"string"},"sortBy":{"default":"name","type":"string","enum":["name","sku","unitPrice","quantity","createdAt","updatedAt"]},"sortOrder":{"default":"asc","type":"string","enum":["asc","desc"]}},"required":["organizationId","page","limit","search","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Unit price in `currency`; null when the item has no default price."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Stock on hand. Null means the item is not stock-tracked."},"lowStockThreshold":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","sku","unitPrice","currency","quantity","lowStockThreshold","isActive","availableForExternalOrder","createdAt","updatedAt"],"additionalProperties":false}},"lowStockCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How many active stock-tracked items are at or below their lowStockThreshold."},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["items","lowStockCount","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/inventory"},"ui/resourceUri":"ui://guliel/inventory","openai/outputTemplate":"ui://guliel/inventory"}},{"name":"logistics_movements_list","title":"List stock movements","description":"Lists the stock movement history of one inventory item (additions, adjustments, sales) with paging. Returns { movements, pagination }.\n\n(Scope: logistics:read · endpoint: GET /api/items/{id}/movements)","http":{"method":"GET","path":"/api/items/{id}/movements"},"feature":"logistics","verb":"read","scope":"logistics:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":20,"type":"integer","minimum":1,"maximum":100}},"required":["id","page","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"movements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"type":"string"},"type":{"type":"string","description":"INVOICE_DEDUCT | INVOICE_RESTORE | MANUAL_ADD | MANUAL_SET | RECEIPT | etc."},"delta":{"type":"number"},"quantityBefore":{"type":"number"},"quantityAfter":{"type":"number"},"referenceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdById":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","itemId","type","delta","quantityBefore","quantityAfter","referenceId","createdById","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["movements","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"logistics_replace","title":"Replace an inventory item","description":"Overwrites the supplied fields of an inventory item (name, sku, price, currency, threshold, active, external-order flag). Quantity changes go through logistics_stock_create. Returns the item.\n\n(Scope: logistics:write · endpoint: PUT /api/items/{id})","http":{"method":"PUT","path":"/api/items/{id}"},"feature":"logistics","verb":"write","scope":"logistics:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string"},"lowStockThreshold":{"type":"integer","minimum":0,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"lowStockThreshold":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","sku","unitPrice","currency","quantity","lowStockThreshold","isActive","availableForExternalOrder","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"logistics_stock_create","title":"Adjust stock","description":"Adjusts an item's quantity on hand: pass `add` (positive or negative change) or `set` (new absolute quantity) and an optional note. Logs a stock movement. Returns the updated item.\n\n(Scope: logistics:write · endpoint: POST /api/items/{id}/stock)","http":{"method":"POST","path":"/api/items/{id}/stock"},"feature":"logistics","verb":"write","scope":"logistics:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"add":{"type":"number","exclusiveMinimum":0},"set":{"type":"number","minimum":0},"note":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated item row with the new `quantity`. See /api/items/[id] GET for the canonical shape."},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"logistics_update","title":"Update an inventory item","description":"Edits the supplied fields of an inventory item (name, sku, price, currency, threshold, active, external-order flag); omitted fields keep their value. Returns the item.\n\n(Scope: logistics:write · endpoint: PATCH /api/items/{id})","http":{"method":"PATCH","path":"/api/items/{id}"},"feature":"logistics","verb":"write","scope":"logistics:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string"},"lowStockThreshold":{"type":"integer","minimum":0,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"lowStockThreshold":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","sku","unitPrice","currency","quantity","lowStockThreshold","isActive","availableForExternalOrder","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"notifications_delete","title":"Delete a notification","description":"Deletes one of the caller's notifications by id. Returns { id, deleted }.\n\n(Scope: users:write · endpoint: DELETE /api/notifications/{id})","http":{"method":"DELETE","path":"/api/notifications/{id}"},"feature":"users","verb":"write","scope":"users:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["id","deleted"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"notifications_list","title":"List notifications","description":"Lists the caller's notifications, filtered by status (unread or read) and type, up to `limit`. Returns { notifications, unreadCount, unreadCountsByOrg }.\n\n(Scope: users:read · endpoint: GET /api/notifications)","http":{"method":"GET","path":"/api/notifications"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"status":{"type":"string","enum":["UNREAD","READ","ARCHIVED"]},"type":{"type":"string"},"organizationId":{"type":"string","minLength":1},"limit":{"default":50,"type":"integer","minimum":1,"maximum":100}},"required":["limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"organizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"status":{"type":"string","description":"UNREAD | READ | ARCHIVED"},"actionUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedType":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedId":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{},{"type":"null"}]},"createdAt":{"type":"string"},"readAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","userId","organizationId","type","title","message","status","actionUrl","relatedType","relatedId","metadata","createdAt","readAt"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unreadCountsByOrg":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"description":"Per-org unread counts. The key `_null` holds notifications without an org (global)."}},"required":["notifications","unreadCount","unreadCountsByOrg"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"notifications_update","title":"Mark a notification read or unread","description":"Sets one notification's status (read or unread) by id. Returns the notification.\n\n(Scope: users:write · endpoint: PATCH /api/notifications/{id})","http":{"method":"PATCH","path":"/api/notifications/{id}"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["READ","ARCHIVED"]}},"required":["id","status"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"organizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"actionUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedType":{"anyOf":[{"type":"string"},{"type":"null"}]},"relatedId":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{},{"type":"null"}]},"createdAt":{"type":"string"},"readAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","userId","organizationId","type","title","message","status","actionUrl","relatedType","relatedId","metadata","createdAt","readAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"orders_create","title":"Create a purchase order","description":"Creates a purchase order to a supplier. Inputs: supplierId, currency, items (optional item id, description, quantity, unit price), optional notes and expectedDate. The order is created in SENT status; a supplier that is a Guliel organization gets an in-app notification, and an email supplier is emailed. Returns the order.\n\n(Scope: orders:write · requires CONTRIBUTOR+ · endpoint: POST /api/orders)","http":{"method":"POST","path":"/api/orders"},"feature":"orders","verb":"write","scope":"orders:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"supplierId":{"type":"string","minLength":1},"currency":{"type":"string","minLength":1},"notes":{"type":"string"},"expectedDate":{"type":"string"},"items":{"minItems":1,"type":"array","items":{"type":"object","properties":{"itemId":{"type":"string"},"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}}},"required":["organizationId","supplierId","currency","items"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"supplierId":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string","description":"DRAFT | SENT | APPROVED | INVOICED | REJECTED | PAID"},"currency":{"type":"string"},"subtotal":{"type":"number"},"totalAmount":{"type":"number"},"orderDate":{"type":"string"},"expectedDeliveryDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","supplierOrganizationId"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","orderNumber","status","currency","subtotal","totalAmount","orderDate","expectedDeliveryDate","notes","supplier","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"orders_delete","title":"Cancel a purchase order","description":"Cancels and deletes a purchase order by id. Only an order still in SENT status can be cancelled; once the supplier has approved or rejected it the call is refused. Returns { success }.\n\n(Scope: orders:write · endpoint: DELETE /api/orders/{id})","http":{"method":"DELETE","path":"/api/orders/{id}"},"feature":"orders","verb":"write","scope":"orders:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"orders_get","title":"Get a purchase order","description":"Returns one purchase order by id with supplier, items, totals, status and the invoices and expense linked to it.\n\n(Scope: orders:read · endpoint: GET /api/orders/{id})","http":{"method":"GET","path":"/api/orders/{id}"},"feature":"orders","verb":"read","scope":"orders:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"supplierId":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"subtotal":{"type":"number"},"totalAmount":{"type":"number"},"orderDate":{"type":"string"},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","email","status","supplierOrganization"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"},"item":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","sku"],"additionalProperties":false},{"type":"null"}]}},"required":["id","itemId","description","quantity","unitPrice","amount","item"],"additionalProperties":false}},"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"type":"string"},"status":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string"}},"required":["id","invoiceNumber","status","total","currency"],"additionalProperties":false}},"expense":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"}},"required":["id","status","amount","currency"],"additionalProperties":false},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","orderNumber","status","currency","subtotal","totalAmount","orderDate","expectedDate","notes","supplier","items","invoices","expense","createdBy","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"orders_list","title":"List purchase orders","description":"Lists the organization's purchase orders with paging, search, status and supplier filters and sorting. Returns { orders, pagination }.\n\n(Scope: orders:read · endpoint: GET /api/orders)","http":{"method":"GET","path":"/api/orders"},"feature":"orders","verb":"read","scope":"orders:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":20,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"},"status":{"type":"string"},"supplierId":{"type":"string"},"sortBy":{"default":"createdAt","type":"string","enum":["orderNumber","orderDate","subtotal","status","createdAt"]},"sortOrder":{"default":"desc","type":"string","enum":["asc","desc"]}},"required":["organizationId","page","limit","search","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"supplierId":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string","description":"DRAFT | SENT | APPROVED | INVOICED | REJECTED | PAID"},"currency":{"type":"string"},"subtotal":{"type":"number"},"totalAmount":{"type":"number"},"orderDate":{"type":"string"},"expectedDeliveryDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","supplierOrganizationId"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","orderNumber","status","currency","subtotal","totalAmount","orderDate","expectedDeliveryDate","notes","supplier","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["orders","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"orders_replace","title":"Replace a purchase order","description":"Overwrites the currency, notes, expected date and/or items of a purchase order. Only an order still in SENT status can be edited. Omitted fields keep their value. Returns the order.\n\n(Scope: orders:write · endpoint: PUT /api/orders/{id})","http":{"method":"PUT","path":"/api/orders/{id}"},"feature":"orders","verb":"write","scope":"orders:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"currency":{"type":"string","minLength":1},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"minItems":1,"type":"array","items":{"type":"object","properties":{"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"supplierId":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"subtotal":{"type":"number"},"totalAmount":{"type":"number"},"orderDate":{"type":"string"},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","email","status","supplierOrganization"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"},"item":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","sku"],"additionalProperties":false},{"type":"null"}]}},"required":["id","itemId","description","quantity","unitPrice","amount","item"],"additionalProperties":false}},"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"type":"string"},"status":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string"}},"required":["id","invoiceNumber","status","total","currency"],"additionalProperties":false}},"expense":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"}},"required":["id","status","amount","currency"],"additionalProperties":false},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","orderNumber","status","currency","subtotal","totalAmount","orderDate","expectedDate","notes","supplier","items","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"orders_status_create","title":"Approve or reject a customer order","description":"Supplier side: approves or rejects (status APPROVED or REJECTED, optional note) a purchase order that another Guliel organization placed with the caller's organization. Authorized against the supplier's organization, not the buyer's. Returns the updated order.\n\n(Scope: orders:write · requires CONTRIBUTOR+ · endpoint: POST /api/orders/{id}/status)","http":{"method":"POST","path":"/api/orders/{id}/status"},"feature":"orders","verb":"write","scope":"orders:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["APPROVED","REJECTED"]},"note":{"type":"string"}},"required":["id","status"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated order row with relations rebuilt — see /api/orders/[id] GET for the canonical shape."},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"orders_update","title":"Update a purchase order","description":"Edits the currency, notes, expected date and/or items of a purchase order that is still in SENT status; omitted fields keep their value. Returns the order.\n\n(Scope: orders:write · endpoint: PATCH /api/orders/{id})","http":{"method":"PATCH","path":"/api/orders/{id}"},"feature":"orders","verb":"write","scope":"orders:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"currency":{"type":"string","minLength":1},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"minItems":1,"type":"array","items":{"type":"object","properties":{"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"supplierId":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"subtotal":{"type":"number"},"totalAmount":{"type":"number"},"orderDate":{"type":"string"},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","email","status","supplierOrganization"],"additionalProperties":false},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"},"item":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","sku"],"additionalProperties":false},{"type":"null"}]}},"required":["id","itemId","description","quantity","unitPrice","amount","item"],"additionalProperties":false}},"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"type":"string"},"status":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string"}},"required":["id","invoiceNumber","status","total","currency"],"additionalProperties":false}},"expense":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"}},"required":["id","status","amount","currency"],"additionalProperties":false},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","orderNumber","status","currency","subtotal","totalAmount","orderDate","expectedDate","notes","supplier","items","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_create","title":"Create an organization","description":"Creates a new organization (tenant) with the caller as its manager. Inputs: name, country, registrationNumber, optional address, country-specific data and document design profile. Returns the organization.\n\n(Scope: organizations:write · endpoint: POST /api/organizations)","http":{"method":"POST","path":"/api/organizations"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"country":{"type":"string","enum":["ISRAEL","SINGAPORE","USA","GERMANY","NETHERLANDS","SWEDEN","AUSTRIA","FINLAND","DENMARK","SPAIN","SLOVAKIA","IRELAND","LUXEMBOURG","CYPRUS","MALTA","SLOVENIA","CZECH_REPUBLIC","LITHUANIA","LATVIA","ESTONIA","NORWAY","ICELAND","UNITED_KINGDOM","SWITZERLAND","CANADA","AUSTRALIA","NEW_ZEALAND","UAE","BAHRAIN","OMAN","QATAR","KUWAIT","JAPAN","HONG_KONG","TAIWAN","THAILAND","INDONESIA","SOUTH_AFRICA","NIGERIA"]},"registrationNumber":{"type":"string","minLength":1},"address":{"type":"string"},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"documentDesignProfile":{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false}},"required":["name","country","registrationNumber"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]},"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"userId":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false}},"required":["id","role","userId","user"],"additionalProperties":false}},"_count":{"type":"object","properties":{"counterpartiesOwning":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["counterpartiesOwning","invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","documentDesignProfile","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"organizations_get","title":"Get an organization","description":"Returns one organization by id: name, country, registration number, address, timezone, country-specific data, document design profile, members and counts.\n\n(Scope: organizations:read · endpoint: GET /api/organizations/{id})","http":{"method":"GET","path":"/api/organizations/{id}"},"feature":"organizations","verb":"read","scope":"organizations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]},"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false}},"required":["id","userId","role","user"],"additionalProperties":false}},"_count":{"type":"object","properties":{"counterpartiesOwning":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["counterpartiesOwning","invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","timezone","documentDesignProfile","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_icon_create","title":"Upload an organization logo","description":"Uploads the organization's logo image (file). Requires MANAGER. Returns { success, icon }.\n\n(Scope: organizations:write · requires MANAGER+ · endpoint: POST /api/organizations/{id}/icon)","http":{"method":"POST","path":"/api/organizations/{id}/icon"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"file":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"icon":{"type":"string","description":"Same-origin URL where the freshly-uploaded icon can be fetched."}},"required":["success","icon"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"organizations_icon_delete","title":"Remove an organization logo","description":"Removes the organization's logo. Requires MANAGER. Returns { success }.\n\n(Scope: organizations:write · requires MANAGER+ · endpoint: DELETE /api/organizations/{id}/icon)","http":{"method":"DELETE","path":"/api/organizations/{id}/icon"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_icon_list","title":"Get an organization logo","description":"Streams the organization's logo image. Returns the image file, not JSON.\n\n(Scope: organizations:read · endpoint: GET /api/organizations/{id}/icon)","http":{"method":"GET","path":"/api/organizations/{id}/icon"},"feature":"organizations","verb":"read","scope":"organizations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_list","title":"List organizations","description":"Lists the organizations the caller can access, with paging and name search. Returns { organizations, pagination }.\n\n(Scope: organizations:read · endpoint: GET /api/organizations)","http":{"method":"GET","path":"/api/organizations"},"feature":"organizations","verb":"read","scope":"organizations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":10,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"}},"required":["page","limit","search"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"organizations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]},"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"userId":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false}},"required":["id","role","userId","user"],"additionalProperties":false}},"_count":{"type":"object","properties":{"counterpartiesOwning":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["counterpartiesOwning","invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","documentDesignProfile","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["organizations","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_onboarding_list","title":"Get onboarding progress","description":"Returns the organization's setup checklist: each step (business details, payment details, tax authority) with its state, the current step and completion/dismissal times.\n\n(Scope: organizations:read · endpoint: GET /api/organizations/{id}/onboarding)","http":{"method":"GET","path":"/api/organizations/{id}/onboarding"},"feature":"organizations","verb":"read","scope":"organizations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"steps":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["business","payment","tax_authority"]},"status":{"type":"string","enum":["pending","done","skipped","unavailable"]}},"required":["key","status"],"additionalProperties":false}},"currentStep":{"anyOf":[{"type":"string","enum":["business","payment","tax_authority"]},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"dismissedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"notifyWhenAvailable":{"type":"array","items":{"type":"string"}}},"required":["steps","currentStep","completedAt","dismissedAt","notifyWhenAvailable"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_onboarding_update","title":"Update onboarding progress","description":"Applies an onboarding action to the setup checklist, such as skipping the payment or tax-authority step, dismissing the checklist or asking to be notified when a step becomes available. Returns the updated checklist.\n\n(Scope: organizations:write · requires CONTRIBUTOR+ · endpoint: PATCH /api/organizations/{id}/onboarding)","http":{"method":"PATCH","path":"/api/organizations/{id}/onboarding"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"skip"},"step":{"type":"string","enum":["payment","tax_authority"]}},"required":["type","step"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"unskip"},"step":{"type":"string","enum":["payment","tax_authority"]}},"required":["type","step"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"complete"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"dismissCard"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"setNotify"},"providerId":{"type":"string"},"on":{"type":"boolean"}},"required":["type","providerId","on"],"additionalProperties":false}]}},"required":["id","action"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"steps":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["business","payment","tax_authority"]},"status":{"type":"string","enum":["pending","done","skipped","unavailable"]}},"required":["key","status"],"additionalProperties":false}},"currentStep":{"anyOf":[{"type":"string","enum":["business","payment","tax_authority"]},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"dismissedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"notifyWhenAvailable":{"type":"array","items":{"type":"string"}}},"required":["steps","currentStep","completedAt","dismissedAt","notifyWhenAvailable"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_organizations_list","title":"List my organizations","description":"Lists the organizations the signed-in user belongs to with their role in each. Use it to find the organizationId other tools need. Returns an array.\n\n(Scope: organizations:read · endpoint: GET /api/user/organizations)","http":{"method":"GET","path":"/api/user/organizations"},"feature":"organizations","verb":"read","scope":"organizations:read","hasBody":false,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]},"role":{"type":"string","description":"Caller's role in this org — MANAGER | CONTRIBUTOR | VIEWER."},"selfServiceOnly":{"type":"boolean","description":"This membership is an employee self-service login (law 33): the caller reaches only their own records in this org. The shell reads it to render the employee surface instead of the org-wide one."}},"required":["id","name","country","icon","registrationNumber","address","countrySpecificData","documentDesignProfile","role","selfServiceOnly"],"additionalProperties":false}},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_replace","title":"Replace organization details","description":"Overwrites the supplied organization fields (name, registration number, address, timezone, country-specific data, document design profile). Omitted fields keep their value. Returns the organization.\n\n(Scope: organizations:write · endpoint: PUT /api/organizations/{id})","http":{"method":"PUT","path":"/api/organizations/{id}"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"registrationNumber":{"type":"string","minLength":1},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]},"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false}},"required":["id","userId","role","user"],"additionalProperties":false}},"_count":{"type":"object","properties":{"counterpartiesOwning":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["counterpartiesOwning","invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","timezone","documentDesignProfile","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_signature_create","title":"Upload a signature image","description":"Uploads the signature image (file) printed on the organization's documents. Requires MANAGER. Returns { success, profile }.\n\n(Scope: organizations:write · requires MANAGER+ · endpoint: POST /api/organizations/{id}/signature)","http":{"method":"POST","path":"/api/organizations/{id}/signature"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"file":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"profile":{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false}},"required":["success","profile"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"organizations_signature_delete","title":"Remove the signature image","description":"Removes the signature image from the organization's document design. Requires MANAGER. Returns { success, profile }.\n\n(Scope: organizations:write · requires MANAGER+ · endpoint: DELETE /api/organizations/{id}/signature)","http":{"method":"DELETE","path":"/api/organizations/{id}/signature"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"profile":{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false}},"required":["success","profile"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_signature_list","title":"Get the signature image","description":"Streams the organization's signature image (or a named asset). Returns the image file, not JSON.\n\n(Scope: organizations:read · endpoint: GET /api/organizations/{id}/signature)","http":{"method":"GET","path":"/api/organizations/{id}/signature"},"feature":"organizations","verb":"read","scope":"organizations:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"organizations_update","title":"Update organization details","description":"Edits the supplied organization fields (name, registration number, address, timezone, country-specific data, document design profile); omitted fields keep their value. Returns the organization.\n\n(Scope: organizations:write · endpoint: PATCH /api/organizations/{id})","http":{"method":"PATCH","path":"/api/organizations/{id}"},"feature":"organizations","verb":"write","scope":"organizations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"registrationNumber":{"type":"string","minLength":1},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentDesignProfile":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"default":1,"type":"number","const":1},"template":{"default":"minimal","type":"string","enum":["minimal","classic","bold","elegant","compact","tech"]},"accentColor":{"default":"#6A00FF","type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"showLogo":{"default":true,"type":"boolean"},"headerLayout":{"default":"left","type":"string","enum":["left","center","right"]},"tableStyle":{"default":"auto","type":"string","enum":["auto","lines","zebra","borderless"]},"background":{"default":"white","type":"string","enum":["white","tint","paper"]},"cornerRadius":{"default":8,"type":"integer","minimum":0,"maximum":20},"includePaymentPage":{"default":true,"type":"boolean"},"signatureUrl":{"default":null,"anyOf":[{"type":"string","maxLength":3145728},{"type":"null"}]}},"required":["schemaVersion","template","accentColor","showLogo","headerLayout","tableStyle","background","cornerRadius","includePaymentPage","signatureUrl"],"additionalProperties":false},{"type":"null"}]},"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false}},"required":["id","userId","role","user"],"additionalProperties":false}},"_count":{"type":"object","properties":{"counterpartiesOwning":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["counterpartiesOwning","invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData","timezone","documentDesignProfile","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"payments_create","title":"Record a customer payment","description":"Records a payment received from a customer: amount, paidAt and optional method, allocated across documents (documentIds for automatic allocation or explicit allocations). It records money that already arrived and moves none; it does not charge a card or bank account. Returns the payment with its allocations and any unallocated remainder.\n\n(Scope: payments:write · requires CONTRIBUTOR+ · endpoint: POST /api/payments)","http":{"method":"POST","path":"/api/payments"},"feature":"payments","verb":"write","scope":"payments:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentIds":{"minItems":1,"type":"array","items":{"type":"string"}},"allocations":{"minItems":1,"type":"array","items":{"type":"object","properties":{"lineId":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["lineId","amount"],"additionalProperties":false}},"allowUnallocated":{"type":"boolean"}},"required":["organizationId","amount","paidAt"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"amount":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"allocations":{"type":"array","items":{"type":"object","properties":{"lineId":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["lineId","amount"],"additionalProperties":false}},"unallocated":{"type":"number"},"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"paidAmount":{"type":"number"},"total":{"type":"number"}},"required":["id","status","paidAmount","total"],"additionalProperties":false}}},"required":["id","organizationId","amount","paidAt","method","allocations","unallocated","documents"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payments_delete","title":"Reverse a payment","description":"Reverses a recorded payment by id, restoring the open balance of the documents it was allocated to. Removes a bookkeeping entry only; no money moves. Returns { reversed, documentIds }.\n\n(Scope: payments:write · requires CONTRIBUTOR+ · endpoint: DELETE /api/payments/{id})","http":{"method":"DELETE","path":"/api/payments/{id}"},"feature":"payments","verb":"write","scope":"payments:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"reversed":{"type":"boolean"},"documentIds":{"type":"array","items":{"type":"string"},"description":"Documents whose settled status changed."}},"required":["reversed","documentIds"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"payroll_advance_create","title":"Record a salary advance","description":"Records a salary advance already given to an employee (counterpartyId): amount, paidAt and optional method. The advance becomes a receivable to be recovered from later payslips. It records the advance; no money is moved. Returns { paymentId }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/advance)","http":{"method":"POST","path":"/api/payroll/advance"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"amount":{"type":"number","exclusiveMinimum":0},"paidAt":{"type":"string"},"method":{"type":"string"}},"required":["organizationId","counterpartyId","amount","paidAt"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"paymentId":{"type":"string"}},"required":["paymentId"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_apply_create","title":"Apply credits to a payslip","description":"Applies the employee's outstanding advances and credits to a payslip (payslipId), reducing the net still owed. Recovering the full advance from final pay needs authorizeFinalPaySetoff plus the employee's recorded consent. It reallocates balances inside the books; no money is moved. Returns { applied, status, residualAdvanceDebt }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/apply)","http":{"method":"POST","path":"/api/payroll/apply"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1},"authorizeFinalPaySetoff":{"type":"boolean"},"consent":{"type":"object","properties":{"affirmed":{"type":"boolean"},"at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"attachmentId":{"type":"string","minLength":1}},"required":["affirmed"],"additionalProperties":false}},"required":["organizationId","payslipId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"applied":{"type":"number"},"status":{"type":"string"},"residualAdvanceDebt":{"type":"number"}},"required":["applied","status","residualAdvanceDebt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_approve_create","title":"Approve payslips","description":"Approves the draft payslips of a month (YYYY-MM), all of them or only payslipIds, so they are booked to the ledger. Refused when the month is locked. Does not pay anyone. Returns { approved }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/approve)","http":{"method":"POST","path":"/api/payroll/approve"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"month":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"payslipIds":{"type":"array","items":{"type":"string"}}},"required":["organizationId","month"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"approved":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["approved"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"payroll_consent_upload_create","title":"Upload payroll consent","description":"Uploads the employee's signed consent file for a deduction, optionally tied to a payslip (payslipId). Returns the stored attachment.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/consent-upload)","http":{"method":"POST","path":"/api/payroll/consent-upload"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1},"file":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[^/\\\\\\x00-\\x1f\\x7f]+$"},"fileType":{"description":"MIME type. Inferred from the filename or download response when omitted.","type":"string","maxLength":100},"base64":{"description":"Standard padded base64 file bytes, without a data-URL prefix. Supply exactly one of base64 or url.","type":"string","minLength":1,"maxLength":13981016},"url":{"description":"Public HTTP(S) URL that returns file bytes; no authentication or sharing/login pages. Download failure fails the entire operation.","type":"string","maxLength":4096,"format":"uri"}},"required":["fileName"],"additionalProperties":false}},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"fileName":{"type":"string"},"fileType":{"type":"string"},"fileSize":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","documentId","fileName","fileType","fileSize"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":true}},{"name":"payroll_generate_create","title":"Generate payslips","description":"Generates draft payslips for a month (YYYY-MM) from each employee's terms and attendance, optionally limited to employeeIds and with per-employee runInputs (hours, bonuses, deductions). Calculates and stores documents only; nothing is paid. Returns { generated, errors }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/generate)","http":{"method":"POST","path":"/api/payroll/generate"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"month":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"employeeIds":{"type":"array","items":{"type":"string"}},"runInputs":{"type":"object","properties":{"additionalWage":{"type":"number","minimum":0},"adjustments":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"amount":{"type":"number"},"kind":{"type":"string","enum":["OTHER","LEAVE_PAY","REIMBURSEMENT"]}},"required":["description","amount"],"additionalProperties":false}}},"additionalProperties":false}},"required":["organizationId","month"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"generated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"errors":{"type":"array","items":{"type":"object","properties":{"counterpartyId":{"type":"string"},"message":{"type":"string"}},"required":["counterpartyId","message"],"additionalProperties":false}}},"required":["generated","errors"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_gpl_settle_create","title":"Record an authority payment","description":"Records that statutory payroll liabilities (tax, social security, pension) were paid to an authority organization (authorityOrgId) for the given lineIds, with amount, paidAt and method. It records a payment made elsewhere; Guliel does not transfer money. Returns { paymentId, allocated, outstanding }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/gpl-settle)","http":{"method":"POST","path":"/api/payroll/gpl-settle"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"authorityOrgId":{"type":"string","minLength":1},"lineIds":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"amount":{"type":"number","exclusiveMinimum":0},"paidAt":{"type":"string"},"method":{"type":"string"}},"required":["organizationId","authorityOrgId","lineIds","paidAt"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"paymentId":{"type":"string"},"allocated":{"type":"number"},"outstanding":{"type":"number"}},"required":["paymentId","allocated","outstanding"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_pay_create","title":"Record a payslip payment","description":"Records that a payslip was paid. kind NET records the net salary paid to the employee (optionally together with approved expense claims in claimDocumentIds); STATUTORY records the deductions and contributions paid to authorities. Inputs: payslipId, kind, paidAt, method. It books a payment that happened elsewhere; Guliel does not move money. Returns { paymentId, allocated, status }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/pay)","http":{"method":"POST","path":"/api/payroll/pay"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1},"kind":{"type":"string","enum":["NET","STATUTORY"]},"paidAt":{"type":"string"},"method":{"type":"string"},"claimDocumentIds":{"description":"Approved expense claims the employee fronted, to reimburse with this net payment. Each must be booked, owed to THIS payslip's employee, in the payslip's currency, and still outstanding.","type":"array","items":{"type":"string","minLength":1}}},"required":["organizationId","payslipId","kind","paidAt"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"paymentId":{"type":"string"},"allocated":{"type":"number"},"status":{"type":"string"}},"required":["paymentId","allocated","status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_payments_list","title":"List payroll payments","description":"Lists the payments recorded against payslips in a month (YYYY-MM). Read-only. Returns { month, payments }.\n\n(Scope: payroll:read · requires CONTRIBUTOR+ · endpoint: GET /api/payroll/payments)","http":{"method":"GET","path":"/api/payroll/payments"},"feature":"payroll","verb":"read","scope":"payroll:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"month":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},"required":["organizationId","month"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"month":{"type":"string"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paidAt":{"type":"string"},"counterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"employeeName":{"type":"string"},"amount":{"type":"number"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"allocatedTotal":{"type":"number"},"openRemainder":{"type":"number"},"source":{"type":"string","enum":["ADVANCE","NET","STATUTORY"]},"payslipIds":{"type":"array","items":{"type":"string"}}},"required":["id","paidAt","counterpartyId","employeeName","amount","method","allocatedTotal","openRemainder","source","payslipIds"],"additionalProperties":false}}},"required":["month","payments"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"payroll_payslip_delete","title":"Delete a draft payslip","description":"Deletes a draft payslip by id. Approved or paid payslips cannot be deleted; void them instead. Returns { deleted }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: DELETE /api/payroll/payslip)","http":{"method":"DELETE","path":"/api/payroll/payslip"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1}},"required":["organizationId","payslipId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"payroll_regenerate_create","title":"Regenerate a payslip","description":"Deletes one payslip (payslipId) and generates a fresh one for the same month with new runInputs (hours, bonuses, deductions). Refused when the payslip has payments recorded or the month is locked. Nothing is paid. Returns { documentId, total, lineCount }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/regenerate)","http":{"method":"POST","path":"/api/payroll/regenerate"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1},"runInputs":{"type":"object","properties":{"additionalWage":{"type":"number","minimum":0},"adjustments":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"amount":{"type":"number"},"kind":{"type":"string","enum":["OTHER","LEAVE_PAY","REIMBURSEMENT"]}},"required":["description","amount"],"additionalProperties":false}}},"additionalProperties":false}},"required":["organizationId","payslipId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"documentId":{"type":"string"},"total":{"type":"number"},"lineCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["documentId","total","lineCount"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_summary_list","title":"Get payroll summary","description":"Summarizes a month's payroll (YYYY-MM): per employee and per scheme gross, deductions, employer contributions and net, plus outstanding statutory and reimbursement balances. Read-only.\n\n(Scope: payroll:read · requires CONTRIBUTOR+ · endpoint: GET /api/payroll/summary)","http":{"method":"GET","path":"/api/payroll/summary"},"feature":"payroll","verb":"read","scope":"payroll:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"month":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},"required":["organizationId","month"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"month":{"type":"string"},"schemes":{"type":"array","items":{"type":"string"}},"schemeLabels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"employees":{"type":"array","items":{"type":"object","properties":{"counterpartyId":{"type":"string"},"name":{"type":"string"},"payslipId":{"type":"string"},"status":{"type":"string","enum":["DRAFT","APPROVED","PAID"]},"gross":{"type":"number"},"net":{"type":"number"},"schemeAmounts":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"openCredit":{"type":"number"},"netOutstanding":{"type":"number"},"statutoryOutstanding":{"type":"number"},"hasAppliedAdvances":{"type":"boolean"},"hasPayments":{"type":"boolean"},"isFinalPayslip":{"type":"boolean"}},"required":["counterpartyId","name","openCredit"],"additionalProperties":false}},"totals":{"type":"object","properties":{"gross":{"type":"number"},"net":{"type":"number"},"employerCost":{"type":"number"},"openCredits":{"type":"number"}},"required":["gross","net","employerCost","openCredits"],"additionalProperties":false},"gplOutstanding":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string"},"authorityOrgId":{"anyOf":[{"type":"string"},{"type":"null"}]},"authorityName":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimed":{"type":"number"},"settled":{"type":"number"},"outstanding":{"type":"number"},"oldestUnsettledCovers":{"anyOf":[{"type":"string"},{"type":"null"}]},"ageDays":{"anyOf":[{"type":"number"},{"type":"null"}]},"lineIds":{"type":"array","items":{"type":"string"}}},"required":["scheme","authorityOrgId","authorityName","claimed","settled","outstanding","oldestUnsettledCovers","ageDays","lineIds"],"additionalProperties":false}},"reimbOutstanding":{"type":"array","items":{"type":"object","properties":{"counterpartyId":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"},"documentIds":{"type":"array","items":{"type":"string"}}},"required":["counterpartyId","amount","currency","documentIds"],"additionalProperties":false}}},"required":["month","schemes","schemeLabels","employees","totals","gplOutstanding","reimbOutstanding"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"payroll_unapply_create","title":"Undo applied credits","description":"Removes the advances that were applied to a payslip (payslipId) and returns it to DRAFT for review; the employee's advance balance reopens. Payments recorded with payroll_pay_create are left in place and counted in attachedPaymentCount. No money is moved. Returns { unapplied, status, attachedPaymentCount }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/unapply)","http":{"method":"POST","path":"/api/payroll/unapply"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1}},"required":["organizationId","payslipId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"unapplied":{"type":"number"},"status":{"type":"string"},"attachedPaymentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["unapplied","status","attachedPaymentCount"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"payroll_void_create","title":"Void a payslip","description":"Voids an APPROVED payslip (payslipId): its status becomes REJECTED and its ledger postings disappear, while the document is kept for audit. Refused when payments are recorded (reverse them first) or the month is locked. No money is moved. Returns { status }.\n\n(Scope: payroll:write · requires CONTRIBUTOR+ · endpoint: POST /api/payroll/void)","http":{"method":"POST","path":"/api/payroll/void"},"feature":"payroll","verb":"write","scope":"payroll:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"payslipId":{"type":"string","minLength":1}},"required":["organizationId","payslipId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false}},{"name":"receipts_create","title":"Issue a standalone receipt","description":"Issues a receipt (not tied to an invoice) acknowledging a payment from a customer (counterpartyId): currency, paidAt, method, line items and notes; optionally emails it (sendReceiptEmail, additionalEmails). It records and documents a payment already received; no money is moved. Returns { receipt, payment, emailsSent, emailsFailed }.\n\n(Scope: invoices:write · requires CONTRIBUTOR+ · endpoint: POST /api/receipts)","http":{"method":"POST","path":"/api/receipts"},"feature":"invoices","verb":"write","scope":"invoices:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"counterpartyId":{"type":"string","minLength":1},"bankAccountId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"currency":{"type":"string","minLength":1},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"minItems":1,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0},"amount":{"type":"number","exclusiveMinimum":0}},"required":["description","quantity","unitPrice","amount"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"sendReceiptEmail":{"default":false,"type":"boolean"},"additionalEmails":{"maxItems":20,"type":"array","items":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}}},"required":["organizationId","counterpartyId","currency","paidAt","items","sendReceiptEmail"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"receipt":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentNumber":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"status":{"type":"string","enum":["DRAFT","UNSENT","SENT","PAID","PENDING_REVIEW","APPROVED","REJECTED","INVOICED"]},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","PURCHASE_ORDER","PAYSLIP","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"direction":{"type":"string","enum":["OUTGOING","INCOMING"]},"relatedDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"}},"required":["id","description","quantity","unitPrice","amount"],"additionalProperties":false}},"subtotal":{"type":"number"},"taxRate":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"number"},"allocated":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"issueDate":{"type":"string"},"paymentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled":{"type":"boolean"},"cancellationDocumentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","invoiceNumber","total","issueDate","paymentId","paymentDate","paymentMethod","cancelled","cancellationDocumentId"],"additionalProperties":false}},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","country"],"additionalProperties":false},{"type":"null"}]},"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string","enum":["ISRAEL","SINGAPORE","USA","GERMANY","NETHERLANDS","SWEDEN","AUSTRIA","FINLAND","DENMARK","SPAIN","SLOVAKIA","IRELAND","LUXEMBOURG","CYPRUS","MALTA","SLOVENIA","CZECH_REPUBLIC","LITHUANIA","LATVIA","ESTONIA","NORWAY","ICELAND","UNITED_KINGDOM","SWITZERLAND","CANADA","AUSTRALIA","NEW_ZEALAND","UAE","BAHRAIN","OMAN","QATAR","KUWAIT","JAPAN","HONG_KONG","TAIWAN","THAILAND","INDONESIA","SOUTH_AFRICA","NIGERIA"]},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","name","country","registrationNumber","countrySpecificData"],"additionalProperties":false},"bankAccount":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"accountName":{"type":"string"},"bankName":{"type":"string"},"accountNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"currencies":{"type":"array","items":{"type":"string"}},"branchCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"localBankCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"swiftCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"iban":{"anyOf":[{"type":"string"},{"type":"null"}]},"routingNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"bankCountry":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","accountName","bankName","currencies","isDefault"],"additionalProperties":false},{"type":"null"}]}},"required":["id","invoiceNumber","documentNumber","organizationId","customerId","bankAccountId","currency","status","documentType","direction","relatedDocumentId","issueDate","dueDate","payUntil","items","subtotal","taxRate","taxAmount","total","paidAmount","receiptNumber","paymentDate","paymentMethod","countrySpecificData","notes","customer"],"additionalProperties":false},"payment":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"amount":{"type":"number"},"paidAt":{"type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"allocations":{"type":"array","items":{"type":"object","properties":{"lineId":{"type":"string"},"amount":{"type":"number"}},"required":["lineId","amount"],"additionalProperties":false}},"unallocated":{"type":"number"},"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"paidAmount":{"type":"number"},"total":{"type":"number"}},"required":["id","status","paidAmount","total"],"additionalProperties":false}}},"required":["id","organizationId","amount","paidAt","method","allocations","unallocated","documents"],"additionalProperties":false},"emailsSent":{"type":"number"},"emailsFailed":{"type":"number"}},"required":["receipt","payment"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"reports_get","title":"Generate a report","description":"Generate report data for an inclusive date range. Use reportType=income-register for invoice income and receipt collections in separate columns, without expenses; income-statement is profit and loss. Use the PDF tool to download a report.","http":{"method":"GET","path":"/api/reports/{reportType}"},"feature":"reports","verb":"read","scope":"reports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"reportType":{"type":"string","minLength":1,"description":"Report ID. Use income-register for invoice income and receipt collections in separate columns (no expenses); income-statement includes expenses."},"organizationId":{"type":"string","minLength":1},"startDate":{"description":"Inclusive start date, YYYY-MM-DD. For a calendar month use its first day.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"endDate":{"description":"Inclusive end date, YYYY-MM-DD. For a calendar month use its last day.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"customerId":{"type":"string","minLength":1},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","PURCHASE_ORDER","PAYSLIP","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"status":{"type":"string","enum":["DRAFT","UNSENT","SENT","PAID","PENDING_REVIEW","APPROVED","REJECTED","INVOICED"]},"limit":{"type":"integer","minimum":1,"maximum":10000},"sortBy":{"type":"string"},"groupBy":{"type":"string"},"locale":{"description":"PDF language: he (Hebrew, RTL) or en (English). Defaults to Hebrew for Israel, English elsewhere.","type":"string","enum":["he","en"]}},"required":["reportType","organizationId"],"additionalProperties":{}},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Generated report data — rows, totals and summaries vary by report type. Discover report-specific parameters with the schema tool."}},"required":["success","data"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"meta":{"ui":{"resourceUri":"ui://guliel/report-viewer"},"ui/resourceUri":"ui://guliel/report-viewer","openai/outputTemplate":"ui://guliel/report-viewer"}},{"name":"reports_list","title":"List report types","description":"Lists the reports available to the organization's country, filterable by type, category and search text. Returns { reports } with each reportType key to pass to the other report tools.\n\n(Scope: reports:read · endpoint: GET /api/reports)","http":{"method":"GET","path":"/api/reports"},"feature":"reports","verb":"read","scope":"reports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"type":{"type":"string"},"category":{"type":"string"},"search":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"reports":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"description":"Report definitions (name, description, parameters, columns). The full shape lives in src/lib/reports/types.ts:ReportDefinition."},"organizationCountry":{"type":"string"}},"required":["success","reports","organizationCountry"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"reports_pdf_get","title":"Download a report as PDF","description":"Download a report as a PDF file using the organization's current document design. Use reportType=income-register for invoice income and receipt collections in separate columns and totals (no expenses), with inclusive startDate and endDate; for a month use its first and last dates. locale=he produces Hebrew RTL; locale=en produces English. Report-specific filters are listed by the report schema tool.","http":{"method":"GET","path":"/api/reports/{reportType}/pdf"},"feature":"reports","verb":"read","scope":"reports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"reportType":{"type":"string","minLength":1,"description":"Report ID. Use income-register for invoice income and receipt collections in separate columns (no expenses); income-statement includes expenses."},"organizationId":{"type":"string","minLength":1},"startDate":{"description":"Inclusive start date, YYYY-MM-DD. For a calendar month use its first day.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"endDate":{"description":"Inclusive end date, YYYY-MM-DD. For a calendar month use its last day.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"customerId":{"type":"string","minLength":1},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"documentType":{"type":"string","enum":["INVOICE","RECEIPT","INVOICE_RECEIPT","PAYMENT_REQUEST","CREDIT_MEMO","DEBIT_MEMO","PURCHASE_ORDER","PAYSLIP","FINE_NOTICE","CHARGE_CONFIRMATION","STATEMENT","SUMMARY"]},"status":{"type":"string","enum":["DRAFT","UNSENT","SENT","PAID","PENDING_REVIEW","APPROVED","REJECTED","INVOICED"]},"limit":{"type":"integer","minimum":1,"maximum":10000},"sortBy":{"type":"string"},"groupBy":{"type":"string"},"locale":{"description":"PDF language: he (Hebrew, RTL) or en (English). Defaults to Hebrew for Israel, English elsewhere.","type":"string","enum":["he","en"]}},"required":["reportType","organizationId"],"additionalProperties":{}},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"reports_schema_list","title":"Get a report's filters","description":"Returns the definition of one report (reportType): its title, description and the filters and options it accepts. Read-only. Returns { definition }.\n\n(Scope: reports:read · endpoint: GET /api/reports/{reportType}/schema)","http":{"method":"GET","path":"/api/reports/{reportType}/schema"},"feature":"reports","verb":"read","scope":"reports:read","hasBody":false,"inputSchema":{"type":"object","properties":{"reportType":{"type":"string"},"organizationId":{"type":"string","minLength":1}},"required":["reportType","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"definition":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Report definition (name, description, columns, parameters). See src/lib/reports/types.ts:ReportDefinition for the full shape."}},"required":["success","definition"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"settings_list","title":"Get my settings","description":"Returns the signed-in user's preferences: theme, language, default organization and other stored preferences.\n\n(Scope: settings:read · endpoint: GET /api/settings)","http":{"method":"GET","path":"/api/settings"},"feature":"settings","verb":"read","scope":"settings:read","hasBody":false,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"theme":{"type":"string","description":"light | dark | system"},"language":{"type":"string"},"defaultOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferences":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","userId","theme","language","defaultOrganizationId","preferences","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"settings_refresh_create","title":"Refresh exchange rates","description":"Refreshes the platform-wide exchange-rate snapshot from the external rate provider. Rates are shared by all organizations; limited to one refresh per 5 minutes. Requires CONTRIBUTOR or higher in some organization. Returns { date, ratesCount }.\n\n(Scope: settings:write · endpoint: POST /api/exchange-rates/refresh)","http":{"method":"POST","path":"/api/exchange-rates/refresh"},"feature":"settings","verb":"write","scope":"settings:write","hasBody":true,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"message":{"type":"string"},"date":{"type":"string","description":"ISO date of the FX snapshot that's now active."},"ratesCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How many currency pairs were refreshed."}},"required":["message","date","ratesCount"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":true}},{"name":"settings_replace","title":"Update my settings","description":"Overwrites the signed-in user's preferences: theme, language, default organization and preferences. Returns the settings.\n\n(Scope: settings:write · endpoint: PUT /api/settings)","http":{"method":"PUT","path":"/api/settings"},"feature":"settings","verb":"write","scope":"settings:write","hasBody":true,"inputSchema":{"type":"object","properties":{"theme":{"type":"string","enum":["light","dark","system"]},"language":{"type":"string"},"defaultOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferences":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"theme":{"type":"string","description":"light | dark | system"},"language":{"type":"string"},"defaultOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferences":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","userId","theme","language","defaultOrganizationId","preferences","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"supplier_orders_get","title":"Get a customer order","description":"Returns one purchase order that another Guliel organization placed with this organization as its supplier, with items, totals and linked invoices.\n\n(Scope: orders:read · endpoint: GET /api/supplier-orders/{id})","http":{"method":"GET","path":"/api/supplier-orders/{id}"},"feature":"orders","verb":"read","scope":"orders:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"supplierId":{"anyOf":[{"type":"string"},{"type":"null"}]},"counterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"orderNumber":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"subtotal":{"type":"number"},"orderDate":{"type":"string"},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"organization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","address"],"additionalProperties":false},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","supplierOrganizationId"],"additionalProperties":false},{"type":"null"}],"description":"The supplier Counterparty edge — display fields resolved through the linked party; `supplierOrganizationId` maps to Counterparty.otherOrganizationId."},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"itemId":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"amount":{"type":"number"},"item":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","sku"],"additionalProperties":false},{"type":"null"}]}},"required":["id","itemId","description","quantity","unitPrice","amount","item"],"additionalProperties":false}},"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"invoiceNumber":{"type":"string"},"status":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string"}},"required":["id","invoiceNumber","status","total","currency"],"additionalProperties":false}},"createdBy":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","counterpartyId","orderNumber","status","currency","subtotal","orderDate","expectedDate","notes","organization","supplier","items","invoices","createdBy","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"supplier_orders_list","title":"List customer orders","description":"Lists purchase orders that other Guliel organizations placed with this organization as their supplier; filter by status, search text or clientOrgId. Returns { orders, pagination }.\n\n(Scope: orders:read · endpoint: GET /api/supplier-orders)","http":{"method":"GET","path":"/api/supplier-orders"},"feature":"orders","verb":"read","scope":"orders:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":20,"type":"integer","minimum":1,"maximum":100},"status":{"type":"string"},"search":{"default":"","type":"string"},"clientOrgId":{"type":"string"}},"required":["organizationId","page","limit","search"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string","description":"The CLIENT org that placed the order (not the supplier-side org)."},"supplierId":{"anyOf":[{"type":"string"},{"type":"null"}]},"counterpartyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"orderNumber":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"subtotal":{"type":"number"},"orderDate":{"type":"string"},"expectedDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"organization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"}},"required":["id","name","country"],"additionalProperties":false},{"type":"null"}]},"supplier":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"The supplier Counterparty edge, with display name resolved through the linked party."},"items":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"_count":{"type":"object","properties":{"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["invoices"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","supplierId","counterpartyId","orderNumber","status","currency","subtotal","orderDate","expectedDate","organization","supplier","items","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["orders","pagination"],"additionalProperties":false,"description":"Orders the caller's org has received as a supplier. Inverse of /api/orders, which lists orders placed by the caller's org."},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_create","title":"Create a supplier","description":"Adds a supplier. mode 'email' sends an invitation email to the supplier (email required), 'link' returns an invitation link without emailing, and 'manual' just records the supplier's details (name, phone, address, country, registration number). Returns the supplier.\n\n(Scope: suppliers:write · requires CONTRIBUTOR+ · endpoint: POST /api/suppliers)","http":{"method":"POST","path":"/api/suppliers"},"feature":"suppliers","verb":"write","scope":"suppliers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"mode":{"default":"email","type":"string","enum":["email","link","manual"]},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"}},"required":["organizationId","mode"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string","description":"Counterparty edge id."},"organizationId":{"type":"string"},"kind":{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"],"description":"ORGANIZATION = a business supplier (linked Organization); INDIVIDUAL = a freelance/private-person supplier."},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactName":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"status":{"type":"string","description":"ACTIVE | PENDING | INACTIVE — pending suppliers represent unaccepted invitations."},"invitationMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"invitedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"acceptedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Set when this supplier is itself an Organization (business supplier). Maps to Counterparty.otherOrganizationId."},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","kind","name","contactName","email","phone","address","country","registrationNumber","defaultCurrencies","status","invitationMethod","invitedAt","acceptedAt","supplierOrganizationId","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"suppliers_csv_list","title":"Export suppliers as CSV","description":"Downloads the organization's suppliers as a CSV file, optionally filtered by status and search text. Returns a CSV file, not JSON.\n\n(Scope: suppliers:read · endpoint: GET /api/suppliers/export/csv)","http":{"method":"GET","path":"/api/suppliers/export/csv"},"feature":"suppliers","verb":"read","scope":"suppliers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"status":{"type":"string"},"search":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":null,"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_delete","title":"Delete a supplier","description":"Removes a supplier. mode 'soft' (default) deactivates it so order history is preserved; 'hard' deletes the row and is refused while orders reference it. Returns { success, mode }.\n\n(Scope: suppliers:write · endpoint: DELETE /api/suppliers/{id})","http":{"method":"DELETE","path":"/api/suppliers/{id}"},"feature":"suppliers","verb":"write","scope":"suppliers:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"mode":{"anyOf":[{"type":"string","const":"soft"},{"type":"string","const":"hard"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"mode":{"anyOf":[{"type":"string","const":"hard"},{"type":"string","const":"soft"}],"description":"Which delete path executed — hard removes the row, soft sets status=INACTIVE to preserve order history."}},"required":["success","mode"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_get","title":"Get a supplier","description":"Returns one supplier by id: contact details, registration number, status, whether it is a Guliel organization, and its active order count.\n\n(Scope: suppliers:read · endpoint: GET /api/suppliers/{id})","http":{"method":"GET","path":"/api/suppliers/{id}"},"feature":"suppliers","verb":"read","scope":"suppliers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address"],"additionalProperties":false},{"type":"null"}]},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","kind","name","email","phone","address","country","registrationNumber","defaultCurrencies","status","supplierOrganizationId","supplierOrganization","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_items_list","title":"List a supplier's items","description":"Lists the inventory items a Guliel-connected supplier offers for external ordering. Returns { items }.\n\n(Scope: suppliers:read · endpoint: GET /api/suppliers/{id}/items)","http":{"method":"GET","path":"/api/suppliers/{id}/items"},"feature":"suppliers","verb":"read","scope":"suppliers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"unitPrice":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"availableForExternalOrder":{"type":"boolean"}},"required":["id","name","description","sku","unitPrice","currency","isActive","availableForExternalOrder"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false,"description":"Supplier-published catalog. Empty for individual suppliers (no linked Organization)."},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_list","title":"List suppliers","description":"Lists the organization's suppliers with paging, search, status filter, an `orderable` filter (suppliers you can place orders with) and sorting. Returns { suppliers, pagination }.\n\n(Scope: suppliers:read · endpoint: GET /api/suppliers)","http":{"method":"GET","path":"/api/suppliers"},"feature":"suppliers","verb":"read","scope":"suppliers:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":20,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"},"status":{"default":"ACTIVE","type":"string"},"orderable":{"description":"true = only suppliers that can receive a new purchase order (ACTIVE or PENDING). ANDed with `status`; pair with status=ALL.","type":"string","enum":["true","false"]},"sortBy":{"default":"createdAt","type":"string","enum":["name","email","status","createdAt"]},"sortOrder":{"default":"desc","type":"string","enum":["asc","desc"]}},"required":["organizationId","page","limit","search","status","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"suppliers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Counterparty edge id."},"organizationId":{"type":"string"},"kind":{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"],"description":"ORGANIZATION = a business supplier (linked Organization); INDIVIDUAL = a freelance/private-person supplier."},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactName":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"status":{"type":"string","description":"ACTIVE | PENDING | INACTIVE — pending suppliers represent unaccepted invitations."},"invitationMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"invitedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"acceptedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Set when this supplier is itself an Organization (business supplier). Maps to Counterparty.otherOrganizationId."},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","kind","name","contactName","email","phone","address","country","registrationNumber","defaultCurrencies","status","invitationMethod","invitedAt","acceptedAt","supplierOrganizationId","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["suppliers","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_replace","title":"Replace a supplier","description":"Overwrites the supplied supplier fields (name, email, phone, address, country, registration number). Omitted fields keep their value. Returns the supplier.\n\n(Scope: suppliers:write · endpoint: PUT /api/suppliers/{id})","http":{"method":"PUT","path":"/api/suppliers/{id}"},"feature":"suppliers","verb":"write","scope":"suppliers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address"],"additionalProperties":false},{"type":"null"}]},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","kind","name","email","phone","address","country","registrationNumber","defaultCurrencies","status","supplierOrganizationId","supplierOrganization","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"suppliers_resend_invitation_create","title":"Resend a supplier invitation","description":"Sends the pending supplier invitation again by email, with a fresh link. Returns { supplier, inviteUrl, emailSent }.\n\n(Scope: suppliers:write · endpoint: POST /api/suppliers/{id}/resend-invitation)","http":{"method":"POST","path":"/api/suppliers/{id}/resend-invitation"},"feature":"suppliers","verb":"write","scope":"suppliers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"supplier":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","description":"Counterparty status — PENDING while the invitation is outstanding."},"invitedEmail":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Resolved recipient email; null if the supplier has no email on file."},"invitedAt":{"type":"string","description":"ISO timestamp of when the (re)invitation was issued."}},"required":["id","status","invitedEmail","invitedAt"],"additionalProperties":false},"inviteUrl":{"type":"string","description":"Pre-signed invitation acceptance URL the recipient can open."},"emailSent":{"type":"boolean","description":"False if the supplier had no email on file; the inviteUrl still works."}},"required":["supplier","inviteUrl","emailSent"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"suppliers_update","title":"Update a supplier","description":"Edits the supplied supplier fields (name, email, phone, address, country, registration number); omitted fields keep their value. Returns the supplier.\n\n(Scope: suppliers:write · endpoint: PATCH /api/suppliers/{id})","http":{"method":"PATCH","path":"/api/suppliers/{id}"},"feature":"suppliers","verb":"write","scope":"suppliers:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["ORGANIZATION","INDIVIDUAL"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"registrationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"defaultCurrencies":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"supplierOrganizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplierOrganization":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"registrationNumber":{"type":"string"},"address":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","country","registrationNumber","address"],"additionalProperties":false},{"type":"null"}]},"activeOrderCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","kind","name","email","phone","address","country","registrationNumber","defaultCurrencies","status","supplierOrganizationId","supplierOrganization","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"users_create","title":"Create a user","description":"Creates a user account (email, name) and optionally adds it to the organization with orgRole. The account has no usable password: its owner claims it through the email verification and forgot-password flow. Requires MANAGER. Returns { id, email, name }.\n\n(Scope: users:write · requires MANAGER+ · endpoint: POST /api/users)","http":{"method":"POST","path":"/api/users"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1},"orgRole":{"type":"string","enum":["MANAGER","CONTRIBUTOR","VIEWER"]}},"required":["email","name","organizationId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","email","name","createdAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"users_get","title":"Get a user","description":"Returns one user by id: email, name, creation time and organization memberships.\n\n(Scope: users:read · endpoint: GET /api/users/{id})","http":{"method":"GET","path":"/api/users/{id}"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"organizations":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"required":["role","organization"],"additionalProperties":false}}},"required":["id","email","name","createdAt"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"users_list","title":"List users","description":"Lists users in the organization with paging, search, role filter and sorting. Requires MANAGER. Returns { users, pagination }.\n\n(Scope: users:read · requires MANAGER+ · endpoint: GET /api/users)","http":{"method":"GET","path":"/api/users"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"page":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"limit":{"default":10,"type":"integer","minimum":1,"maximum":100},"search":{"default":"","type":"string"},"sortBy":{"default":"name","type":"string","enum":["name","email","createdAt","role"]},"sortOrder":{"default":"asc","type":"string","enum":["asc","desc"]},"role":{"type":"string","enum":["MANAGER","CONTRIBUTOR","VIEWER"]}},"required":["organizationId","page","limit","search","sortBy","sortOrder"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"orgRole":{"type":"string"},"organizations":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"required":["role","organization"],"additionalProperties":false}},"createdAt":{"type":"string"}},"required":["id","email","name","orgRole","organizations","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalPages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["users","pagination"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"users_mark_all_read_create","title":"Mark all notifications read","description":"Marks every unread notification of the caller as read. Returns { success }.\n\n(Scope: users:write · endpoint: POST /api/notifications/mark-all-read)","http":{"method":"POST","path":"/api/notifications/mark-all-read"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"users_members_create","title":"Add an organization member","description":"Adds a user who already has a Guliel account (found by email) to the organization with a role (MANAGER, CONTRIBUTOR or VIEWER). Unknown emails are rejected; use invitations_create for new people. Requires MANAGER. Returns the membership.\n\n(Scope: users:write · endpoint: POST /api/organizations/{id}/members)","http":{"method":"POST","path":"/api/organizations/{id}/members"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"type":"string","enum":["MANAGER","CONTRIBUTOR","VIEWER"]}},"required":["id","email","role"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"role":{"type":"string","description":"MANAGER | CONTRIBUTOR | VIEWER"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","userId","organizationId","role","user","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false}},{"name":"users_members_delete","title":"Remove an organization member","description":"Removes a user (userId) from the organization, revoking their access; the account itself remains. Returns { success }.\n\n(Scope: users:write · endpoint: DELETE /api/organizations/{id}/members)","http":{"method":"DELETE","path":"/api/organizations/{id}/members"},"feature":"users","verb":"write","scope":"users:write","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string","minLength":1}},"required":["id","userId"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"users_members_list","title":"List organization members","description":"Lists the organization's members with their roles. Returns { members }.\n\n(Scope: users:read · endpoint: GET /api/organizations/{id}/members)","http":{"method":"GET","path":"/api/organizations/{id}/members"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"role":{"type":"string","description":"MANAGER | CONTRIBUTOR | VIEWER"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","userId","organizationId","role","user","createdAt","updatedAt"],"additionalProperties":false}}},"required":["members"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"users_members_update","title":"Change a member's role","description":"Changes a member's (userId) role in the organization to MANAGER, CONTRIBUTOR or VIEWER. Returns the membership.\n\n(Scope: users:write · endpoint: PATCH /api/organizations/{id}/members)","http":{"method":"PATCH","path":"/api/organizations/{id}/members"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string","minLength":1},"role":{"type":"string","enum":["MANAGER","CONTRIBUTOR","VIEWER"]}},"required":["id","userId","role"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"role":{"type":"string","description":"MANAGER | CONTRIBUTOR | VIEWER"},"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","userId","organizationId","role","user","createdAt","updatedAt"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}},{"name":"users_resend_create","title":"Resend an invitation","description":"Sends a pending organization invitation (id) again by email. Returns the refreshed invitation.\n\n(Scope: users:write · endpoint: POST /api/invitations/{id}/resend)","http":{"method":"POST","path":"/api/invitations/{id}/resend"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Updated invitation row — see /api/invitations GET for the canonical shape."},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}},{"name":"users_search_list","title":"Search users","description":"Searches existing users by name or email (q), optionally excluding members of one organization (excludeOrgId), up to `limit`. Returns { users }.\n\n(Scope: users:read · endpoint: GET /api/users/search)","http":{"method":"GET","path":"/api/users/search"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"q":{"default":"","type":"string"},"excludeOrgId":{"type":"string","minLength":1},"limit":{"default":10,"type":"integer","minimum":1,"maximum":20}},"required":["q","excludeOrgId","limit"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","email","name"],"additionalProperties":false}}},"required":["users"],"additionalProperties":false},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"users_update","title":"Change a user's organization role","description":"Changes an existing member's role (MANAGER, CONTRIBUTOR or VIEWER) in an organization (inputs: id of the user, organizationId, role). Cannot change your own role and cannot add non-members; use the invite flow for that. Requires MANAGER. Returns { success }.\n\n(Scope: users:write · endpoint: PATCH /api/users/{id})","http":{"method":"PATCH","path":"/api/users/{id}"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"role":{"type":"string","enum":["MANAGER","CONTRIBUTOR","VIEWER"]}},"required":["id","organizationId","role"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false},"annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":true,"openWorldHint":false}}]}