# Invoices

> Solarium docs. All requests are `POST https://api.trysolarium.com/graphql/` with `Authorization: Bearer <api key>` and a JSON body `{"query": ..., "variables": ...}`. Every query and mutation takes an `organizationId` (find it with `myOrganizations`). Index of all pages: https://trysolarium.com/llms.txt

Invoices run through ops: `previewOp` shows what would happen and keeps nothing; `runOp` with `apply: true` does it. Your AI app calls the same ops by name over MCP.

**The flow:** `create_invoice` makes a draft. `send_invoice` gives it the next number in your series, books it to the customer's A/R (revenue and tax collected), and emails the customer the PDF and a link to view it. `test_send_invoice` emails you the same email and PDF first, marked as a test, with nothing booked or numbered. `get_invoice` returns a `preview_pdf_url` (good for 7 days) to download a draft's PDF without sending it. `record_invoice_payment` clears the A/R when money comes in (never revenue a second time). `void_invoice` takes a sent invoice off the books.

**Changing the date of a sent invoice:** while nothing is paid on it (sent, viewed or overdue), `update_invoice` with just `issue_date` moves it to another date. The number stays the same, the due date follows its terms, and its A/R entry moves to the new date. If a tax rate changed between the two dates, the tax is worked out again. In another currency it's booked at the Bank of Canada rate for the new date, or at your own if you pass `fx_rate`. The preview lists the old and new date, rate and amount in your books. Nothing is emailed, and the invoice's note (which prints on the PDF) isn't touched. It's refused for a partly paid, paid or void invoice, when either date is in a closed period, and for an invoice in QuickBooks (change it there first). Anything else on a sent invoice can't change: void it and make a new one.

**What the customer sees:** the amount due and its due date first, then how to pay. When your payment instructions name an Interac e-Transfer address, the page offers to copy it and the invoice number. Solarium shows how to pay and never takes the money. The invoice prints your legal name exactly as entered ("Harbour Studio Inc."). Set a `trade_name` in `invoice_settings` and the page, PDF and email lead with it, with "A trade name of" your legal name under it. One legal entity running more than one business can give each invoice its own: pass `trade_name` to `create_invoice` or `update_invoice` for another name, or an empty string for your legal name alone. `use_default_trade_name` puts a draft back on the settings' name. `get_invoice` returns the `trade_name` it prints and `trade_name_source` (`settings` or `override`). Like the rest of a sent invoice, its trade name can't change once it's sent. Billed To prints the customer's legal name (or their name), an Attn: line for their contact person, their billing address and every email the invoice goes to. Set those with `create_contact` or `update_contact`.

**Changing a draft's customer:** pass `contact_id`, or `customer_name` matching a customer you already have (their name or legal name, any case). A name that matches no one is refused, never added as a new empty customer. Add them first with `create_contact`.

**Numbers** come from one series per business (`INV-00001` by default). Change the prefix or continue an existing series with `invoice_settings`. A number already used is never handed out again.

**Invoices made elsewhere:** `import_invoice_pdf` reads your own PDF and keeps your number and your tax as printed.

**An invoice you already booked by hand:** when the A/R is already in your books (DR A/R, CR revenue, CR tax collected), pass that entry as `adopt_event_id` to `import_invoice_pdf`, or tie a draft to it with `link_invoice_to_entry`. The invoice uses that entry as its booking instead of booking A/R a second time. It's marked sent on the entry's date, and payments you record later clear that A/R. Nothing new is posted, nothing goes to QuickBooks and no email is sent. It's refused unless the entry is booked and not voided, isn't already an invoice's, is in the invoice's currency with its whole total on A/R, has the same tax, is for the same customer and has the same date. An entry with no customer gets the invoice's, and the preview says so. Pass `date_tolerance_days` to accept an entry a few days off the invoice's date.

