# invoices.groups.save

Create or revise a shared billing group. Give project, context and currency. Optional plan allocates selected items or phases to 2–50 independent businesses by explicit percentages or fixed minor units. Every item must reconcile exactly. No default split or inferred tax. Does not change existing invoices.

`POST /api/v1/accounting/invoices.groups.save`

Permissions: `accounting:read`, `accounting:write` · Roles: admin, finance · Idempotency key required · Send `expectedRevision`

MCP tool: `accounting_invoices_groups_save`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `projectId` | string (ID) | Yes | The ID of the related record. |
| `name` | string | Yes | A display name. 1–200 characters. |
| `context` | string |  | at most 500 characters. Default `""`. |
| `currency` | string | Yes | Three-letter currency code, such as CAD or USD. |
| `plan` | object or null | Yes |  |
| `plan.items` | array of objects | Yes | 1–100 items. |
| `plan.items[].id` | string | Yes | The record's ID. 1–64 characters. |
| `plan.items[].scope` | string |  | at most 200 characters. |
| `plan.items[].line` | object | Yes | No other fields. |
| `plan.items[].line.id` | string |  | The record's ID. at most 64 characters. |
| `plan.items[].line.description` | string | Yes | A short description. 1–500 characters. |
| `plan.items[].line.quantity` | string |  |  |
| `plan.items[].line.unitAmountMinor` | string |  | An amount in cents (the currency's smallest unit), written as a whole-number string such as "1250" for $12.50. Whole number written as a string, may be negative. |
| `plan.items[].line.isHeader` | boolean |  |  |
| `plan.items[].line.taxCode` | enum |  | One of: `standard`, `exempt`, `zero_rated`. |
| `plan.allocations` | array of objects | Yes | 1–100 items. |
| `plan.allocations[].itemIds` | array of strings | Yes | A list of record IDs. 1–100 items; each 1–64 characters. |
| `plan.allocations[].method` | enum | Yes | One of: `percent`, `fixed`. |
| `plan.allocations[].shares` | array of objects | Yes | 2–50 items. |
| `plan.allocations[].shares[].partyId` | string (ID) | Yes | The ID of a customer or vendor account, from parties.list. |
| `plan.allocations[].shares[].value` | string | Yes | Matches ^\d{1,18}(?:\.\d{1,4})?$. |
| `plan.payers` | array of objects | Yes | 2–50 items. |
| `plan.payers[].partyId` | string (ID) | Yes | The ID of a customer or vendor account, from parties.list. |
| `plan.payers[].billToContactId` | string or null |  |  |
| `plan.payers[].taxTreatment` | enum | Yes | One of: `hst`, `gst`, `gst_qst`, `zero_rated`, `exempt`, `none`, `custom`. |
| `plan.payers[].taxRateCode` | string or null |  |  |
| `plan.payers[].issueDate` | string |  | The date the document was issued, as YYYY-MM-DD. |
| `plan.payers[].dueDate` | string |  | The date payment is due, as YYYY-MM-DD. |
| `plan.payers[].terms` | object |  | No other fields. |
| `plan.payers[].terms.code` | enum | Yes | One of: `due_on_receipt`, `net_7`, `net_15`, `net_30`, `net_45`, `net_60`, `custom`, `split_50_50`, `monthly`. |
| `plan.payers[].terms.days` | integer or null |  |  |
| `id` | string (ID) |  | The record's ID. |
| `expectedRevision` | integer |  | The record's current revision, from the last time you read it. If someone changed the record since, the request is refused with a conflict so you can reload and check before trying again. at most 9007199254740991; greater than 0. |
| `idempotencyKey` | string | Yes | Any unique text you generate once per intended change, so a retried request only happens once. Send it as the Idempotency-Key header instead if you prefer; if you send both they must match. 8–200 characters. |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/invoices.groups.save \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "projectId": "4d5e6f7a-8b9c-4d0e-8f1a-2b3c4d5e6f7a",
  "name": "Synthetic Ventures Inc.",
  "currency": "CAD",
  "plan": {
    "items": [
      {
        "id": "example",
        "line": {
          "description": "Synthetic example from the docs",
          "unitAmountMinor": "1250"
        }
      }
    ],
    "allocations": [
      {
        "itemIds": [
          "example"
        ],
        "method": "percent",
        "shares": [
          {
            "partyId": "7f0f6c1e-1c1f-4b5e-9c8d-2f5e8e3c1a10",
            "value": "1"
          },
          {
            "partyId": "7f0f6c1e-1c1f-4b5e-9c8d-2f5e8e3c1a10",
            "value": "1"
          }
        ]
      }
    ],
    "payers": [
      {
        "partyId": "7f0f6c1e-1c1f-4b5e-9c8d-2f5e8e3c1a10",
        "taxTreatment": "hst"
      },
      {
        "partyId": "7f0f6c1e-1c1f-4b5e-9c8d-2f5e8e3c1a10",
        "taxTreatment": "hst"
      }
    ]
  }
}'
```

Reference page: https://app.getoatmilk.com/docs/api/invoices.groups.save
