{"version":"1","generatedAt":"2026-07-02T10:32:09.198Z","tools":[{"name":"automations_catalog","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\", \"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}},{"name":"automations_create","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\" 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, then arm it with automations.enable. 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\", 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\", 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}},{"name":"automations_delete","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 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}},{"name":"automations_disable","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\", 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}},{"name":"automations_enable","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\", 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}},{"name":"automations_get","description":"Fetches a single automation by id. Returns 404 if the automation isn't in the caller's accessible organizations.\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\", 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}},{"name":"automations_list","description":"Lists automations the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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\", 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}},{"name":"automations_preview","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}},{"name":"automations_replay","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}},{"name":"automations_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.","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}},{"name":"automations_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},"meta":{"ui":{"resourceUri":"ui://guliel/automation-runs"},"ui/resourceUri":"ui://guliel/automation-runs","openai/outputTemplate":"ui://guliel/automation-runs"}},{"name":"automations_test","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}},{"name":"automations_update","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\", 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\", 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}},{"name":"bank_accounts_create","description":"Creates a new bank account in the target organization. Returns the created record on success.\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"}]},"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"},"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","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false}},{"name":"bank_accounts_delete","description":"Deletes the bank account. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"bank_accounts_get","description":"Fetches a single bank account by id. Returns 404 if the bank account isn't in the caller's accessible organizations.\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"},"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","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false}},{"name":"bank_accounts_list","description":"Lists bank accounts the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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"},"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","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false}}},"required":["bankAccounts"],"additionalProperties":false},"meta":{"ui":{"resourceUri":"ui://guliel/bank-accounts"},"ui/resourceUri":"ui://guliel/bank-accounts","openai/outputTemplate":"ui://guliel/bank-accounts"}},{"name":"bank_accounts_update","description":"Updates an existing bank account. Only the fields present in the request body are changed; omitted fields stay as-is.\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":{"type":"string","minLength":1},"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"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"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"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","accountName","bankName","accountNumber","currencies","branchCode","localBankCode","swiftCode","iban","routingNumber","bankAddress","bankCountry","isDefault","notes","createdAt","updatedAt"],"additionalProperties":false}},{"name":"companion_delete_session","description":"Removes the association without deleting the underlying record.\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}},{"name":"companion_read_export","description":"Returns every `sessions/export` row associated with the given companion session.\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},{"name":"companion_read_runlog","description":"Returns every `sessions/runlog` row associated with the given companion session.\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}},{"name":"companion_read_session","description":"Returns every `sessions` row associated with the given companion session.\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}},{"name":"companion_read_sessions","description":"Returns the `sessions` data for the companion sessions feature.\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}},{"name":"companion_read_stream","description":"Returns every `sessions/stream` row associated with the given companion session.\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},{"name":"companion_read_turn","description":"Returns every `turns` row associated with the given companion session.\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}},{"name":"companion_write_cancel_turn","description":"Creates a new `turns/cancel` attached to the given companion session.\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}},{"name":"companion_write_messages","description":"Creates a new `sessions/messages` attached to the given companion session.\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}},{"name":"companion_write_session","description":"Mutates the `sessions` attached to the given companion session.\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}},{"name":"companion_write_sessions","description":"Performs the `sessions` operation for the companion sessions feature.\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}},{"name":"customers_create","description":"Creates a new customer in the target organization. Returns the created record on success.\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"}},"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"}},"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"}]},"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","organizationId","kind","displayName","displayAddress","displayCountry","displayRegistrationNumber","createdAt","updatedAt"],"additionalProperties":false}},{"name":"customers_delete","description":"Deletes the customer. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"customers_get","description":"Fetches a single customer by id. Returns 404 if the customer isn't in the caller's accessible organizations.\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"}},"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"}]},"_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","organizationId","kind","notes","status","displayName","displayAddress","displayCountry","displayRegistrationNumber","createdAt","updatedAt"],"additionalProperties":false},"meta":{"ui":{"resourceUri":"ui://guliel/customer-detail"},"ui/resourceUri":"ui://guliel/customer-detail","openai/outputTemplate":"ui://guliel/customer-detail"}},{"name":"customers_list","description":"Lists customers the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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"}},"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"}]},"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","organizationId","kind","displayName","displayAddress","displayCountry","displayRegistrationNumber","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}},{"name":"customers_recipients","description":"Returns every `recipients` row associated with the given customer.\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}}},{"name":"customers_recipients_delete","description":"Removes the association without deleting the underlying record.\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}},{"name":"customers_recipients_post","description":"Creates a new `recipients` attached to the given customer.\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}},{"name":"customers_update","description":"Replaces an existing customer. All required fields must be supplied — omitted fields revert to their schema defaults.\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"}},"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"}},"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"}]},"_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","organizationId","kind","notes","status","displayName","displayAddress","displayCountry","displayRegistrationNumber","createdAt","updatedAt"],"additionalProperties":false}},{"name":"customers_update_patch","description":"Updates an existing customer. Only the fields present in the request body are changed; omitted fields stay as-is.\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"}},"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"}},"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"}]},"_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","organizationId","kind","notes","status","displayName","displayAddress","displayCountry","displayRegistrationNumber","createdAt","updatedAt"],"additionalProperties":false}},{"name":"dashboard_get","description":"Lists dashboard summaries the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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":{"default":2026,"type":"integer","minimum":2000,"maximum":2100}},"required":["organizationId","year"],"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":{}}},"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"}},"_diagnostics":{"description":"Only present in non-production environments — surfaces errors that were caught and logged but didn't abort the response.","type":"array","items":{"type":"string"}}},"required":["totalInvoices","totalRevenue","outstandingAmount","pendingAmount","invoicesByStatus","revenueByMonth","revenueByCustomer","growth","displayCurrency","exchangeRateDate","pendingPaymentsList","expenseTotal","expensesByMonth","expensesByVendor","paidInvoicesCount","approvedExpensesCount","expenseGrowth","netTotal","netGrowth","marginPercent","pendingExpensesTotal","pendingExpensesCount","pendingExpensesGrowth","cashFlowByMonth","lowStockItemsCount","activeItemsCount"],"additionalProperties":false},"meta":{"ui":{"resourceUri":"ui://guliel/dashboard"},"ui/resourceUri":"ui://guliel/dashboard","openai/outputTemplate":"ui://guliel/dashboard"}},{"name":"expense_categories_create","description":"Creates a new expense category in the target organization. Returns the created record on success.\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"},"_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","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expense_categories_list","description":"Lists expense categories the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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"},"_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","createdAt","updatedAt"],"additionalProperties":false}}},"required":["categories"],"additionalProperties":false}},{"name":"expenses_attachments","description":"Serves the raw attached file for an expense. The URL embeds a signed token; clients shouldn't construct it directly.\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},{"name":"expenses_create","description":"Creates a new expense in the target organization. Returns the created record on success.\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"},"taxAmount":{"type":"number"},"taxRate":{"type":"number"},"paymentMethod":{"type":"string"},"source":{"default":"MANUAL","type":"string","enum":["MANUAL","SCAN","EMAIL"]},"customerIds":{"type":"array","items":{"type":"string"}}},"required":["organizationId","amount","currency","date","source"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"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"}]},"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"},"attachments":{"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}},"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","description","amount","currency","date","category","vendor","paymentMethod","paidAmount","openBalance","payments","source","status","createdBy","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expenses_csv","description":"Streams the caller's expenses as a CSV file. Filter parameters scope the export the same way the list endpoint does.\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"},"dateFrom":{"type":"string"},"dateTo":{"type":"string"}},"required":["organizationId"],"additionalProperties":false},"outputSchema":null},{"name":"expenses_customers","description":"Creates a new `customers` attached to the given expense.\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."}},{"name":"expenses_customers_delete","description":"Removes the association without deleting the underlying record.\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}},{"name":"expenses_delete","description":"Deletes the expense category. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"expenses_delete_delete","description":"Deletes the expense. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"expenses_email_poll","description":"Pulls newly-arrived receipts from the connected mailbox and creates expenses for each one.\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}},{"name":"expenses_get","description":"Fetches a single expense by id. Returns 404 if the expense isn't in the caller's accessible organizations.\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"},"currency":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"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"}]},"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"}]},"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"}]},"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","currency","date","status","paymentMethod","paidAmount","openBalance","payments","taxAmount","taxRate","notes","source","emailMessageId","category","customers","attachments","createdBy","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expenses_list","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"},"dateFrom":{"type":"string"},"dateTo":{"type":"string"},"minAmount":{"type":"string"},"maxAmount":{"type":"string"},"customerId":{"type":"string"},"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"},"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"}]},"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"},"attachments":{"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}},"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","description","amount","currency","date","category","vendor","paymentMethod","paidAmount","openBalance","payments","source","status","createdBy","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},"meta":{"ui":{"resourceUri":"ui://guliel/expenses-list"},"ui/resourceUri":"ui://guliel/expenses-list","openai/outputTemplate":"ui://guliel/expenses-list"}},{"name":"expenses_manifest","description":"Streams the caller's expenses as a MANIFEST file. Filter parameters scope the export the same way the list endpoint does.\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"},"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}},{"name":"expenses_payments","description":"Creates a new `payments` attached to the given expense.\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."}},{"name":"expenses_scan","description":"Performs the `scan` operation for the expenses feature.\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"},"processingTimeMs":{"type":"number"},"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."}},"required":["expenseId","mergedIntoOrder","extractedData","providerId","processingTimeMs","scanStatus","scanError","duplicateOfId"],"additionalProperties":false}},{"name":"expenses_status","description":"Mutates the state machine of the expense. Some transitions are restricted by role.\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."}},{"name":"expenses_update","description":"Replaces an existing expense category. All required fields must be supplied — omitted fields revert to their schema defaults.\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"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","color","isDefault","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expenses_update_patch","description":"Updates an existing expense category. Only the fields present in the request body are changed; omitted fields stay as-is.\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"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","color","isDefault","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expenses_update_patch_2","description":"Updates an existing expense. Only the fields present in the request body are changed; omitted fields stay as-is.\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"},"categoryId":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"paymentMethod":{"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"},"currency":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"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"}]},"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"}]},"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"}]},"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","currency","date","status","paymentMethod","paidAmount","openBalance","payments","taxAmount","taxRate","notes","source","emailMessageId","category","customers","attachments","createdBy","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expenses_update_put","description":"Replaces an existing expense. All required fields must be supplied — omitted fields revert to their schema defaults.\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"},"categoryId":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxAmount":{"anyOf":[{"type":"number"},{"type":"null"}]},"taxRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"paymentMethod":{"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"},"currency":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"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"}]},"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"}]},"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"}]},"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","currency","date","status","paymentMethod","paidAmount","openBalance","payments","taxAmount","taxRate","notes","source","emailMessageId","category","customers","attachments","createdBy","createdAt","updatedAt"],"additionalProperties":false}},{"name":"expenses_upload","description":"Performs the `upload` operation for the expenses feature.\n\n(Scope: expenses:write · 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":{},"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"}]},"storageUrl":{"type":"string"}},"required":["id","expenseId","fileName","fileType","fileSize","storageUrl"],"additionalProperties":false}},{"name":"expenses_usage","description":"Returns the caller's recent request log for the expense (last 7 days by default).\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."}},{"name":"integrations_auto_scan","description":"Returns every `email-settings/auto-scan` row associated with the given expense.\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}},{"name":"integrations_auto_scan_delete","description":"Removes the association without deleting the underlying record.\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}},{"name":"integrations_auto_scan_post","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) 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}},{"name":"integrations_email_settings","description":"Returns the `email-settings` data for the expenses feature.\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."}},{"name":"integrations_email_settings_delete","description":"Removes the `email-settings` configuration for the expenses feature.\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}},{"name":"integrations_email_settings_post","description":"Performs the `email-settings` operation for the expenses feature.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: POST /api/expenses/email-settings)","http":{"method":"POST","path":"/api/expenses/email-settings"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"provider":{"type":"string","enum":["GMAIL","OUTLOOK","IMAP","POP3"]},"enabled":{"type":"boolean"},"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"}]},"password":{"anyOf":[{"type":"string"},{"type":"null"}]},"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":1,"maximum":365}},"required":["organizationId","name","provider"],"additionalProperties":false},"outputSchema":{"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}},{"name":"integrations_email_settings_put","description":"Mutates the `email-settings` configuration for the expenses feature.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: PUT /api/expenses/email-settings)","http":{"method":"PUT","path":"/api/expenses/email-settings"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"organizationId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"enabled":{"type":"boolean"},"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"}]},"password":{"anyOf":[{"type":"string"},{"type":"null"}]},"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":1,"maximum":365},"provider":{"type":"string","enum":["GMAIL","OUTLOOK","IMAP","POP3"]}},"required":["id","organizationId"],"additionalProperties":false},"outputSchema":{"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}},{"name":"integrations_fetch_logs","description":"Returns the `fetch-logs` data for the expenses feature.\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}},{"name":"integrations_gmail","description":"Performs the `email-connect/gmail` operation for the expenses feature.\n\n(Scope: integrations:write · requires CONTRIBUTOR+ · auth: SESSION only · endpoint: POST /api/expenses/email-connect/gmail)","http":{"method":"POST","path":"/api/expenses/email-connect/gmail"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"default":"Gmail","type":"string","minLength":1}},"required":["organizationId","name"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"authorizeUrl":{"type":"string","description":"URL the browser opens to start the Gmail OAuth flow."},"state":{"type":"string","description":"Signed CSRF state token — round-tripped on the callback."}},"required":["authorizeUrl","state"],"additionalProperties":false}},{"name":"integrations_outlook","description":"Performs the `email-connect/outlook` operation for the expenses feature.\n\n(Scope: integrations:write · requires CONTRIBUTOR+ · auth: SESSION only · endpoint: POST /api/expenses/email-connect/outlook)","http":{"method":"POST","path":"/api/expenses/email-connect/outlook"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"default":"Outlook","type":"string","minLength":1}},"required":["organizationId","name"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"authorizeUrl":{"type":"string","description":"URL the browser opens to start the Outlook OAuth flow."},"state":{"type":"string","description":"Signed CSRF state token — round-tripped on the callback."}},"required":["authorizeUrl","state"],"additionalProperties":false}},{"name":"integrations_stop","description":"Creates a new `fetch-logs/stop` attached to the given expense.\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}},{"name":"integrations_tax_authority","description":"Returns every `tax-authority` row associated with the given organization.\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}},{"name":"integrations_tax_authority_delete","description":"Removes the association without deleting the underlying record.\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}},{"name":"integrations_tax_authority_get","description":"Returns every `tax-authority` row associated with the given organization.\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}},{"name":"integrations_tax_authority_post","description":"Creates a new `tax-authority` attached to the given organization.\n\n(Scope: integrations:write · requires MANAGER+ · endpoint: POST /api/organizations/{id}/tax-authority/{integrationId})","http":{"method":"POST","path":"/api/organizations/{id}/tax-authority/{integrationId}"},"feature":"integrations","verb":"write","scope":"integrations:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"integrationId":{"type":"string"},"credentials":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"environment":{"default":"sandbox","type":"string","enum":["sandbox","production"]}},"required":["id","integrationId","credentials","environment"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":false}},{"name":"integrations_validate","description":"Creates a new `tax-authority/validate` attached to the given organization.\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}},{"name":"invoices_clearance","description":"Returns every `clearance` row associated with the given document.\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`."}},{"name":"invoices_clearance_post","description":"Creates a new `clearance` attached to the given document.\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}},{"name":"invoices_create","description":"Creates a new document in the target organization. Returns the created record on success.\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"}]},"currency":{"type":"string","minLength":1},"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"}]}},"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"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"inDispute":{"type":"boolean"},"invoiceDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatorVersion":{"type":"string"},"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"}]}},"required":["id","name","email"],"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","invoiceDate","dueDate","currency","exchangeRate","subtotal","taxAmount","total","paidAmount","notes","vatAllocationNumber","generatorVersion","createdAt","updatedAt","customer","items","createdBy"],"additionalProperties":false}},{"name":"invoices_delete","description":"Deletes the document. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"invoices_events","description":"Returns every `events` row associated with the given document.\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}},{"name":"invoices_events_post","description":"Creates a new `events` attached to the given document.\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}},{"name":"invoices_get","description":"Fetches a single document by id. Returns 404 if the document isn't in the caller's accessible organizations.\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":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"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"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatorVersion":{"type":"string"},"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"}]}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData"],"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"}]},"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","documentType","status","direction","inDispute","currency","exchangeRate","issueDate","dueDate","payUntil","paymentMethod","paymentDate","receiptNumber","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","generatorVersion","vatAllocationNumber","countrySpecificData","items","organization","customer","bankAccount","createdBy","createdAt","updatedAt"],"additionalProperties":false},"meta":{"ui":{"resourceUri":"ui://guliel/invoice-detail"},"ui/resourceUri":"ui://guliel/invoice-detail","openai/outputTemplate":"ui://guliel/invoice-detail"}},{"name":"invoices_invoice","description":"Creates a new `invoice` attached to the given order.\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}},{"name":"invoices_list","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"]},"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"},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"inDispute":{"type":"boolean"},"invoiceDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"total":{"type":"number"},"paidAmount":{"type":"number"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"vatAllocationNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatorVersion":{"type":"string"},"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"}]}},"required":["id","name","email"],"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","invoiceDate","dueDate","currency","exchangeRate","subtotal","taxAmount","total","paidAmount","notes","vatAllocationNumber","generatorVersion","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},"meta":{"ui":{"resourceUri":"ui://guliel/documents-list"},"ui/resourceUri":"ui://guliel/documents-list","openai/outputTemplate":"ui://guliel/documents-list"}},{"name":"invoices_manual_allocation","description":"Creates a new `manual-allocation` attached to the given document.\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}},{"name":"invoices_mark_paid","description":"Mutates the state machine of the document. Some transitions are restricted by role.\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"},"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."}},{"name":"invoices_send","description":"Renders the document as a PDF, attaches it, and emails it to the configured recipients.\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"}},"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}},{"name":"invoices_update","description":"Replaces an existing document. All required fields must be supplied — omitted fields revert to their schema defaults.\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"}]},"currency":{"type":"string","minLength":1},"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"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"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"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatorVersion":{"type":"string"},"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"}]}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData"],"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"}]},"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","documentType","status","direction","inDispute","currency","exchangeRate","issueDate","dueDate","payUntil","paymentMethod","paymentDate","receiptNumber","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","generatorVersion","vatAllocationNumber","countrySpecificData","items","createdAt","updatedAt"],"additionalProperties":false}},{"name":"invoices_update_patch","description":"Updates an existing document. Only the fields present in the request body are changed; omitted fields stay as-is.\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"}]},"currency":{"type":"string","minLength":1},"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"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"bankAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoiceNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentType":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"inDispute":{"type":"boolean"},"currency":{"type":"string"},"exchangeRate":{"anyOf":[{"type":"number"},{"type":"null"}]},"issueDate":{"type":"string"},"dueDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"payUntil":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"paymentDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiptNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"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"}]}},"required":["id","amount","allocated","paidAt","method"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatorVersion":{"type":"string"},"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"}]}},"required":["id","name","country","registrationNumber","address","icon","countrySpecificData"],"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"}]},"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","documentType","status","direction","inDispute","currency","exchangeRate","issueDate","dueDate","payUntil","paymentMethod","paymentDate","receiptNumber","subtotal","taxRate","taxAmount","total","paidAmount","payments","notes","generatorVersion","vatAllocationNumber","countrySpecificData","items","createdAt","updatedAt"],"additionalProperties":false}},{"name":"logistics_create","description":"Creates a new item in the target organization. Returns the created record on success.\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}},{"name":"logistics_delete","description":"Deletes the item. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"logistics_get","description":"Fetches a single item by id. Returns 404 if the item isn't in the caller's accessible organizations.\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}},{"name":"logistics_list","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},"meta":{"ui":{"resourceUri":"ui://guliel/inventory"},"ui/resourceUri":"ui://guliel/inventory","openai/outputTemplate":"ui://guliel/inventory"}},{"name":"logistics_movements","description":"Returns every `movements` row associated with the given item.\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}},{"name":"logistics_stock","description":"Creates a new `stock` attached to the given 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."}},{"name":"logistics_update","description":"Replaces an existing item. All required fields must be supplied — omitted fields revert to their schema defaults.\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}},{"name":"logistics_update_patch","description":"Updates an existing item. Only the fields present in the request body are changed; omitted fields stay as-is.\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}},{"name":"orders_create","description":"Creates a new order in the target organization. Returns the created record on success.\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}},{"name":"orders_delete","description":"Deletes the order. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"orders_get","description":"Fetches a single order by id. Returns 404 if the order isn't in the caller's accessible organizations.\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}},{"name":"orders_get_get","description":"Fetches a single supplier order by id. Returns 404 if the supplier order isn't in the caller's accessible organizations.\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}},{"name":"orders_list","description":"Lists orders the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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}},{"name":"orders_list_get","description":"Lists supplier orders the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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."}},{"name":"orders_status","description":"Mutates the state machine of the order. Some transitions are restricted by role.\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."}},{"name":"orders_update","description":"Replaces an existing order. All required fields must be supplied — omitted fields revert to their schema defaults.\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}},{"name":"orders_update_patch","description":"Updates an existing order. Only the fields present in the request body are changed; omitted fields stay as-is.\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}},{"name":"organizations_create","description":"Creates a new organization in the target organization. Returns the created record on success.\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"},"icon":{"type":"string"},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"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"}]},"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","createdAt","updatedAt"],"additionalProperties":false}},{"name":"organizations_delete","description":"Deletes the organization. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\n\n(Scope: organizations:write · endpoint: DELETE /api/organizations/{id})","http":{"method":"DELETE","path":"/api/organizations/{id}"},"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}},{"name":"organizations_get","description":"Fetches a single organization by id. Returns 404 if the organization isn't in the caller's accessible organizations.\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"}]},"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","createdAt","updatedAt"],"additionalProperties":false}},{"name":"organizations_icon","description":"Returns every `icon` row associated with the given organization.\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},{"name":"organizations_icon_delete","description":"Removes the association without deleting the underlying record.\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}},{"name":"organizations_icon_post","description":"Creates a new `icon` attached to the given organization.\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"}},"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}},{"name":"organizations_list","description":"Lists organizations the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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"}]},"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","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}},{"name":"organizations_organizations","description":"Returns the `organizations` data for the users feature.\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"}]},"role":{"type":"string","description":"Caller's role in this org — MANAGER | CONTRIBUTOR | VIEWER."}},"required":["id","name","country","icon","registrationNumber","address","countrySpecificData","role"],"additionalProperties":false}}},{"name":"organizations_update","description":"Replaces an existing organization. All required fields must be supplied — omitted fields revert to their schema defaults.\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"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"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"}]},"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","createdAt","updatedAt"],"additionalProperties":false}},{"name":"organizations_update_patch","description":"Updates an existing organization. Only the fields present in the request body are changed; omitted fields stay as-is.\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"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"countrySpecificData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"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"}]},"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","createdAt","updatedAt"],"additionalProperties":false}},{"name":"payments_create","description":"Creates a new payment in the target organization. Returns the created record on success.\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}},{"name":"payments_delete","description":"Deletes the payment. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"reports_get","description":"Fetches a single report by id. Returns 404 if the report isn't in the caller's accessible organizations.\n\n(Scope: reports:read · endpoint: GET /api/reports/{reportType})","http":{"method":"GET","path":"/api/reports/{reportType}"},"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":{}},"outputSchema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Generated report data — shape varies by report type (rows, totals, charts, etc.). See src/lib/reports/types.ts:ReportData and the per-report adapter in src/lib/reports/generators/."}},"required":["success","data"],"additionalProperties":false},"meta":{"ui":{"resourceUri":"ui://guliel/report-viewer"},"ui/resourceUri":"ui://guliel/report-viewer","openai/outputTemplate":"ui://guliel/report-viewer"}},{"name":"reports_list","description":"Lists reports the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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}},{"name":"reports_schema","description":"Returns every `schema` row associated with the given report.\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}},{"name":"settings_list","description":"Lists settingses the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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}},{"name":"settings_refresh","description":"Performs the `refresh` operation for the exchange rates feature.\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}},{"name":"settings_update","description":"Replaces an existing settings. All required fields must be supplied — omitted fields revert to their schema defaults.\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}},{"name":"suppliers_create","description":"Creates a new supplier in the target organization. Returns the created record on success.\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"}]},"acceptedByUserId":{"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","acceptedByUserId","supplierOrganizationId","createdAt","updatedAt"],"additionalProperties":false}},{"name":"suppliers_csv","description":"Streams the caller's suppliers as a CSV file. Filter parameters scope the export the same way the list endpoint does.\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},{"name":"suppliers_delete","description":"Deletes the supplier. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"suppliers_get","description":"Fetches a single supplier by id. Returns 404 if the supplier isn't in the caller's accessible organizations.\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"},"acceptedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"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","acceptedByUserId","supplierOrganizationId","supplierOrganization","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false}},{"name":"suppliers_items","description":"Returns every `items` row associated with the given supplier.\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)."}},{"name":"suppliers_list","description":"Lists suppliers the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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"},"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"}]},"acceptedByUserId":{"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","acceptedByUserId","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}},{"name":"suppliers_resend_invitation","description":"Creates a new `resend-invitation` attached to the given supplier.\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}},{"name":"suppliers_update","description":"Replaces an existing supplier. All required fields must be supplied — omitted fields revert to their schema defaults.\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":[{"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":"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"},"acceptedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"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","acceptedByUserId","supplierOrganizationId","supplierOrganization","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false}},{"name":"suppliers_update_patch","description":"Updates an existing supplier. Only the fields present in the request body are changed; omitted fields stay as-is.\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":[{"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":"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"},"acceptedByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"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","acceptedByUserId","supplierOrganizationId","supplierOrganization","activeOrderCount","createdAt","updatedAt"],"additionalProperties":false}},{"name":"users_create","description":"Creates a new API key in the target organization. Returns the created record on success.\n\n(Scope: users:write · auth: SESSION only · endpoint: POST /api/api-keys)","http":{"method":"POST","path":"/api/api-keys"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"scopes":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","pattern":"^(\\*|invoices|expenses|customers|suppliers|orders|logistics|reports|bank_accounts|organizations|users|automations|integrations|settings):(read|write|\\*)$"}},"allOrgs":{"default":false,"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"expiresAt":{"anyOf":[{"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))$"},{"type":"null"}]}},"required":["name","scopes","allOrgs"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"allOrgs":{"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","name","prefix","scopes","allOrgs","organizationIds","expiresAt","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false},"secret":{"type":"string"}},"required":["key","secret"],"additionalProperties":false}},{"name":"users_create_post","description":"Creates a new invitation in the target organization. Returns the created record on success.\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"},"token":{"type":"string","description":"Pre-signed acceptance token — never expose to the invitee in the UI directly; deliver via email link only."},"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","token","status","invitedById","acceptedById","expiresAt","createdAt","updatedAt"],"additionalProperties":false}},{"name":"users_create_post_2","description":"Creates a new user in the target organization. Returns the created record on success.\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}},{"name":"users_delete","description":"Deletes the API key. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\n\n(Scope: users:write · auth: SESSION only · endpoint: DELETE /api/api-keys/{id})","http":{"method":"DELETE","path":"/api/api-keys/{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":{"revokedAt":{"type":"string"}},"required":["revokedAt"],"additionalProperties":false}},{"name":"users_delete_delete","description":"Deletes the invitation. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"users_delete_delete_2","description":"Deletes the notification. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\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}},{"name":"users_delete_delete_3","description":"Deletes the OAuth authorization. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\n\n(Scope: users:write · auth: SESSION only · endpoint: DELETE /api/oauth-authorizations/{id})","http":{"method":"DELETE","path":"/api/oauth-authorizations/{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":{"revokedAt":{"type":"string"},"revokedTokenCount":{"type":"number"}},"required":["revokedAt","revokedTokenCount"],"additionalProperties":false}},{"name":"users_delete_delete_4","description":"Deletes the user. Some endpoints hard-delete the row, others soft-revoke (set `revokedAt`). Check the response shape.\n\n(Scope: users:write · endpoint: DELETE /api/users/{id})","http":{"method":"DELETE","path":"/api/users/{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}},{"name":"users_get","description":"Fetches a single API key by id. Returns 404 if the API key isn't in the caller's accessible organizations.\n\n(Scope: users:read · auth: SESSION only · endpoint: GET /api/api-keys/{id})","http":{"method":"GET","path":"/api/api-keys/{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":{"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"allOrgs":{"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","name","prefix","scopes","allOrgs","organizationIds","expiresAt","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}},"required":["key"],"additionalProperties":false}},{"name":"users_get_get","description":"Fetches a single OAuth authorization by id. Returns 404 if the OAuth authorization isn't in the caller's accessible organizations.\n\n(Scope: users:read · auth: SESSION only · endpoint: GET /api/oauth-authorizations/{id})","http":{"method":"GET","path":"/api/oauth-authorizations/{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":{"authorization":{"type":"object","properties":{"id":{"type":"string"},"clientId":{"type":"string"},"clientName":{"type":"string"},"clientLogoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"clientHomepageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"clientDescription":{"anyOf":[{"type":"string"},{"type":"null"}]},"isFirstParty":{"type":"boolean"},"scopes":{"type":"array","items":{"type":"string"}},"allOrgs":{"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"tokens":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"prefix":{"type":"string"},"expiresAt":{"type":"string"},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","prefix","expiresAt","lastUsedAt","createdAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","clientId","clientName","clientLogoUrl","clientHomepageUrl","clientDescription","isFirstParty","scopes","allOrgs","organizationIds","tokens","createdAt","updatedAt"],"additionalProperties":false}},"required":["authorization"],"additionalProperties":false}},{"name":"users_get_get_2","description":"Fetches a single user by id. Returns 404 if the user isn't in the caller's accessible organizations.\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}},{"name":"users_list","description":"Lists API keys the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\n\n(Scope: users:read · auth: SESSION only · endpoint: GET /api/api-keys)","http":{"method":"GET","path":"/api/api-keys"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"allOrgs":{"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","name","prefix","scopes","allOrgs","organizationIds","expiresAt","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}}},"required":["keys"],"additionalProperties":false}},{"name":"users_list_get","description":"Lists invitations the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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"},"token":{"type":"string","description":"Pre-signed acceptance token — never expose to the invitee in the UI directly; deliver via email link only."},"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","token","status","invitedById","acceptedById","expiresAt","createdAt","updatedAt"],"additionalProperties":false}}},"required":["invitations"],"additionalProperties":false}},{"name":"users_list_get_2","description":"Lists notifications the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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}},{"name":"users_list_get_3","description":"Lists OAuth authorizations the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\n\n(Scope: users:read · auth: SESSION only · endpoint: GET /api/oauth-authorizations)","http":{"method":"GET","path":"/api/oauth-authorizations"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{},"additionalProperties":false},"outputSchema":{"type":"object","properties":{"authorizations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"clientId":{"type":"string"},"clientName":{"type":"string"},"clientLogoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"clientHomepageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"isFirstParty":{"type":"boolean"},"scopes":{"type":"array","items":{"type":"string"}},"allOrgs":{"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"activeTokenCount":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","clientId","clientName","clientLogoUrl","clientHomepageUrl","isFirstParty","scopes","allOrgs","organizationIds","lastUsedAt","activeTokenCount","createdAt","updatedAt"],"additionalProperties":false}}},"required":["authorizations"],"additionalProperties":false}},{"name":"users_list_get_4","description":"Lists users the caller can see. Results are filtered by the caller's accessible organizations; many routes paginate via `page` and `limit`.\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}},{"name":"users_mark_all_read","description":"Performs the `mark-all-read` operation for the notifications feature.\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}},{"name":"users_members","description":"Returns every `members` row associated with the given organization.\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}},{"name":"users_members_delete","description":"Removes the association without deleting the underlying record.\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}},{"name":"users_members_patch","description":"Mutates the `members` attached to the given organization.\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}},{"name":"users_members_post","description":"Creates a new `members` attached to the given organization.\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}},{"name":"users_resend","description":"Creates a new `resend` attached to the given 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."}},{"name":"users_search","description":"Returns the `search` data for the users feature.\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}},{"name":"users_update","description":"Updates an existing API key. Only the fields present in the request body are changed; omitted fields stay as-is.\n\n(Scope: users:write · auth: SESSION only · endpoint: PATCH /api/api-keys/{id})","http":{"method":"PATCH","path":"/api/api-keys/{id}"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":80},"expiresAt":{"anyOf":[{"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))$"},{"type":"null"}]}},"required":["id"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"allOrgs":{"type":"boolean"},"organizationIds":{"type":"array","items":{"type":"string"}},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","name","prefix","scopes","allOrgs","organizationIds","expiresAt","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}},"required":["key"],"additionalProperties":false}},{"name":"users_update_patch","description":"Updates an existing notification. Only the fields present in the request body are changed; omitted fields stay as-is.\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}},{"name":"users_update_patch_2","description":"Updates an existing user. Only the fields present in the request body are changed; omitted fields stay as-is.\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}},{"name":"users_update_put","description":"Replaces an existing user. All required fields must be supplied — omitted fields revert to their schema defaults.\n\n(Scope: users:write · endpoint: PUT /api/users/{id})","http":{"method":"PUT","path":"/api/users/{id}"},"feature":"users","verb":"write","scope":"users:write","hasBody":true,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"password":{"type":"string","minLength":6}},"required":["id"],"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}},{"name":"users_usage","description":"Returns the caller's recent request log for the API key (last 7 days by default).\n\n(Scope: users:read · auth: SESSION only · endpoint: GET /api/api-keys/{id}/usage)","http":{"method":"GET","path":"/api/api-keys/{id}/usage"},"feature":"users","verb":"read","scope":"users:read","hasBody":false,"inputSchema":{"type":"object","properties":{"id":{"type":"string"},"limit":{"default":50,"type":"integer","minimum":1,"maximum":200},"sinceDays":{"default":7,"type":"integer","minimum":1,"maximum":365}},"required":["id","limit","sinceDays"],"additionalProperties":false},"outputSchema":{"type":"object","properties":{"totals":{"type":"object","properties":{"callCount":{"type":"number"},"errorCount":{"type":"number"},"avgDurationMs":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["callCount","errorCount","avgDurationMs"],"additionalProperties":false},"byFeature":{"type":"array","items":{"type":"object","properties":{"feature":{"anyOf":[{"type":"string"},{"type":"null"}]},"calls":{"type":"number"},"errors":{"type":"number"}},"required":["feature","calls","errors"],"additionalProperties":false}},"recent":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"method":{"type":"string"},"path":{"type":"string"},"feature":{"anyOf":[{"type":"string"},{"type":"null"}]},"verb":{"anyOf":[{"type":"string"},{"type":"null"}]},"statusCode":{"type":"number"},"errorCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationMs":{"type":"number"},"organizationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","method","path","feature","verb","statusCode","errorCode","durationMs","organizationId","createdAt"],"additionalProperties":false}}},"required":["totals","byFeature","recent"],"additionalProperties":false}}]}