Update project allocations
well_update_project_allocationsSet the project split of a journal entry's revenue and expense lines: every selected line carries the same split, and the percents of one line add up to exactly 100.
Use this to allocate revenue or expense to projects (cost centers, campaigns, deals). Name exactly one source the split hangs on:
journal_entry_id — the journal entry itself, obtained with well_query_records on the journal_entries view, whose primary key is journal_entry_id, or from the entry the person names. The only source a DRAFT entry accepts.
invoice_id — a live invoice of this workspace. Its posted journal entry takes the split. Until it is posted, the split rides the invoice's live items, and the posted entry takes it over when the invoice is posted. Never an invoice item id.
transaction_id — a live bank transaction of this workspace. Its posted journal entry takes the split, whether the entry books the transaction directly or through a legacy invoice-transaction link. Never an expense claim without a posted entry.
REQUIRED: exactly one of journal_entry_id, invoice_id, transaction_id; and splits. OPTIONAL: journal_entry_line_ids — only with journal_entry_id; the live lines to split; absent, every live revenue and expense line of the entry takes it. OPTIONAL: selected_journal_entry_id — only with invoice_id or transaction_id when the source posts through several eligible posted entries; the numbered refusal names each candidate with its journal_entry_id, so ask the person which one and call again with this field set. Never invent a journal_entry_id that the refusal did not list.
A transaction source must already be posted (its journal entry VALIDATED or LOCKED, not reversed). An unposted transaction, a reversed one with no current eligible posting, or a source of another workspace refuses with no card and no write. An invoice source with no eligible posting writes on its items; it refuses only when the invoice has no readable side (a draft without issuer, or no confirmed own company). Two eligible postings refuse with the numbered list — never pick one yourself. Read the projects first with well_list_projects.
On a draft entry the split rides the lines until validation; on an already posted entry it writes the allocation rows at once, replacing any split those lines already carry. A second call with the same split writes nothing. A line that is not a live revenue or expense line, or an entry with none of them, is refused and nothing is written. A person confirms the split on a card before anything is written.
Returns { success: true, allocation: { entry_id, lines_changed, rows_written } } on success (entry_id is null when the items of an unposted invoice took the split), or { success: false, error } on failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| splits | Yes | The split every selected line takes: distinct live projects whose percents total exactly 100. | |
| invoice_id | No | A live invoice of this workspace, as an alternative source: its posted (VALIDATED or LOCKED, not reversed) journal entry takes the split. Exactly one of journal_entry_id, invoice_id or transaction_id is required. | |
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several — a write lands in exactly one workspace and this call would not say which. | |
| transaction_id | No | A live bank transaction of this workspace, as an alternative source: its posted (VALIDATED or LOCKED, not reversed) journal entry takes the split, whether the entry books the transaction directly or through a legacy invoice-transaction link. Exactly one of journal_entry_id, invoice_id or transaction_id is required. | |
| conversation_id | No | The conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation. | |
| idempotency_key | No | Optional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation. | |
| workspace_scope | No | Restrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace. | |
| journal_entry_id | No | The journal entry whose lines take the split; the only source a draft entry accepts. Exactly one of journal_entry_id, invoice_id or transaction_id is required. | |
| journal_entry_line_ids | No | Only with journal_entry_id: the live journal entry lines to split; absent, every live revenue and expense line of the entry takes it. | |
| selected_journal_entry_id | No | Only with invoice_id or transaction_id: the journal entry to link when the source posts through several eligible entries; one of the entries the source resolved to, revalidated under the write lock. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| error | No | ||
| success | Yes | ||
| allocation | No | ||
| reply_lines | No | ||
| conversation_id | No | The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation. | |
| near_candidates | No | ||
| newly_connected | No | Tools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later. | |
| conversation_id_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| conversation_id_source | No | Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened. | |
| near_candidates_truncated | No |