# MYOB — Accounting API: gotchas

> Canonical URL: https://developers.apideck.com/apis/accounting/myob/gotchas

## POST /accounting/bills

MYOB requires a `FreightTaxCode` on bill create and update. Apideck sends the tax rate of the first line item (`line_items[0].tax_rate.id`), so every bill must include at least one line item with a `tax_rate.id`.

MYOB stores bills in layout-specific endpoints (Service, Item, Professional, Miscellaneous). On create, Apideck routes to the Item layout when any line item references an inventory item (`line_items[].item.id`) and to the Service layout otherwise. The returned `id` encodes the layout, so always use ids returned by the API.

On update, MYOB requires optimistic-locking versions: pass the bill's current `row_version` and, for every existing line, its `row_id` and `row_version` (all returned by a get call). Updates and deletes are only supported for Service and Item layout bills.

MYOB does not return the company file's base currency on bill records, so domestic bills (no foreign currency set) are reported with `currency: AUD`. For an NZD-based company file, treat the reported currency of domestic bills as the file's base currency, or read the raw payload via `raw=true`.

`filter[status]` is coarser than the unified enum. MYOB stores only `Open`, `Closed` and `Debit`, so `unpaid` and `partially_paid` both map to `Open` and return the **same** result set — they cannot be distinguished server-side. `paid` maps to `Closed`. To separate unpaid from partially paid, compare `balance` against `total` on the returned records.

For the same reason a partially-paid bill reads back as `status: submitted`, not `partially_paid` — MYOB's `Open` covers submitted, draft and partially paid, and the response mapping resolves it to `submitted`. Use `balance` versus `total` to detect partial payment.

## GET /accounting/credit-notes

MYOB AccountRight has no dedicated credit note endpoint. Credit notes are MYOB Sale/Invoice records with Status "Credit" (a negative balance), so credit notes share the invoice id space and numbering — the same record is visible through both the invoices and credit-notes resources.

MYOB stores credit amounts as negative numbers. Unified `total_amount`, `sub_total`, `total_tax`, `balance` and `remaining_credit` are normalized to positive values; `line_items` amounts are passed through as returned by MYOB (negative for credit lines).

Line items are only available on the detail endpoint (get one), not on the list endpoint.

Write operations (create, update, delete) are not supported on the credit-notes resource. Create a credit note via the invoices endpoint with negative line amounts — MYOB then sets its Status to "Credit" — and update or delete the underlying invoice record the same way.

## GET /accounting/bill-credit-notes

MYOB AccountRight has no dedicated bill credit note endpoint. Bill credit notes are MYOB Purchase/Bill records with Status "Debit" (a negative balance), so they share the bill id space and numbering — the same record is visible through both the bills and bill-credit-notes resources.

MYOB stores credit amounts as negative numbers. Unified `total_amount`, `sub_total`, `total_tax`, `balance` and `remaining_credit` are normalized to positive values; `line_items` amounts are passed through as returned by MYOB (negative for credit lines).

Line items are only available on the detail endpoint (get one), not on the list endpoint.

Write operations (create, update, delete) are not supported on the bill-credit-notes resource. Create a bill credit note via the bills endpoint with negative line amounts — MYOB then sets its Status to "Debit". Update and delete of the underlying bill are supported only for Service and Item layout bills (pass the bill's current `row_version`); MYOB's Purchase/Bill Professional and Miscellaneous layouts are read-only, so a credit note on those layouts cannot be updated or deleted through the connector.

## POST /accounting/payments

MYOB payments cannot be updated — the MYOB API allows only GET, POST and DELETE on customer payments, so the update operation is unsupported. Delete the payment and recreate it instead.

## PATCH /accounting/journal-entries/{id}

MYOB has no draft or pending-approval workflow for journal entries — every entry posts immediately
on create, so `status` is always `posted`.

Updates replace the whole record rather than patching individual fields: `posted_at`, `line_items`
and `row_version` must all be sent on every update, even to change only `memo`. `row_version` must
be the value most recently returned for that entry — a stale or missing value is rejected.

## GET /accounting/attachments/{reference_type}/{reference_id}

Attachments are supported on bills only. MYOB has no attachment support on invoices,
credit notes, or other records. The `reference_id` must be the layout-encoded bill ID
returned by the bills resource (base64 JSON with `id` and `type` fields where type is
service, product, professional, or misc).

`attachmentsOne` (get single attachment) is unsupported — MYOB exposes no per-attachment
read endpoint (a GET on a single attachment returns 405). Use `attachmentsAll` to list
attachments for a bill and select the file by id or name.

`attachmentsDownload` is unsupported — use the `file_url` from `attachmentsAll` to
download files. MYOB provides presigned S3 URLs in the attachment list response. Two
caveats on those URLs: responses are gzip-encoded (use a client that auto-decompresses,
e.g. `curl --compressed`), and for image uploads MYOB may serve a PDF rendition of the
stored file rather than the original image bytes, while `name` keeps the original
extension. PDFs are returned byte-identical.

`mime_type`, `size`, `created_at` and `updated_at` are always null — MYOB's attachment
object does not carry them.

## POST /accounting/attachments/{reference_type}/{reference_id}

Uploads are supported on bills only — MYOB has no attachment API for invoices, credit
notes, or other records; a non-bill `reference_type` is rejected with a clear error. The
`reference_id` must be the layout-encoded bill ID returned by the bills resource; a raw
MYOB UID is rejected because the bill layout cannot be derived from it. Repeat uploads of
the same file name create separate attachments (MYOB does not deduplicate or replace).

MYOB accepts only .pdf, .tiff, .jpg, .jpeg and .png files, requires the file name to
carry one of those extensions, and validates the extension against the actual content.
Text content types (`text/*`) are rejected upfront: they would be re-encoded as UTF-8,
which corrupts binary files. Send the file's real content type (e.g. application/pdf).
When no `x-apideck-metadata` name is provided, a name is derived from the content type.

The upload response returns the created attachment's `id` and `name` but no `file_url` —
MYOB does not include download URLs on the create response. Fetch the attachment list to
obtain the presigned `file_url`.

## DELETE /accounting/attachments/{reference_type}/{reference_id}/{id}

Deletes are supported on bills only, and the `id` must belong to the bill named by
`reference_id`. An id from a different bill returns `404` rather than deleting it —
MYOB's own API deletes by attachment id alone, so Apideck verifies ownership before
forwarding the delete. The delete removes the file itself, not just the link.

## POST /accounting/bill-payments

MYOB supplier payments cannot be updated — the update operation is unsupported. Delete the payment and recreate it instead.

`allocations[].id` accepts either a bill id returned by the bills resource (layout-encoded) or a raw MYOB purchase UID. In responses, `allocations[].id` contains the raw MYOB purchase UID.

MYOB does not return the company file's base currency on payment records, so domestic payments (no foreign currency set) are reported with `currency: AUD` and `currency_rate: 1.0`. For an NZD-based company file, treat the reported currency of domestic payments as the file's base currency.


[API reference](https://developers.apideck.com/apis/accounting/reference.md) · [Coverage matrix](https://developers.apideck.com/apis/accounting/coverage)