**Getting paid:** when a deposit in the bank feed matches an open invoice, `invoice_payment_matches` suggests it, and `invoice_deposit_matches` finds the deposit from the invoice's side. Nothing is marked paid until you record it, with the deposit as `source_event_id`. A deposit already booked as income in Solarium can still be linked (that booking is undone). A customer's payment already booked another way (as a transfer, or a deposit already in QuickBooks) is linked in place: its credit becomes that customer's A/R and nothing is booked twice. `remove_invoice_payment` undoes a payment, and puts a payment linked in place back as it was.

**Writing to the Solarium team:** `message_solarium_team` posts to your conversation with the team (the same one as your texts and emails), and `get_solarium_messages` reads it back with their replies.

**Other currencies:** an invoice can be in USD, EUR, GBP, AUD or JPY while your books stay in your own currency. Sending books it at the Bank of Canada rate on the issue date (`get_fx_rate` shows it), or at your own rate if you pass `fx_rate`. A payment into an account in your books' currency records what landed (`amount_home`). A payment into an account in the invoice's currency (a USD account) is valued at that day's rate, since nothing was converted. Any bank fee (`fee`, in the account's currency) goes to Bank Fees & Charges. Landed plus the fee is what the payment converted to. Only its difference from the invoice's rate goes to Exchange Gain or Loss, and the customer's A/R clears exactly.

**Reminders** go out 3 days before the due date, on it, and 7 and 14 days after, unless they're turned off for the invoice or the customer.

## Create An Invoice

A draft invoice. Lines are before tax. Tax is worked out from each line's sales_tax_code at the rates where the customer is, on the issue date.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `UUID!` | Yes | Organization ID |
| `name` | `String!` | Yes | "create_invoice" |
| `params.customer_name` | `String` | No | Finds or adds the customer (or pass contact_id). On update_invoice it must match a customer you already have |
| `params.customer_email` | `String` | No | Who the invoice is emailed to: one or more emails, comma-separated. Saved on the customer, so the next invoice and reminders go there too |
| `params.customer_region` | `String` | No | The customer's province, as a code (NS) or its name. Saved on the customer. Tax follows it: a Nova Scotia customer pays Nova Scotia HST, and a customer in a GST-only province pays GST alone. Leave it out to tax at your own province's rates |
| `params.lines` | `[Object!]!` | Yes | Each: description, unit_price, quantity (default 1), revenue_account_id, sales_tax_code (one of your tax options from invoice_settings, e.g. hst in Ontario, st_ny in New York), tax_amount (needed where tax isn't worked out from a rate, like US sales tax) |
| `params.terms_days` | `Int` | No | Days to pay (default 30) |
| `params.currency` | `String` | No | CAD, USD, EUR, GBP, AUD or JPY. Default: the customer's usual currency, else your books' own |
| `params.fx_rate` | `String` | No | Other currencies: your books' currency per 1 of the invoice's (1.3684). Default: the Bank of Canada rate on the issue date |
| `params.number` | `String` | No | Only to use your own number |
| `params.trade_name` | `String` | No | The trade name this invoice leads with, instead of the one in invoice_settings. An empty string prints your legal name alone. Default: the settings' trade name. On update_invoice, use_default_trade_name: true goes back to it |
| `apply` | `Boolean` | No | true to keep it |

### Request

```graphql
mutation {
  runOp(
    organizationId: "a1b2c3d4-..."
    name: "create_invoice"
    apply: true
    params: {
      customer_name: "Milda K"
      customer_email: "milda@example.com"
      terms_days: 15
      lines: [{ description: "October retainer", unit_price: "1000.00", sales_tax_code: "hst" }]
    }
  ) { success applied result }
}
```

### Response

```json
{
  "data": {
    "runOp": {
      "success": true,
      "applied": true,
      "result": {
        "summary": "Draft Invoice For Milda K: CAD 1130.00 (Tax 130.00).",
        "data": { "invoice_id": "9f3c...", "status": "draft", "subtotal": "1000.00", "tax_total": "130.00", "total": "1130.00" }
      }
    }
  }
}
```

## Send An Invoice

Numbers it, books the A/R, and emails the PDF and view link. Sending again just emails it again.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | The invoice |
| `params.to` | `String` | No | Emails to send to, comma-separated (default: the customer's). A customer with no email keeps these |
| `params.fx_rate` | `String` | No | Other currencies: the rate to book at, if not the Bank of Canada's |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "send_invoice", apply: true,
        params: { invoice_id: "9f3c..." }) { success result }
}
```

### Response

```json
{
  "data": {
    "runOp": {
      "success": true,
      "result": {
        "summary": "Sent INV-00024 To milda@example.com: CAD 1130.00, Booked To Milda K's A/R.",
        "data": { "number": "INV-00024", "status": "sent", "public_url": "https://mcp.trysolarium.com/i/...", "balance_due": "1130.00" }
      }
    }
  }
}
```

## Send Yourself A Test

Emails you the exact email and PDF your customer gets, for a draft or a sent invoice. The subject starts with [Test], a banner says your customer didn't get it, and the PDF is stamped TEST. A draft shows Draft where the number goes. Nothing else changes: no number is used, nothing is booked, and the status, sent date and reminders stay as they are. Its View Invoice link is a preview that lasts 7 days and never marks the invoice viewed. Up to 10 a day per invoice. A read-only accountant can't send one.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | The invoice |
| `params.to` | `String` | No | One email (default: yours). Your customer's own email is refused |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "test_send_invoice", apply: true,
        params: { invoice_id: "9f3c..." }) { success result }
}
```

