vsmsconnect — API — myob

← all endpoints

GET/api/v1/accounting/myob/start auth: jwt (administrator)

Begin a MYOB AccountRight Live OAuth2 authorisation flow. Generates PKCE + state, returns the MYOB authorisation URL. Rate-limited (10/min open bucket).

handlers: MyobAuthController.start

Inputs

No parameters.

Outputs

200
APIResponseDataObject<MyobStartResponse>
`{ authorizationUrl }`.
409
APIError
BUSINESS_CONTEXT_REQUIRED.
429
APIError
Rate limit exceeded.
GET/api/v1/accounting/myob/callback auth: none

MYOB OAuth callback. Validates state, exchanges the code, upserts a MyobConnections row per discovered company file, then 302-redirects (desktop) or serves a 200 text/html bridge page (mobile) opening `vsms://auth/myob/{success|failure}`.

handlers: MyobAuthController.callback

Inputs

namerequireddefaultdescription
code query
string
no—OAuth authorisation code returned by MYOB.
state query
string
no—PKCE state issued by `/start`.
error query
string
no—Set by MYOB on failure or user denial.

Outputs

302
redirect
Desktop UA — redirect to `${MYOB_FRONTEND_WEB_BASE_URL}/auth/myob/{success|failure}`.
200
text/html
Mobile UA — HTML bridge to deep link with web fallback.
GET/api/v1/accounting/myob/status auth: jwt

MYOB connection summary — whether a connection exists, the file list, and the current `autoFiscaliseInvoices` flag.

handlers: MyobAuthController.status

Inputs

No parameters.

Outputs

200
APIResponseDataObject<MyobStatusResponse>
Connection summary including `connected`, `activeFile`, `files[]`, `autoFiscaliseInvoices`.
409
APIError
BUSINESS_CONTEXT_REQUIRED.
GET/api/v1/accounting/myob/files auth: jwt

List every MYOB company file authorised for the caller's business, each carrying `isActive` indicating the current sync target.

handlers: MyobAuthController.listFiles

Inputs

No parameters.

Outputs

200
APIResponseDataList<MyobFileSummary>
Company file list.
POST/api/v1/accounting/myob/files/:myobFileId/activate auth: jwt (administrator)

Switch the active MYOB company file for the caller's business. Fires `MYOB_FILE_ACTIVATED` audit.

handlers: MyobAuthController.activateFile

Inputs

namerequireddefaultdescription
myobFileId path
string
yes—MYOB company file ID (1–100 chars).

Outputs

200
APIResponseDataObject<MyobFileSummary>
Newly active file.
404
APIError
File not found for this business.
DELETE/api/v1/accounting/myob/connection auth: jwt (administrator)

Soft-deactivate all MYOB connections for the caller's business (`IsActive=0`). Rows are retained for history. Fires `MYOB_DISCONNECTED` audit.

handlers: MyobAuthController.disconnect

Inputs

No parameters.

Outputs

200
APIResponseDataObject<{ deactivatedCount: number }>
Number of rows deactivated.
GET/api/v1/accounting/myob/tax-mappings auth: jwt (administrator)

List all MYOB tax-mappings for the business (`Provider='myob'`). Mirrors `/accounting/sage/tax-mappings`.

handlers: MyobTaxMappingsController.list

Inputs

No parameters.

Outputs

200
APIResponseDataList<TaxRateMappingDTO>
MYOB mappings (active and inactive, active first).
POST/api/v1/accounting/myob/tax-mappings/auto-map auth: jwt (administrator)

Pull MYOB tax codes + V-SDC `/status` and return match suggestions. Does NOT persist. Rate-limited (10/min open bucket).

handlers: MyobTaxMappingsController.autoMap

Inputs

No parameters.

Outputs

200
APIResponseDataObject<MyobTaxMappingAutoMapResponse>
Suggestions array.
401
APIError
MYOB_REAUTH_REQUIRED — MYOB refresh token rejected.
PUT/api/v1/accounting/myob/tax-mappings auth: jwt (administrator)

Create or update one MYOB tax-mapping. Fires `MYOB_TAX_MAPPING_UPDATED` audit.

handlers: MyobTaxMappingsController.upsert

Inputs

namerequireddefaultdescription
providerTaxType body
string
yes—MYOB tax-code (e.g. `GST`, `FRE`).
providerTaxName body
string | null
no—Human-readable MYOB tax name.
providerRate body
number | null
no—MYOB tax rate.
vsdcTaxLabel body
string
yes—V-SDC label.
vsdcRate body
number | null
no—V-SDC rate percent.

Outputs

200
APIResponseDataObject<TaxRateMappingDTO>
Upserted mapping.
422
APIError
MYOB_TAX_MAPPING_INVALID_LABEL — invalid `vsdcTaxLabel`.
DELETE/api/v1/accounting/myob/tax-mappings/:providerTaxType auth: jwt (administrator)

Soft-delete a MYOB tax-mapping (`IsActive=0`). Idempotent.

handlers: MyobTaxMappingsController.remove

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—MYOB tax-code to deactivate.

Outputs

204
empty
No content.
PATCH/api/v1/accounting/myob/tax-mappings/:providerTaxType/restore auth: jwt (administrator)

Re-activate a deactivated MYOB tax-mapping (`IsActive=1`). Idempotent.

handlers: MyobTaxMappingsController.restore

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—MYOB tax-code to re-activate.

Outputs

204
empty
No content.
GET/api/v1/accounting/myob/sync auth: jwt (administrator | view_invoices | submit_invoices)

Pull-sync `Closed` invoices from the active MYOB company file. Fetches `/Sale/Invoice/Service` and `/Sale/Invoice/Item` merged by UID, normalises, persists to `Invoices` (`Source='myob'`). Idempotency key = `SHA-256(businessId:myobFileId:myobInvoiceId)`. Auto-fiscalisation behaviour matches Xero. HTTP caching disabled. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is the old synchronous body: `data` is now an empty list, `totalRows` the fetched count and `message` the counters string.

handlers: AccountingInvoicesController.myobSync

Inputs

namerequireddefaultdescription
contactId query
string
no—MYOB contact UID — narrows the result.
modifiedSince query
ISO-8601 datetime
no—Forwarded to MYOB OData `$filter`.
dateTo query
ISO-8601 datetime
no—Post-fetch filter on `updatedAt`.
page query
integer
no—1-based page.
pageSize query
integer
no—1–100.

Outputs

202
APIResponseDataObject<BackgroundRunAcceptedDTO>
Started in the background: `{ runId }`. Poll `GET /api/v1/businesses/:businessId/background-runs/:runId`; once `status` is `done`, `result` holds the response body this endpoint used to return.
409
APIError
BACKGROUND_RUN_IN_PROGRESS — a Sync Now for this provider and business is already running. `data` is `BackgroundRunInProgressDTO` (`runId`, `kind`, `params`, `startedAt`) of the running run.
401
APIError
MYOB_REAUTH_REQUIRED.
409
APIError
ACCOUNTING_PROVIDER_NOT_CONFIGURED.
429
APIError
MYOB_RATE_LIMITED.