MYOB Integration #
Classification: Internal-Only
MYOB Business (AccountRight Live, MYOB Business and the newer Essentials files) is an Australian and New Zealand cloud accounting platform. tofu connects over OAuth 2.0 and calls the MYOB Business API v2 with one developer API key shared by every customer.
The connector reads reference data and documents, and publishes AP bills, AR invoices, direct expenses (Spend Money) and AP/AR credit notes. Bank statements are not published — both routes are researched and recorded under Bank statement (deferred). Everything below is what the code does, or what the MYOB Shared Sandbox 24 file returned on 2026-11-09 (marked sandbox); where MYOB’s own documentation disagrees, the sandbox wins.
Connector module: libs/rust/bonsai-integration/src/accounting/myob/. Research brief and error
catalog: .plans/myob/publish/ (gitignored, on the engineer’s machine).
Support matrix #
| Type | Create | Republish | Delete / void | Paid or settled documents | Attachments |
|---|---|---|---|---|---|
| AP bill | POST Purchase/Bill/{Service|Item} |
delete, then create (new UID) | DELETE Purchase/Bill/{layout}/{uid} — hard delete, no void |
PartiallyPaid / Paid lock republish and delete; MYOB 10001 → PAYMENT_APPLIED, 25003 → TRANSACTIONS_MUST_BE_REVERSED |
…/Attachment (POST returns 200) |
| AR invoice | POST Sale/Invoice/{Service|Item} |
delete, then create | DELETE Sale/Invoice/{layout}/{uid} |
same | none — the API has no endpoint (without_ar_invoice_attachments) |
| Direct expense (Spend) | POST Banking/SpendMoneyTxn |
delete, then create | DELETE Banking/SpendMoneyTxn/{uid} |
reconciled (25004) → RECONCILED blocks |
…/Attachment (POST 200) |
| AP credit note | POST Purchase/Bill/{layout} with negative Total / UnitCount → Status: Debit |
delete, then create | DELETE |
settled (BalanceDueAmount == 0) or partly settled → PAYMENT_APPLIED |
yes, the bill endpoint |
| AR credit note | POST Sale/Invoice/{layout} with negative Total / UnitCount → Status: Credit |
delete, then create | DELETE |
same | none |
| Bank statement | deferred — supports_publish_for_type(BankStatement) is false |
— | — | — | — |
MYOB is in EntityIntegration::should_delete_before_publish (libs/rust/bonsai-model/src/integration.rs).
MYOB’s PUT is a full-object replace keyed by RowVersion plus per-line RowID / RowVersion,
replacing a line set through it is undocumented, and delete has the same preconditions as update
(payments and locks block both). Every republish is therefore DELETE + POST, and the external
id changes on every republish; the merge-back stores the new UID.
MYOB has no draft state: a POST records the document immediately. A created bill or invoice is
Authorized, a Spend Money is Paid. Payment state is read back from BalanceDueAmount against
TotalAmount (model/invoice.rs map_myob_invoice_status); republish and delete read the document
first and refuse when it is PartiallyPaid / Paid. A zero-total document reports a zero balance
without anything having been paid, so it reads as Authorized: Paid would lock it, and
accounting-sync skips a locked document’s republish on the stored status alone, before the
connector is asked. MYOB marks such a document Closed, so Authorized narrows on
Status eq 'Open' or TotalAmount eq 0 rather than Status eq 'Open' alone, which would hide every
zero-total document. Dropping the clause instead would hide nothing but would page the whole bill
history to find the open ones. PartiallyPaid narrows on Status eq 'Open'; Paid cannot narrow
at all and fetches unfiltered. Every clause over-selects, so the balance decides client-side
(model/invoice.rs map_status_to_myob_filter).
MYOB is also in should_disable_auto_publish_on_first_connect: a new connection starts with
every auto-publish flag off (oauth_callback.rs). Connections that existed before publish shipped
keep their flags (D8) — they were unreachable until now, so none is on.
Authentication and transport #
- OAuth 2.0 against
secure.myob.com(env.rs). Scopes requested:sme-company-file sme-company-settings sme-general-ledger sme-sales sme-purchases sme-banking sme-inventory sme-contacts-customer sme-contacts-supplier(env.rsSCOPE). Eachsme-*scope is read and write for its family, so publish needed no new scope and no customer reconnect. Sandbox: bills, invoices, Spend/Receive Money and attachments were all created with an existing connection’s token. - Access tokens are Ory-format (
ory_at_…) and live 20 minutes;with_valid_tokenrefreshes on use. There is no separate sandbox token lifetime. - Every call carries
Authorization: Bearer,x-myobapi-key(the one developer key),x-myobapi-version: v2,Accept/Content-Type: application/json. Base URL:https://api.myob.com/accountright/{business_id}/(company_file_uri). AccountRight desktop files protected by a company-file password also needx-myobapi-cftoken; the connector never sends one, so those files fail to read today and publish inherits the gap. - Writes return 201 with an empty body; the new UID is the last path segment of
Location. Sandbox: theLocationhost isarl2.api.myob.com, notapi.myob.com, souid_from_locationtakes only the last segment. AttachmentPOSTs return 200.DELETEreturns 200; a repeatDELETEor aGETafter it returns 404. $filtervalues need single quotes doubled and percent-encoding (encode_filter); dates areYYYY-MM-DD HH:MM:SSorYYYY-MM-DDT00:00:00.
Rate limits: 403, not 429 #
The key is limited to 8 requests per second plus a per-key quota (the dev key shows 480 per
minute on the portal; MYOB’s documented default tier is 1,000,000 per day). Exceeding either
returns HTTP 403 with body {"Errors":[{"Name":"RateLimitError","Message":"API key has exceeded the per-second rate limit"}]} (or … the daily rate limit) and no Retry-After.
map_error_status (myob/mod.rs) splits 403: a body MyobErrorBody::is_rate_limited →
TooManyRequests with a synthetic 1 s backoff (RATE_LIMIT_BACKOFF); any other 403 (“You are not
authorised to access this resource”, a missing or inactive key) stays BadRequest. Because one key
serves every customer, concurrent_limits_for_provider(Myob) is 1
(utils/concurrent_limiter.rs): writes are serial per integration and compete across customers.
Error model #
MYOB answers a rejected write with HTTP 400 and this envelope (model/error.rs,
MyobErrorBody):
{"Errors":[{"Name":"Required","Message":null,"AdditionalDetails":"FreightTaxCode","ErrorCode":100,"Severity":"Error","LearnMore":null}],"Information":null}
Nameis the machine key;Messageis oftennull, so the user message is built fromNameandAdditionalDetails(the JSON path of the offending field). Several entries can arrive in one body and are joined with a semicolon.Severity: Warningstill comes back as HTTP 400.- A referenced UID that does not exist is a 400
NotFound(code 150), not a 404. - 409 is a stale
RowVersion→ROW_VERSION_CONFLICT. 404 / 410 →NotFound, so cleanup of a document already deleted in MYOB completes.
MYOB Name / code |
Meaning | tofu key (errorMessage.myob.*) |
|---|---|---|
RateLimitError (403) |
per-second or quota breach | TooManyRequests, retried |
Required 100 on FreightTaxCode / Lines[n].TaxCode |
tax code missing | connector sends N-T; TAX_CODE_UNAVAILABLE when the file has no N-T |
SpendMoneyTxnContactNotSupplied 23002 |
Spend Money without Contact.UID |
validator CONTACT_REQUIRED; connector CONTACT_REQUIRED_SPEND_MONEY |
CustomerNotFound 11003, NotFound 150 on Supplier.UID |
wrong card type for the document | CONTACT_ROLE_MISMATCH |
UnitPriceNotValid 12101 |
negative UnitPrice |
never sent; internal guard UNIT_PRICE_MUST_BE_POSITIVE |
UnitCountRequiredWhenUnitPriceProvided 12103 |
UnitPrice without UnitCount |
connector always pairs them |
StringLengthExceeded 180 on EventId |
AR Number over 13 characters |
not sent (D4); validator caps at 13 if ever sent |
Duplicate 200 |
duplicate number (only when the file’s warning preference is on) | DUPLICATE_NUMBER |
| 10001 “Cannot delete Invoice with payment(s) applied” | payment applied | PAYMENT_APPLIED |
| 25003 “must be reversed” | file preference “transactions must be reversed” | TRANSACTIONS_MUST_BE_REVERSED |
| 25004 | reconciled transaction | RECONCILED |
25009 DateInLockedPeriod, 4222 BusinessEvent_DateOccurred_InLockPeriod |
date in the lock period | LOCKED_PERIOD |
25008 DatePriorToBeginningOfFinancialYear, 4223 |
date before the financial year | BEFORE_FINANCIAL_YEAR |
| 409 | stale RowVersion |
ROW_VERSION_CONFLICT |
Duplicates are accepted. Sandbox: a second bill with the same SupplierInvoiceNumber, a second
bill with the same Number and a second invoice with the same Number were all 201; the file’s
duplicate-warning preference is off by default and is only a Warning when on. MYOB has no
idempotency key, so a retried POST whose first response was lost creates a second document.
Idempotency is tofu’s: every document carries a tofu:<id> key in its memo, and before a retried
create the connector looks it up and, finding a record bearing this document’s key, posts the
document afresh and then deletes that record. It is replaced rather than adopted: the orphan holds
what the lost create sent, the document may have been edited since, and adopting it would publish
none of the edits and then copy MYOB’s stale amounts back into tofu. A PUT would not do, because
it cannot move a document between the Service and Item layouts and an edit can need the other
one. The replacement is posted before the orphan is deleted, so a rejected create cannot leave
the file with neither document; the delete is then a cleanup of a record tofu no longer points at.
A paid or locked orphan is the exception, and the publish fails on it. MYOB will not delete
it, so posting a replacement would leave the file holding both for good; taking it over instead
would read its stale total and Paid status back over the edits made since, and MYOB rejects those
edits anyway once a payment is applied. Nothing is posted and the user gets PAYMENT_APPLIED,
because only they can clear it. A bill is recognised before the post, from the list row’s status; a
SpendMoneyTxn list row carries no status, so a reconciled one is only discovered when the sweep’s
DELETE is refused (25004 / 25009 / 25008) — the expense is in the books twice by then, and the
terminal BadRequest is what says so. A sweep MYOB merely could not serve — throttled, 5xx — is
returned as-is rather than logged, so the publish retries and the next attempt finds both by key and
sweeps them. Either way the create this publish made is rolled back first, because the failing
publish is what would have carried the new uid back to tofu: leave it and tofu forgets the copy it
just made, and every later attempt adds another against an orphan that never becomes removable.
The new record is seconds old, so nothing MYOB refuses to delete can have happened to it yet. A
publish therefore either finishes completely or leaves the file as it found it. Every record carrying
the key is swept, not the first: a create retried more than once leaves one orphan per lost
response, and the lookup pages to exhaustion so a busy day cannot hide one past the first page.
Bills, credit notes and Spend Money all sweep their orphans this way. The key never reaches
a user: it is stripped back off the memo on read, or every published document would sync back
described as tofu:<uuid>. Supplier,
number, date and total are not a key a tofu document owns — two documents can share all four, and
republish is delete-then-create, so adopting the wrong record destroys the other’s. Spend Money
narrows on the payee and date
(Banking/SpendMoneyTxn?$filter=Contact/UID eq guid'…' and Date eq datetime'…') and then checks
each candidate’s Memo for the key: the memo also carries the expense’s description, and an
edited description is exactly the retry the lookup exists for, so filtering on the whole memo
would miss the orphan and post the expense twice. Bills and credits narrow on what MYOB is known
to filter
(Purchase/Bill?$filter=SupplierInvoiceNumber eq '…' and Supplier/UID eq guid'…') and then check
JournalMemo on each candidate, because OData support for JournalMemo is unverified. An AR
invoice sends no number of its own (D4), so it has no lookup and no dedup.
Activation metadata #
MyobPublicMetadata (bonsai-model/src/integration.rs) is filled at activation
(myob/mod.rs activation_metadata) from three reads:
| Field | Source |
|---|---|
base_currency |
derived from GeneralLedger/Currency — the one of AUD/NZD the table omits (see below) |
multi_currency_enabled |
always false — tofu publishes in the file’s own currency only |
lock_period_prior_to |
Company/Preferences → System.LockPeriodPriorTo (YYYY-MM-DD HH:MM:SS); a UI-only setting that changes without notice |
category_tracking |
System.CategoryTracking: Off, OnAndNotRequired, OnAndRequired |
transactions_must_be_reversed |
System.TransactionsCannotBeChangedMustBeReversed. Recorded only; not a publish gate, because it is written once at activation and never refreshed, so a user who turned the preference off would stay refused until they reconnected. MYOB’s own 25003 on the DELETE is what refuses the republish, mapped to TRANSACTIONS_MUST_BE_REVERSED, and it is always current |
default_no_tax_rate_id |
the file’s N-T tax code UID, same pick order as default_tax_code_uid. Only a hint: publish falls back to the catalog (N-T by name, then any zero-rate code), and the validator’s N01 rule asks the same three in the same order, so it fires only when a line has no tax code and the file offers nothing untaxed |
A read that fails logs a warning and does not fail activation, but it is told apart from a file
that genuinely reports nothing: the fields that read feeds keep whatever is already stored, and the
publish_metadata_version marker is withheld so the next activation or heartbeat enriches again.
enriched_at is stamped whether or not the reads succeeded, and an incomplete connection is retried
only once 15 minutes have passed, so a file that keeps failing (a 403 on Company/Preferences, MYOB
down) does not put three GETs and a row write in front of every caller. Same shape as Odoo’s.
Only once all three reads land (Company/Preferences, the N-T code, GeneralLedger/Currency) is
the marker stamped and the connection considered enriched. None from a read that succeeded is an
answer — no lock period, tracking off, no N-T code — and clears the stored value, so a lock lifted
in MYOB stops blocking documents.
The company file’s currency is derived from what the currency table omits.
GeneralLedger/Currency is a 165-row reference table of every world currency and MYOB leaves the
file’s own currency out of it: on the AU sandbox every major code is listed except AUD. The other
~15 absences are a stale pre-2015 ISO snapshot (BYR not BYN, MRO not MRU, VEF not VES,
ZWD not ZWL), so an absence is never arbitrary. MYOB serves Australia and New Zealand only, so
local_currency_code (model/currency.rs) reads exactly that: NZD present and AUD absent →
AUD, the reverse → NZD, both or neither → None, which stores nothing and leaves the currency
rules inert rather than blocking a valid document.
Do not derive it from CurrencyRate: six defunct codes — BYR, MRO, SPL, TVD, VEF, ZWD — sit
at rate 1, and a first attempt that picked “the first row at rate 1” resolved to BYR and broke
saving entirely. No other endpoint helps: Company carries no currency or country field
(Address is free text with no country line, ABNOrTFN may be blank), Company/Preferences none
either. The value is re-derived on every reconnect rather than carried forward, so a table change
clears it instead of enforcing a stale currency, and it is deliberately absent from
enrichment_required — None is a legitimate answer, so a condition on it would retry for ever.
One bug the foundation work fixed, worth knowing when reading older rows:
- Tax was computed per line.
AccountingTarget::MyobwasLineByLine, but MYOB computes GST on the document total (sandbox: 3 × 33.33 tax-exclusive at 10 % →TotalTax 10.00, not 9.99; tax-inclusive → 9.09). The target is nowACCRUEDinconfig/csv-accounting-targets.yaml(the generatedgenerated_accounting_target.rsfollows), so the review form, the validator and MYOB agree to the cent. MYOB lines carry noTaxAmount;TotalTaxis read-only and never sent.
Shared mapping rules #
These apply to bills, invoices and credit notes (model/invoice_write.rs, model/credit_note_write.rs).
- Layout by line content (D5). Every line has an item →
Itemlayout (Lines[].Item.UID,BillQuantity/ShipQuantity); no line has one →Servicelayout (Account.UID,UnitCount); a mix → validator errorLAYOUT_MIXED_LINES. Sandbox: an account-only line inside anItembill is accepted but reads backBillQuantity 0, so mixing silently loses the quantity.ProfessionalandMiscellaneouslayouts stay read-only. - A tax code on every line, always.
TaxCode.UID = external_tax_rate_id, falling back to the file’s N-T code (default_no_tax_rate_id, elsedefault_tax_code_uid()); the publish fails withTAX_CODE_UNAVAILABLEwhen the file has no N-T. Sandbox: a bill or Spend Money line without one is 400Required Lines[0].TaxCode. FreightTaxCode.UIDis always sent onPurchase/Bill, set to N-T, even with no freight. Sandbox: every billPOSTwithout it is 400Required FreightTaxCode; MYOB does not document this.Freightitself is never sent.IsTaxInclusivefollowsline_amount_type(Inclusive→true;NoTax→falseplus N-T on every line). LineTotalis the line subtotal at 2 dp, gross when inclusive.UnitCountis sent wheneverUnitPriceis (12103). Description-only lines go asType: "Header".Description≤ 1000.- Base currency only (D2). The validator rejects
currency_id != base_currencyand the connector repeats the check asFOREIGN_CURRENCY_UNSUPPORTED. When the file currency could not be derived there is nothing to check against, so publish refuses withBASE_CURRENCY_UNKNOWNwhatever currency the document names, or names none — tofu has to label the amounts it records. The form says the same, so clearing the currency does not turn it green on a document publish will not take. Otherwise it would be posted at face value in the file’s own currency — MYOB would store the amount withForeignCurrency: nulland the document’s own currency label would simply be lost. Neither sendsForeignCurrency,CurrencyExchangeRateor the*Foreignamount fields. Multi-currency only exists on AccountRight Premier files and MYOB’s own notes say foreign documents cannot be created through the API. - Categories are ignored (D6). Header tags are not sent. Line tags map to
Lines[].Job.UID(the first tag that is not the syntheticMYOB_JOB_ROOT_ID; more than one is a validator error). A file withCategoryTracking == OnAndRequiredgets MYOB’s provider error on publish; the value is in metadata so the validator can warn later. - Header discount: no MYOB field. An invoice or direct expense is rejected
(
DISCOUNT_UNSUPPORTED); a credit note is dropped with a warn, because the review form hides the field and already excludes it from the total shown. LineDiscountPercent0–99.99 is sent. - Contact role must match: a
Supplier.UIDmust be a supplier card, aCustomer.UIDa customer card (is_supplier/is_customerfromContact/SupplierandContact/Customer). Sandbox: a supplier on a sale → 400CustomerNotFound11003; a customer on a purchase → 400NotFound150. MYOB contacts carry no currency and need no other field.
AP bill #
Supplier.UID = external_contact_id;Date = invoice_date(YYYY-MM-DDT00:00:00).SupplierInvoiceNumber = invoice_number(≤ 255) — the supplier’s number. MYOB’s ownNumber(the bill number, auto00002579) is omitted and MYOB assigns it.JournalMemo = invoice_referenceplus a trailingtofu:<invoice_id>dedup key (≤ 255 together; the reference is cut so the key always survives);Comment = description(≤ 2000).Terms { PaymentIsDue: "InAGivenNumberOfDays", BalanceDueDate: due_date − invoice_date }only whendue_dateis set; otherwiseTermsis omitted and the supplier card’s defaults apply. A due date before the invoice date is a validator error (MYOB:Term_Out_Of_Range).- Items must be
is_purchased; account-only lines need anap_bill_line-compatible account. - Read-back:
GET Purchase/Bill/{uid}then the layout-specificGETfor lines (fetch_invoice_detail). AStatus: Debitrow is a supplier debit (AP credit note), never a bill. - Delete: read back first;
Authorized→DELETE→Deleted;PartiallyPaid/Paid→PAYMENT_APPLIED(“Delete the supplier payment in MYOB first”); 404 / 410 → already gone.
AR invoice #
Customer.UID = external_contact_id;Date;Termsas AP.- MYOB numbers the invoice (D4).
Number(≤ 13 characters, sandbox: 14 → 400StringLengthExceeded180) is omitted; after the create the connectorGETs the invoice and stores MYOB’sNumber(sandbox:71097) back intoinvoice_number. A customer who numbers in tofu loses that number on the MYOB side. CustomerPurchaseOrderNumber = invoice_reference(≤ 255);ShipToAddress = ship_address(≤ 255).InvoiceDeliveryStatus: "Nothing"so MYOB queues no print or email.OnlinePaymentMethodis omitted. No tax-jurisdiction fields: MYOB tax is purely the lineTaxCode.- Items must be
is_sold; account-only lines need an income (ar_invoice_line) account. - No attachments.
Sale/Invoicehas no attachment endpoint (sandbox:POSTandGETSale/Invoice/{layout}/{uid}/Attachment→ 404), although the MYOB web UI can attach files. The capability is.without_ar_invoice_attachments()(FreeAgent precedent), sobonsai-accounting-syncskips the upload for AR invoices and AR credit notes without failing the publish (publish.rsskips_sales_document_attachments); the connector’s AR attachment methods areOkno-ops and empty lists. - Delete: customer payments block it (10001); otherwise as AP.
Direct expense: Spend Money only #
tofu creates every direct expense as DirectExpenseType::Spend (the review form’s type picker is
hidden). Publish maps to Banking/SpendMoneyTxn only; a Receive reaching upload_direct_expense
is rejected with DIRECT_EXPENSE_RECEIVE_NOT_SUPPORTED before any call, as Zoho does.
ReceiveMoneyTxn stays in the connector for read-back of imported documents.
model/spend_money_write.rs:
| tofu | MYOB | Notes |
|---|---|---|
paid-from external_account_id |
PayFrom: "Account", Account.UID |
must be Bank / CreditCard (direct_expense_bank) |
external_contact_id |
Contact.UID |
required (sandbox: 400 SpendMoneyTxnContactNotSupplied 23002); any card type |
transaction_date |
Date |
|
description / title |
Memo (≤ 255) |
ends tofu:<direct_expense_id>; the retry dedup matches that key on the record, not the memo in the $filter |
reference |
PaymentNumber (≤ 13) |
dropped, not cut, when longer; absent → MYOB auto-numbers |
line_amount_type |
IsTaxInclusive |
|
total_amount |
AmountPaid |
gross total |
bill_address |
PayeeAddress (≤ 255) |
|
line external_account_id |
Lines[].Account.UID |
required |
line amount |
Lines[].Amount |
negative lines accepted (sandbox) |
line external_tax_rate_id |
Lines[].TaxCode.UID |
required, N-T fallback |
line description |
Lines[].Memo (≤ 1000) |
|
line quantity |
Lines[].UnitCount |
no unit price field |
line external_tag_ids |
Lines[].Job.UID |
first non-root tag |
| — | ChequePrinted: true, DeliveryStatus: "Nothing" |
constants; stop MYOB queuing a cheque or email |
Items and payment methods are unsupported (no field on Spend Money; the webapp hides both, and
fetch_payment_methods is a stub). The created transaction is recorded immediately → Paid.
Delete is DELETE Banking/SpendMoneyTxn/{uid} → 200; 25004 (reconciled) → RECONCILED, 25009 →
LOCKED_PERIOD, 404 → already gone. Attachments go to Banking/SpendMoneyTxn/{uid}/Attachment
(POST 200, sandbox).
Credit notes: negative invoices and bills #
MYOB has no credit-note resource. An AR credit note is a Sale/Invoice whose totals are negative
(MYOB Status: "Credit"); an AP credit note is a Purchase/Bill with negative totals
(Status: "Debit"). Sandbox: both were 201 and read back Status: Debit, TotalAmount -33.00,
TotalTax -3.00, BalanceDueAmount -33.00 (AP) and Status: Credit, BalanceDueAmount -44.00
(AR). In the MYOB UI they appear under Purchases → Purchase returns and debits and
Sales → Customer returns and credits, not in the Bills or Invoices lists.
UnitPricemust stay positive (sandbox:UnitPrice: -44→ 400UnitPriceNotValid12101). The sign goes onTotalandUnitCount(UnitCount: -1, UnitPrice: 33, Total: -33→ 201 on both resources). A line with only a negativeTotalworks; mixed-sign lines are accepted. The sharedcredit_note::normalized()flips a document-signed note positive first, then the builder re-negates on the wire.- AP:
SupplierInvoiceNumber = credit_note_number,FreightTaxCodeN-T. AR:Numberomitted (D4) and MYOB’s stored back.JournalMemo = credit_note::combined_notes()plus a trailingtofu:<credit_note_id>dedup key (original invoice number, reason, notes; ≤ 255 together, and text that no longer fits beside the key overflows intoComment). Layout, tax, currency and contact rules are the invoice ones. - Credits are created unallocated;
Sale/CreditSettlement,Sale/CreditRefund,Purchase/DebitSettlementandPurchase/DebitRefundare out of scope. fetch_credit_note_statusreads the invoice or bill and requiresStatus: Credit/Debit(any other status → error).BalanceDueAmount == 0→Paid(settled or refunded) unless the total is zero too, which is nothing owed rather than something settled and reads asAuthorized;|balance| < |total|→PartiallyPaid, elseAuthorized. Settled or partly settled notes lock republish and delete (PAYMENT_APPLIED), mirroring Xero’s allocation check.- Attachments: AP through the bill endpoint; AR none (skipped like AR invoices).
- Read-side fix shipped with publish:
MyobSaleInvoicesResponse::into_invoicesandfetch_invoicenow excludeStatus: Credit/Debitrows. Before, MYOB credits leaked into the invoice history reads (Hinoki, self-prompt) as negative invoices.
The cross-provider flow (gating, queueing, delete during publish) is in Credit Note Publishing.
Attachments #
- Endpoints exist for
Purchase/Bill/{layout}/{uid}/AttachmentandBanking/SpendMoneyTxn/{uid}/Attachmentonly.Sale/InvoiceandBanking/ReceiveMoneyTxnhave none (sandbox: 404 on both), even though the web UI attaches files to invoices. - One file per
POST, body{"Attachments":[{"OriginalFileName":…,"FileBase64Content":…}]}, response 200 withAttachments[0].UID. MYOB rejects a base64 body over 3 MB, soMYOB_MAX_ATTACHMENT_SIZE_BYTEScaps the raw file at 2.2 MB (model/attachment.rs,max_attachment_bytes(Myob)); larger documents are split by doc-convert, an oversize file isATTACHMENT_TOO_LARGE. Whether MYOB measures the encoded or the raw size is still a pending live check. - Accepted types: PDF, TIFF, JPG/JPEG, PNG →
ATTACHMENT_TYPE_UNSUPPORTEDotherwise. GET …/Attachmentlists metadata with an S3 pre-signedFileUrithat expires in 1–2 minutes; download it straight after the list.DELETE …/Attachment/{uid}→ 200.
tofu validator #
ValidatorProvider::Myob (libs/rust/tofu-validator-core/src/model.rs) runs MYOB’s rules live
in the review form through WASM, from MyobValidationSettings built out of the public metadata
(getTofuValidatorProviderSettings in apps/webapp/src/shared/utils/integration.ts). Only
sandbox-confirmed rules ship: contact required with the right role (Spend Money: any card, but
required); a tax rate on every line unless the file has N-T; account or item per line (income
account on sales); no mixing item and account-only lines; AP SupplierInvoiceNumber ≤ 255;
description ≤ 1000, reference / memo ≤ 255; UnitPrice ≥ 0 on credit notes; currency = base
currency; date not before lock_period_prior_to; no items and no Receive on direct expenses;
no header discount on an invoice or direct expense (a credit note’s is dropped);
quantity whenever a unit price is set. Docs-only rows from the error catalog
stay out until the manual test confirms them.
Bank statement (deferred) #
Decision D1 (2026-11-09): not in this run. supports_publish_for_type(BankStatement) stays false
for MYOB in Rust and TS. Both routes were researched and probed so a follow-up starts at the
planning phase, not at research.
Evidence. Banking/Statement is read-only: POST → 405 Method Not Allowed (sandbox).
Banking/BankAccount lists only feed-registered accounts (one in the sandbox, BankLinkStatus: ACTIVE, number masked), so AccountingAccount.number cannot be filled from MYOB and there is no
.with_create_bank_account().
Route A — MYOB Transactions API (bank-feed push) #
- Separate product at
transaction.myob.comwith its own credentials: client-credentials grant atid.myob.com/oauth/token, audiencetransaction-api, a client id and password per institution, not the Business API key. - Partner-gated: “restricted to development partners listed as trusted Bank Feed providers”; access through the expression-of-interest form on the overview page; lead time unknown; whether MYOB admits a non-bank platform is unknown.
- Onboarding is designed for banks: the customer starts in MYOB (Banking → bank feeds → choose
provider), MYOB redirects to our portal with
applicationId,redirectUrlandfeedsRemaining, the customer picks accounts on our side, wePOST /feeds(applicationId,externalId≤ 100,accountName,accountNumber,bsb6 digits for AU,accountType≤ 13 → 201 / 207 / 422) and redirect back.GET /feedsbyexternalIdshows status;DELETEcancels. - Push:
POST /transactions{account: {externalId, balance, balanceUpdated}, transactions: [{transactionId ≤ 100, amount, currency, narration ≤ 200, transactionTypeCode ≤ 20, transactionTypeDescription ≤ 50, reference ≤ 30, originalDate, postedDate}]}→ 201. Lines land as feed lines the customer reconciles normally;transactionIdis the per-line dedup key (as Xero / Zoho), though dedup is not documented. - MYOB Business (browser) files only, AccountRight desktop excluded; AUD and NZD only.
- Fit: one v2 account group → one feed (
external_account_id→externalId,closing_balance→balance,end_date→balanceUpdated); feed connections would live in integration metadata as Xero’sfeed_routing.rsdoes; contra account, tax and tags are not sent (the customer codes the lines in MYOB).
Route B — one Spend / Receive Money per line (Business API, sandbox-verified) #
The freee shape from bank-statement-publish.md: every statement line becomes a recorded
transaction, which a customer with a live feed then has to match in MYOB (double handling); for a
file without a feed it is normal bookkeeping.
| Line | Object | Sandbox result |
|---|---|---|
money out (amount < 0) |
Banking/SpendMoneyTxn, PayFrom: "Account", Account.UID = the group’s bank account, Lines[] from bank_line_contra_* |
201. Contact.UID required (400 23002). Lines[].TaxCode required (400 Required). Negative inner lines accepted. Attachment POST → 200 |
money in (amount > 0) |
Banking/ReceiveMoneyTxn, DepositTo: "Account", PaymentMethod: "Other" |
201. Contact optional. Memo not required (docs say it is). No attachment endpoint (404) |
| transfer between bank accounts | Banking/TransferMoneyTxn (not probed) |
v1 would reject with TRANSFER_UNSUPPORTED |
| split children | parent’s children become Lines[] |
one object per movement |
- Open decision D10, contact on debit lines: user-picked per line (
external_contact_idonBankTransaction), a per-entity default “Bank statement” supplier card, orcreate_contactfromcontact_name. Recommendation: user-picked, falling back to a default card. - Tax: N-T fallback per line;
TAX_CODE_UNAVAILABLEwhen the file has none. The file’s N-T code is read only when a line that actually reaches MYOB lacks a tax code — a throttled or forbidden tax-code read must not sink a publish whose every line carries its own. Description-only lines are dropped before the post, so they never trigger the read. - Dedup:
Memoendstofu:<transaction uuid>; the lookup before a retried post narrows on payee and date and matches the key on each candidate’sMemo. Lineexternal_id=spend:<uid>/receive:<uid>; groupexternal_id=myob-bs:spend:a,receive:b,…. - Partial failure: build every request first, post sequentially, roll back created objects in reverse on the first error.
Sandbox #
MYOB Shared Sandbox 24 is a shared, MYOB-hosted test company file (id
6c19cd48-2d01-4007-80b6-e4dc925c72ac) on the dev API key; MYOB has no separate sandbox tier, a
test file on a developer key is the sandbox. It is connected to a local dev entity. Access tokens
live 20 minutes and the connector refreshes on use. The file is shared with other developers, so
every object a test creates must be deleted (bills, invoices, Spend Money, attachments). The
8 req/s limit is the same key production uses — keep probes serial.
Known gaps and pending live checks #
-
AR attachments: confirmed unavailable, not an oversight. MYOB’s web UI accepts attachments on a sales invoice (PDF/TIFF/JPEG/PNG, 10 MB), but that upload goes to the private BFF —
POST production.sme-web-bff.myob.com/{cf}/attachments/upload_attachment, Auth0 session JWT (observed 2026-11-11). The public API has no route: a POST/GET of six path shapes under a liveSale/Invoiceall return 404, while the same shape underPurchase/Billworks. The differing limits (UI 10 MB vs API 3 MiB) are a further sign they are separate systems. Hencewithout_ar_invoice_attachments(). -
Deep links: listing only.
profiles/myob.tslinks to the list a document is on, never the document:https://app.myob.com/#/au/{business_id}/{path}withbill,invoice?tab=all,transactionList(Spend Money),supplierReturn(AP credit note) andcustomerReturn(AR credit note), anddocumentLinkListingOnlyset so the UI words it that way. A per-document link is impossible: MYOB Business addresses a record by an internal numeric ID (/bill/11647) that the AccountRight API never returns — a transaction exposes onlyUID, Number, Date, Supplier, Status, Subtotal, TotalTax, TotalAmount, BalanceDueAmount, BillType, URI, RowVersion— and substituting theUIDinto that route does not resolve (browser, 2026-11-11). The mapping does exist, but only inside MYOB’s private web BFF (production.sme-web-bff.myob.com/{cf}/bill/load_bill/{id}returns bothidanduid), which authenticates with an Auth0 JWT issued to the browser session (aud= MYOB’s web-app client id), not theory_at_…OAuth token our connector holds. Theauin the path is assumed; an NZ file presumably usesnz, and the API exposes no country, so NZ links are unverified. Two consequences worth knowing: the list screens carry no filter state in the URL, so a link lands on MYOB’s default date window and an older document will not be visible until the user widens it; and AccountRight desktop has no URLs at all. -
Attachment limit: whether MYOB’s 3 MB applies to the base64 string or the raw file (probe with a 2.5 MB PDF); the cap assumes the encoded size.
-
Rate-limit body text for the daily quota (needs a burst over 8 req/s to observe).
-
Financial-year start: no API field read today exposes it, so 25008 stays a provider error; check whether
Company→CurrentFinancialYearcan turn it into a validator rule. -
Company-file password (
x-myobapi-cftoken) files are unsupported for read and publish alike. -
Renaming an individual contact is refused with
INDIVIDUAL_CONTACT_RENAME_UNSUPPORTED: the card holdsFirstNameandLastName, tofu holds one name, and splitting it would guess where the given name ends. Refused rather than skipped, so tofu does not report a rename it did not make. A company card’sCompanyNameis renamed, and the tax id is written either way. A name equal to the one MYOB already holds is not a rename and writes nothing; the callers send a name only when the user edited it, so a tax-id-only save cannot push a stale name back. The comparison is against the name the card shows —FirstName+LastNameon an individual, which has noCompanyName— or an individual’s unchanged name would read as a rename and take the tax id down with it. -
Categories (
CategoryTracking == OnAndRequired) surface as a provider error; mapping header tags toCategory.UIDneeds aGeneralLedger/Categoryread. -
Foreign currency is refused (D2); the
ForeignCurrencywrite path is undocumented. -
Transactions API unknowns: partner admission, lead time, sandbox, dedup on
transactionId. -
Validator rows marked NEEDS CONFIRMATION in the error catalog (15) stay out until the manual test confirms them.
User-facing documentation #
There is no MYOB guide under docs/external/ to update. The help.gotofu.com MYOB article is a
content chore for its owner (per the readonly-research-article pattern; not filed as a Linear
issue from this task). The article must now say:
- tofu publishes AP bills, AR invoices, direct expenses and AP/AR credit notes to MYOB; the Publish button and the auto-publish settings are available on every connected MYOB entity. New connections start with auto-publish off.
- A republished document gets a new MYOB record (delete then create); a bill or invoice with a payment applied, or a reconciled Spend Money, cannot be republished or deleted from tofu until the payment is removed in MYOB.
- Attachments reach MYOB for bills, Spend Money and supplier debits, but not for invoices or customer credits: MYOB’s API has no attachment endpoint for sales documents, although the MYOB web UI does. The publish still succeeds; the file stays in tofu.
- Credit notes appear in MYOB under Sales → Customer returns and credits and Purchases → Purchase returns and debits, not in the Invoices or Bills lists, and are created unallocated.
- MYOB numbers AR invoices and credit notes itself; the number shown in tofu after publishing is MYOB’s. Supplier invoice numbers are kept on bills.
- Documents publish in the company file’s base currency only; every line needs a tax code (tofu uses the file’s N-T code when none is chosen); a Spend Money needs a contact.
- Bank statements are not yet published to MYOB.
- Screenshots to refresh: Publish button on a MYOB entity, the auto-publish settings, a published credit under Customer returns and credits.
Related documentation #
- Credit Note Publishing — cross-provider flow with the MYOB specifics
- Bank Statement Publishing — the shared bank statement flow
- Accounting integration skills — how the publish track was run