### Response

```json
{
  "data": {
    "runOp": {
      "success": true,
      "result": {
        "summary": "Sent A Test Of Draft To owner@example.com. Your Customer Didn't Get It.",
        "data": { "to": "owner@example.com", "number": "Draft", "status": "draft" }
      }
    }
  }
}
```

## Change A Sent Invoice's Date

Moves a sent invoice with nothing paid on it to another issue date. Same number, due date from its terms, and its A/R entry moved and (in another currency) translated again at the new date's rate. Nothing is emailed.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | The invoice (sent, viewed or overdue, nothing paid) |
| `params.issue_date` | `Date!` | Yes | The new issue date (YYYY-MM-DD). Pass it on its own: nothing else on a sent invoice can change |
| `params.fx_rate` | `String` | No | Other currencies: your own rate for the new date. Default: the Bank of Canada rate on the new date, which replaces a rate you set before |
| `apply` | `Boolean` | No | true to change it. Without it you get the preview |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "update_invoice", apply: true,
        params: { invoice_id: "9f3c...", issue_date: "2026-11-13" }) { success result }
}
```

### Response

```json
{
  "data": {
    "runOp": {
      "success": true,
      "result": {
        "summary": "INV-00027: Issue Date Oct 29 → Nov 13, Due Nov 28 → Dec 13. Rate 1.3684 → 1.4012, CAD 3421.00 → 3503.00.",
        "data": {
          "number": "INV-00027",
          "issue_date": "2026-11-13",
          "due_date": "2026-12-13",
          "date_change": {
            "issue_date": { "before": "2026-10-29", "after": "2026-11-13" },
            "fx_rate": { "before": "1.36840000", "after": "1.40120000" },
            "home_total": { "before": "3421.00", "after": "3503.00" }
          }
        }
      }
    }
  }
}
```

## Record A Payment

All or part of what's owed. DR the bank / CR the customer's A/R. Pass source_event_id to use a bank-feed deposit. A payment already booked (as a transfer, or a deposit already in QuickBooks) becomes the payment in place and is never booked twice. Its credit moves to this customer's A/R, so A/R with no customer clears. Money credited to another account is moved to A/R in Solarium only, and is refused when that entry is in QuickBooks. It must be in the invoice's currency, for the same customer or none, no more than what's owed, and not already another invoice's. QuickBooks isn't changed.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | The invoice |
| `params.method` | `String!` | Yes | One of your country's payment methods (invoice_settings: payment_methods). Canada: etransfer, cheque, bank, card, cash, wire, other. US: ach, cheque (shown as Check), zelle, wire, card, cash, other |
| `params.amount` | `String` | No | Default: what's left |
| `params.bank_account_id` | `String` | No | Where it landed (not needed with source_event_id) |
| `params.source_event_id` | `String` | No | A deposit from the bank feed. It's booked as this payment whole, so it must be the same amount (in the invoice's currency) or, for another currency, what landed. An entry already booked is linked in place: its own date, bank and amount |
| `params.amount_home` | `String` | No | Invoices in another currency paid into an account in your books' currency: what landed, in that currency. Leave it out for an account in the invoice's currency. Default: amount at that day's Bank of Canada rate. The difference goes to Exchange Gain or Loss |
| `params.fee` | `String` | No | Invoices in another currency: a bank fee taken off the payment, in the currency of the account it landed in. Goes to Bank Fees & Charges |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "record_invoice_payment", apply: true,
        params: { invoice_id: "9f3c...", method: "etransfer", source_event_id: "e5f6..." }) { success result }
}
```

