patch_vouchers_batches_by_id
Calls PATCH /api/vouchers/batches/{id} as the signed-in person · REST reference
Resize a voucher batch through its holder's allocation
Sets the batch to quantity vouchers, in one DAL transaction. GROWING mints the difference under exactly the guards a new batch is minted under — the holder may hold a batch, its allocation covers the growth, the voucher pool covers it — and debits the holder. A grow prints nothing: a grown PHYSICAL batch's new vouchers are NOT_PRINTED until the batch is printed (POST /api/vouchers/batches/{id}/print, which sends exactly the vouchers no printer has). SHRINKING voids the newest vouchers that are still unissued (CREATED or ASSIGNED) and credits their value back to the holder; it is refused with 409 when too few are unissued, and the message names the lowest quantity the batch can go to. A slot already dead — a voucher voided or expired and never replaced — needs no voucher voided, but its value is credited when the target drops past it. Refused with 409 for a batch REQUEST (REQUESTED/DENIED — those are decided, not resized) or for growing a batch whose vouchers have expired. The same quantity the batch already has is a no-op. Requires execute:CreateVoucherBatchCommand: growing a batch is minting.
Arguments
| Argument | Type | Description | |
|---|---|---|---|
idpath | string (uuid) | required | Batch id. |
bodyJSON | object | required | The request body, as a JSON object. Its fields are listed below. |
Fields of body
| Field | Type | Description | |
|---|---|---|---|
quantity | integer | required | The new number of vouchers. 0 releases the whole batch (see DELETE). |
reason | string | Recorded as the void reason on vouchers a shrink releases. |
Example call
A client sends this over the MCP session; Claude and other agents build it for you. The values are placeholders — the shape is real.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "patch_vouchers_batches_by_id",
"arguments": {
"id": "11111111-1111-4111-8111-111111111111",
"body": {
"quantity": 1,
"reason": "string"
}
}
}
}Result
On success (HTTP 200) the tool returns one text item holding the API's JSON, pretty-printed.
The batch was resized (or already had that quantity).
{
"allocationCredited": 1,
"allocationDebited": 1,
"batchId": "11111111-1111-4111-8111-111111111111",
"previousQuantity": 1,
"quantity": 1,
"vouchersMinted": 1,
"vouchersReleased": 1,
"assignedTo": "11111111-1111-4111-8111-111111111111"
}Fields
| Field | Type | Description |
|---|---|---|
allocationCredited | integer | CENTS returned to the holder's allocation by a shrink. |
allocationDebited | integer | CENTS drawn from the holder's allocation by a grow. |
assignedTo | string (uuid) | null | |
batchId | string (uuid) | |
previousQuantity | integer | |
quantity | integer | |
vouchersMinted | integer | Vouchers a grow minted (CREATED). 0 for a shrink. |
vouchersReleased | integer | Vouchers a shrink voided. 0 for a grow. |
When it fails
A failed call returns isError: true with the API's message as text. A change the person declines, or lets time out, also comes back this way and nothing changes.
400The request was malformed or failed a guard.
403Authenticated, but the caller holds none of the required permissions.
404No such resource — or none this caller may see.
409The resource is not in a state that allows this operation.
What the model is shown
This is the tool exactly as the server lists it in tools/list. The description starts with the REST call it makes.
{
"name": "patch_vouchers_batches_by_id",
"description": "PATCH /api/vouchers/batches/{id} — Sets the batch to `quantity` vouchers, in one DAL transaction. GROWING mints the difference under exactly the guards a new batch is minted under — the holder may hold a batch, its allocation covers the growth, the voucher pool covers it — and debits the holder. A grow prints nothing: a grown PHYSICAL batch's new vouchers are NOT_PRINTED until the batch is printed (`POST /api/vouchers/batches/{id}/print`, which sends exactly the vouchers no printer has). SHRINKING voids the newest vouchers that are still unissued (CREATED or ASSIGNED) and credits their value back to the holder; it is refused with 409 when too few are unissued, and the message names the lowest quantity the batch can go to. A slot already dead — a voucher voided or expired and never replaced — needs no voucher voided, but its value is credited when the target drops past it. Refused with 409 for a batch REQUEST (REQUESTED/DENIED — those are decided, not resized) or for growing a batch whose vouchers have expired. The same `quantity` the batch already has is a no-op. Requires `execute:CreateVoucherBatchCommand`: growing a batch is minting.\n\nThis changes data. The person is asked to confirm it before it runs, and nothing happens if they decline.",
"inputSchema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Batch id."
},
"body": {
"type": "string",
"description": "The JSON request body: { quantity*: integer (The new number of vouchers.); reason: string (Recorded as the void reason on vouchers a shrink releases.) }"
}
},
"required": [
"id",
"body"
]
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
}