Mercury: Edit a bill (accounts payable)
Mercury books.updateBooksBill: arguments, response, policy and SDK examples.
← Books operations · Get started
Operation mercury.updatebooksbill
Provider route: PATCH /books/bill/{billId}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/mercury with npm, or alter-sdk-mercury with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { MercuryIntegration } from "@alter-ai/mercury";
async function execute(input: Parameters<MercuryIntegration["books"]["updateBooksBill"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new MercuryIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.books.updateBooksBill(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_mercury import MercuryIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = MercuryIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.books.update_books_bill(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.billId | string | Required within parent | The ID of the bill to edit, as returned by createBooksBill. Format: base58 (max length 22) |
query | object | Optional | Additional keys: not allowed |
query.booksId | string | Optional | The Books instance to act on. Required for agent organization tokens; defaults to the token organization’s instance. Format: uuid |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | string | Optional | |
body | Model | Optional | Expand Edit a bill (accounts payable) — request body — body |
Referenced models: Edit a bill (accounts payable) — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Edit a bill (accounts payable) — response body |
Referenced models: Edit a bill (accounts payable) — response body
Schemas
Section titled “Schemas”3 more schemas are linked from the tables above, on the schema pages.
Edit a bill (accounts payable) — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A bill (accounts payable) recorded in Books, with its lines and the payments applied to it. |
amountRemaining | JSON | Required within parent | |
amountRemaining (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amountRemaining (allOf 2) | JSON | All variants apply | The amount still owed after applied payments, in dollars. |
displayStatus | JSON | Required within parent | |
displayStatus (allOf 1) | string | All variants apply | Known values: open, paid, draft, cancelled, overdue, partiallyPaid, processing |
displayStatus (allOf 2) | JSON | All variants apply | The status as shown to users, derived from `status`, the due date, and payments: also `overdue` (open and past due) and `partiallyPaid` (open with some payment applied). |
dueDate | JSON | Optional | |
dueDate (anyOf 1) | JSON | Alternative | |
dueDate (anyOf 1) (allOf 1) | string | All variants apply | Format: date |
dueDate (anyOf 1) (allOf 2) | JSON | All variants apply | The due date. Omitted when none is set. |
dueDate (anyOf 2) | null | Alternative | |
effectiveDate | JSON | Required within parent | |
effectiveDate (allOf 1) | string | All variants apply | Format: date |
effectiveDate (allOf 2) | JSON | All variants apply | The bill date. |
grossAmount | JSON | Required within parent | |
grossAmount (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
grossAmount (allOf 2) | JSON | All variants apply | The total of all lines, in dollars. |
id | string | Required within parent | The identifier of the bill. Format: base58 (max length 22) |
lines | array | Required within parent | The line items. |
lines[] | Model | Each item | Expand Edit a bill (accounts payable) — response body — lines item |
notes | JSON | Optional | |
notes (anyOf 1) | string | Alternative | The bill's notes or memo. Omitted when it has none. |
notes (anyOf 2) | null | Alternative | |
paymentApplications | array | Required within parent | The payments applied. Empty when none. |
paymentApplications[] | Model | Each item | Expand Edit a bill (accounts payable) — response body — payment Applications item |
referenceNumber | JSON | Optional | |
referenceNumber (anyOf 1) | string | Alternative | The bill number. Omitted when it has none. |
referenceNumber (anyOf 2) | null | Alternative | |
status | JSON | Required within parent | |
status (allOf 1) | string | All variants apply | Known values: open, paid, draft, cancelled, processing |
status (allOf 2) | JSON | All variants apply | The stored lifecycle status: `draft`, `open`, `processing`, `paid`, or `cancelled`. |
vendor | JSON | Optional | |
vendor (anyOf 1) | JSON | Alternative | |
vendor (anyOf 1) (allOf 1) | Model | All variants apply | Expand Edit a bill (accounts payable) — response body — vendor id, name id, name |
vendor (anyOf 1) (allOf 2) | JSON | All variants apply | The vendor the bill is owed to. Omitted when the bill has no vendor. |
vendor (anyOf 2) | null | Alternative |
Referenced models: Create a product — response body — unit Price value, Edit a bill (accounts payable) — response body — lines item, Edit a bill (accounts payable) — response body — payment Applications item, Edit a bill (accounts payable) — response body — vendor id, name id, name
Edit a bill (accounts payable) — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A request to edit a single bill (accounts payable). Every field is optional; an omitted field is left unchanged. Additional keys: not allowed |
dueDate | JSON | Optional | |
dueDate (anyOf 1) | JSON | Alternative | |
dueDate (anyOf 1) (allOf 1) | string | All variants apply | Format: date |
dueDate (anyOf 1) (allOf 2) | JSON | All variants apply | A new due date for the bill. |
dueDate (anyOf 2) | null | Alternative | |
effectiveDate | JSON | Optional | |
effectiveDate (anyOf 1) | JSON | Alternative | |
effectiveDate (anyOf 1) (allOf 1) | string | All variants apply | Format: date |
effectiveDate (anyOf 1) (allOf 2) | JSON | All variants apply | A new effective date for the bill (e.g. the bill date). |
effectiveDate (anyOf 2) | null | Alternative | |
lineChanges | JSON | Optional | |
lineChanges (anyOf 1) | JSON | Alternative | |
lineChanges (anyOf 1) (allOf 1) | Model | All variants apply | Expand Edit a bill (accounts payable) — request body — body line Changes Changes to the bill's line items create, delete, update |
lineChanges (anyOf 1) (allOf 2) | JSON | All variants apply | Changes to the bill's line items. |
lineChanges (anyOf 2) | null | Alternative | |
notes | JSON | Optional | |
notes (anyOf 1) | string | Alternative | New notes or memo for the bill. |
notes (anyOf 2) | null | Alternative | |
referenceNumber | JSON | Optional | |
referenceNumber (anyOf 1) | string | Alternative | A new reference number (e.g. the vendor's bill number). Non-empty; leading and trailing whitespace is stripped. Clearing the reference number is not supported. Maximum length: 299 Minimum length: 1 |
referenceNumber (anyOf 2) | null | Alternative | |
vendor | JSON | Optional | |
vendor (anyOf 1) | JSON | Alternative | |
vendor (anyOf 1) (allOf 1) | string | All variants apply | ID for this books counterparty Format: uuid |
vendor (anyOf 1) (allOf 2) | JSON | All variants apply | A new vendor for the bill, as a canonical Books counterparty ID. Unlike create, a recipient alias is not accepted on edit. |
vendor (anyOf 2) | null | Alternative |
Referenced models: Edit a bill (accounts payable) — request body — body line Changes Changes to the bill's line items create, delete, update
Create a product — response body — unit Price value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | number | Alternative | A dollar amount Format: double |
$ (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Edit a bill (accounts payable) — response body — lines item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A line item of a bill. |
amount | JSON | Required within parent | |
amount (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amount (allOf 2) | JSON | All variants apply | The line's amount, in dollars. |
description | string | Required within parent | The line's description. |
id | string | Required within parent | The identifier of the line. Format: base58 (max length 22) |
ledgerId | string | Required within parent | The identifier of the ledger (general ledger account) the line posts to, such as an expense ledger. Format: base58 (max length 22) |
Referenced models: Create a product — response body — unit Price value
Edit a bill (accounts payable) — response body — payment Applications item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A payment applied to a bill: part or all of a journal entry line entry, such as a bank transaction's, matched against it. |
amount | JSON | Required within parent | |
amount (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amount (allOf 2) | JSON | All variants apply | The amount of the line entry applied to this bill, in dollars. |
lineEntryId | string | Required within parent | The identifier of the line entry applied as payment. Format: base58 (max length 22) |
Referenced models: Create a product — response body — unit Price value
Edit a bill (accounts payable) — response body — vendor id, name id, name
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The vendor a bill is owed to. The id is the Books counterparty id (never a Bill Pay recipient id); the name is inlined because there is no public counterparties endpoint yet, so a bare id would be unusable. |
id | JSON | Required within parent | |
id (allOf 1) | string | All variants apply | ID for this books counterparty Format: uuid |
id (allOf 2) | JSON | All variants apply | The Books counterparty ID of the vendor. This is not a recipient ID. |
name | string | Required within parent | The vendor's name. When the counterparty is linked to a Bill Pay recipient, this is the recipient's current name; otherwise it falls back to the name snapshotted on the Books counterparty. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: mercury.updatebooksbill. Catalog operation: mercury:updateBooksBill. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.