### Response

```json
{
  "data": { "runOp": { "success": true, "result": { "summary": "1130.00 Recorded On INV-00024 (e-Transfer). Paid In Full." } } }
}
```

## Find The Deposit That Paid It

Bank deposits that could have paid an invoice, best first: exact amounts first, then payers whose name looks like the customer's. Includes deposits still in review, ones booked as income in Solarium only (that income booking is undone when you link it, so it isn't counted twice), and payments already booked as a transfer into a bank (linked in place). Link one with record_invoice_payment, passing its event_id as source_event_id. Read only.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | The invoice |

### Request

```graphql
query {
  previewOp(organizationId: "a1b2c3d4-...", name: "invoice_deposit_matches", params: { invoice_id: "9f3c..." }) { result }
}
```

### Response

```json
{
  "data": { "previewOp": { "result": { "summary": "2 Deposit(s) Could Have Paid INV-00024, 1 Exactly." } } }
}
```

## Remove A Payment

Undo a payment: what it paid is owed again. A payment from a bank deposit puts the deposit back in review with its own payee and memo. One recorded by hand has its entry voided. An invoice's entries can't be edited, rejected or merged anywhere else, so this is how a payment changes.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | The invoice |
| `params.payment_id` | `String!` | Yes | From get_invoice's payments |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "remove_invoice_payment", apply: true,
    params: { invoice_id: "9f3c...", payment_id: "7d21..." }) { success result }
}
```

### Response

```json
{
  "data": { "runOp": { "success": true, "result": { "summary": "Payment Of CAD 500.00 From Oct 17 Removed From INV-00024. The Deposit Is Back In Review." } } }
}
```

## List Invoices

Newest first, with a total count, counts per status group, and the money bar: overdue, not due yet, drafts and paid in the last 30 days, each with a count and an amount in your books' currency. Read only, so previewOp is enough.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.status` | `String` | No | draft, sent, viewed, partially_paid, paid, overdue, void, or open |
| `params.statuses` | `[String]` | No | Any of these statuses (open counts as sent, viewed, partly paid and overdue) |
| `params.bucket` | `String` | No | One money-bar segment: overdue, not_due, draft, paid_30, open or all |
| `params.contact_id` | `String` | No | One customer's invoices |
| `params.search` | `String` | No | Matches the invoice number or the customer's name |
| `params.issued_from` | `Date` | No | Issued on or after (YYYY-MM-DD) |
| `params.issued_to` | `Date` | No | Issued on or before (YYYY-MM-DD) |
| `params.amount_min` | `String` | No | Total at least this |
| `params.amount_max` | `String` | No | Total at most this |
| `params.limit` | `Int` | No | Page size (default 100) |
| `params.offset` | `Int` | No | Skip this many (default 0) |

### Request

```graphql
query {
  previewOp(organizationId: "a1b2c3d4-...", name: "list_invoices", params: { status: "open" }) { result }
}
```

### Response

```json
{
  "data": { "previewOp": { "result": { "summary": "3 Invoice(s); 2260.00 Owed, 1130.00 Overdue On This Page." } } }
}
```

## Invoice Settings

Reads or changes what every invoice says: the number series, how to pay, your address and email, a trade name, days to pay and reminders. Pass nothing to just read them.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.payment_instructions` | `String` | No | How to pay. Name an Interac e-Transfer address and the invoice page offers to copy it |
| `params.business_address` | `String` | No | Your address, one line per line |
| `params.business_email` | `String` | No | Printed on invoices. Customers' replies go here |
| `params.trade_name` | `String` | No | The name you trade under, if it isn't your legal name. Invoices lead with it and read "A trade name of" your legal name under it. Empty clears it |
| `params.prefix` | `String` | No | The number prefix (INV-) |
| `params.next_number` | `Int` | No | To continue an existing series |
| `apply` | `Boolean` | No | true to save changes |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "invoice_settings", apply: true,
        params: { trade_name: "Harbour Design Co.", payment_instructions: "Interac e-Transfer to pay@harbourdesign.ca" }) { success result }
}
```

### Response

```json
{
  "data": {
    "runOp": {
      "success": true,
      "result": {
        "summary": "Next Invoice Number INV-00042. Changed: payment_instructions, trade_name.",
        "data": { "trade_name": "Harbour Design Co.", "legal_name": "Harbour Studio Inc.", "next_invoice_number": "INV-00042" }
      }
    }
  }
}
```

## Import Your Own Invoice PDF

Reads the number, dates, customer, lines and tax off your PDF and keeps them as printed. The preview shows what was read.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.pdf_base64` | `String` | No | The PDF (or s3_key of an upload) |
| `params.book` | `Boolean` | No | Book it to A/R as sent (default true) |
| `params.send` | `Boolean` | No | Also email your PDF to the customer (default false) |
| `params.adopt_event_id` | `String` | No | An A/R entry you already booked by hand for this invoice. The invoice ties to it instead of booking A/R again. Nothing new is posted and no email goes out |
| `params.date_tolerance_days` | `Int` | No | With adopt_event_id: days the entry's date may differ from the invoice's (default 0) |

### Request

```graphql
mutation {
  runOp(organizationId: "a1b2c3d4-...", name: "import_invoice_pdf", apply: true,
        params: { pdf_base64: "JVBERi0xLjQK..." }) { success result }
}
```

### Response

```json
{
  "data": { "runOp": { "success": true, "result": { "summary": "LG-2026-117 For North Shore Rentals: CAD 339.00 (Tax 39.00), Issued 2026-10-03, Due 2026-10-31. Booked To A/R." } } }
}
```

## Tie An Invoice To An Entry Already Booked

For an invoice whose A/R you already booked by hand. The draft uses that entry as its booking, so the A/R is never counted twice. Nothing new is posted, pushed to QuickBooks or emailed.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `params.invoice_id` | `String!` | Yes | A draft invoice |
| `params.event_id` | `String!` | Yes | The entry already booked for it: DR A/R for the invoice total, with the same tax, customer, currency and date |
| `params.date_tolerance_days` | `Int` | No | Days the entry's date may differ from the invoice's issue date (default 0). The preview shows the difference |
| `apply` | `Boolean` | No | true to tie them |

### Request

```graphql
mutation {
  previewOp(organizationId: "a1b2c3d4-...", name: "link_invoice_to_entry",
            params: { invoice_id: "9f3c...", event_id: "77e7...", date_tolerance_days: 1 }) { success result }
}
```

### Response

```json
{
  "data": {
    "previewOp": {
      "success": true,
      "result": {
        "summary": "INV-00031 For Harbour Rentals: CAD 1130.00 (Tax 130.00), Tied To The A/R Entry Already Booked On 2026-11-20. Nothing New Is Booked And No Email Goes Out.",
        "warnings": [
          "The Entry Is Dated 2026-11-20, 1 Day From The Invoice's 2026-11-21.",
          "The Entry Had No Customer. It's Now Tagged To Harbour Rentals."
        ],
        "data": {
          "status": "sent",
          "ledger_event_id": "77e7...",
          "adopted": { "event_id": "77e7...", "ar_amount": "1130.00", "tax_amount": "130.00", "contact_set": true, "date_difference_days": 1 }
        }
      }
    }
  }
}
```
