Developers
The MyBizMate API
Read and record your company's transactions from your own systems. Every transaction tab of the Sheets but Payroll answers at one address, in JSON, held to the same rules as the screen: the same permissions, period locks, approvals and tax.
POST https://mybizmate.io/api/v1/<resource>/<action>
On this page
Quick start
- 1. Turn developer mode on. In MyBizMate, an owner or admin of the company opens Developers and turns it on. It comes with the ERP plans.
- 2. Create an API key. Name it for the system that will use it and choose what it may do. You are shown a key ID (
mbk_…) and a secret (mbs_…). The secret is shown once. - 3. Ask for your company. This needs only the Read permission, so it is the quickest way to see that the key works.
curl -X POST "https://mybizmate.io/api/v1/company/get" \
-u "mbk_YOUR_KEY_ID:mbs_YOUR_SECRET" \
-H "Content-Type: application/json" \
-d "{}"{
"company": {
"id": "6f1c2d3e-8a4b-4c5d-9e6f-0a1b2c3d4e5f",
"name": "Sample Trading",
"legal_name": "Sample Trading Corporation",
"trade_name": null,
"tin": "123-456-789-00000",
"branch_code": "00000",
"vat_registered": true,
"currency": "PHP"
}
}The same call from code, as a helper the rest of this guide uses:
// Node.js 18 or later. Keep the two values in your server's environment.
const KEY_ID = process.env.MYBIZMATE_KEY_ID;
const SECRET = process.env.MYBIZMATE_SECRET;
export async function mybizmate(resource, action, body = {}, idempotencyKey) {
const res = await fetch(`https://mybizmate.io/api/v1/${resource}/${action}`, {
method: "POST",
headers: {
Authorization: "Basic " + Buffer.from(`${KEY_ID}:${SECRET}`).toString("base64"),
"Content-Type": "application/json",
...(idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}),
},
body: JSON.stringify(body),
});
const answer = await res.json();
if (!res.ok) {
throw Object.assign(new Error(answer.error), { status: res.status, reason: answer.reason });
}
return answer;
}
const { company } = await mybizmate("company", "get");import os
import requests
def mybizmate(resource, action, body=None, idempotency_key=None):
res = requests.post(
f"https://mybizmate.io/api/v1/{resource}/{action}",
json=body or {},
auth=(os.environ["MYBIZMATE_KEY_ID"], os.environ["MYBIZMATE_SECRET"]),
headers={"Idempotency-Key": idempotency_key} if idempotency_key else {},
timeout=30,
)
answer = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {answer.get('reason')}: {answer.get('error')}")
return answer
company = mybizmate("company", "get")["company"]Authentication
Every request carries the key as HTTP Basic: the key ID as the user name and the secret as the password. That is the -u option of curl, and the Authorization: Basic … header in code.
- A key belongs to one company and reaches only its books. A request never has to name the company.
- A key acts as the person who created it. It can do what that owner or admin can do in the company, within the key's own permissions, and the audit trail names them. It stops working if they are no longer an owner or admin there.
- The secret is shown once. MyBizMate keeps a one-way hash of it and cannot show it again. If it is lost or exposed, the person the key acts as replaces it, and the old secret stops working at once. Any owner or admin can revoke a key.
- Call the API from a server. It does not answer browsers on other sites, so a secret never has a reason to be in a web page or a mobile app.
Permissions
A key holds one or more of three permissions. Each stands on its own: a key that creates drafts and also looks records up needs both.
| Permission | What it allows |
|---|---|
| Read | List and open the documents of every transaction tab but Payroll, and customers, suppliers, items and other lists. |
| Create and change drafts | Create, change and discard drafts, and turn an order into a draft invoice or bill. |
| Post, void and cancel | Post drafts to the books and void what was posted; move an order along its steps (confirm it, release a purchase order) or cancel it. Give this only to an integration that should act without a person's review. |
Requests and answers
Every call is a POST with a JSON object as its body, and the action's fields in that object. An action that takes none is sent {}. The body may be up to 1 MB.
A call that worked answers 200 with the action's own answer. A list answers data (an array), has_more and next; a get answers data (one record). A call that did not work answers its status with two fields:
HTTP/1.1 403 Forbidden
Content-Type: application/json
{
"error": "This API key does not have the \"post\" permission this action needs.",
"reason": "missing_scope"
}error is a sentence for a person. Where a rule of the books refuses the call, it is the sentence shown on screen for the same thing. reason is a stable code for your program to branch on.
Amounts are numbers in the company's currency. Dates are YYYY-MM-DD; instants are ISO 8601 with an offset. Ids are UUIDs.
Safe retries
Networks fail between a request and its answer. Send every request that writes with an Idempotency-Key header: text of your own that names this one piece of work, such as your order number. It is 1 to 255 visible ASCII characters, with no spaces.
- The same key with the same body answers what the first call answered, and does the work once. Retry as often as you need, even while the first is still running: a retry waits for it, and once it has landed is answered what it was.
- The same key with a different body is refused with
409, reasonidempotency_key_reused: a key names one request. - A key is remembered for one action under one API key.
order-1001onquotation/createand onsales_order/createare two requests. - After a
500or a503, send the same request again with the same key. Nothing is written twice. - A request that was refused left nothing behind. Once its cause is fixed, the same key can be sent again.
- A retry is answered from the key's record for 7 days. After that the same key is refused with
409, reasonidempotency_key_expired, and nothing is made again: look up what the first request made.
Lists and keeping a copy in step
A list answers a page: 50 documents or 100 records unless you send a limit, and never more than 200. While has_more is true, send the fields of next back as they are to get the page after it.
Documents come oldest change first, so a system that keeps a copy asks only for what changed since it last looked. A document that changes while you page is listed again, under its new time. A change is listed once it is 5 minutes old, so a run that follows next passes no save that finishes within that time: start each run where the last one stopped, and keep each document by its id. A document read by its id, and the webhooks, are not held back. The document resource lists every sheet document in one feed, each with its type:
// Every sheet document that changed, oldest change first, a page at a time. A change is listed
// once it is 5 minutes old, so each run starts exactly where the last one stopped.
let cursor = lastRun.cursor ?? {}; // none on a first run: the whole feed is read
for (;;) {
const page = await mybizmate("document", "list", { limit: 200, ...cursor });
for (const doc of page.data) {
await save(doc); // by doc.id: a document seen again replaces your copy; doc.type is its tab
cursor = { updated_since: doc.updated_at, after_id: doc.id }; // the last one read
}
if (!page.has_more) break;
cursor = page.next; // { updated_since, after_id }: send both back as they are
}
lastRun.cursor = cursor; // where the next run startsTo show a list to a person instead, send sort: "date_desc": newest document first, paged with offset.
Errors and limits
A key may send 120 requests a minute. Past that it is answered 429 with a Retry-After header, in seconds. Give each system its own key: each has its own count, and one can be revoked without stopping the others. A key id sent more than 30 times in a minute from one address with the same secret, which is not valid, is answered 429 too with that secret, from that address, for the rest of that minute; the key's right secret, and other keys, are not affected.
| Status | Reason | What it means |
|---|---|---|
| 413 | body_too_large | The body is larger than 1,000,000 bytes. Send fewer lines in one request. |
| 400 | body_invalid | The body is not a JSON object. |
| 401 | invalid_credentials | The key id or the secret is not valid. A request with no Authorization: Basic header at all is the token API's: answered 401 with {"error": "unauthenticated"} and no reason, or 400 first when its body is not a JSON object. |
| 401 | key_revoked | The key was revoked. Create a new one. |
| 401 | key_expired | The key is past its expiry. Create a new one. |
| 403 | developer_mode_off | Developer mode is off for the company. An owner or admin turns it on. |
| 403 | plan_required | The company's plan no longer includes developer mode. |
| 403 | key_owner_not_admin | The person the key acts as is no longer an owner or admin of the company. |
| 429 | rate_limited | Too many requests for this key in one minute. Wait the seconds in Retry-After. |
| 429 | too_many_failed_attempts | This key id was sent more than 30 times in one minute from your address with this same secret, which is not valid (or the key id is none at all), so that key id with that secret is answered this from your address until the minute ends. The key's right secret, and other keys, are not affected. Check the secret your system sends, or wait the seconds in Retry-After. |
| 404 | unknown_action | No such resource or action. |
| 403 | missing_scope | The key lacks the permission this action needs. |
| 422 | field_not_allowed | The body holds a field this action does not take: an id on a create, for one. A sale's or a bill's create names each such field in problems, with what to do about it. |
| 403 | company_mismatch | The body's company_id names another company than the key's. Leave it out. |
| 422 | validation_failed | A required field is missing, or a field is not the kind the action takes. error lists each. |
| 422 | idempotency_key_invalid | The Idempotency-Key is not 1 to 255 visible ASCII characters with no spaces. |
| 409 | idempotency_key_expired | The Idempotency-Key was used for a request more than 7 days ago, and a retry is answered from its record for 7 days only. It is not made again: look up what it made, or send new work under a new key. |
| 409 | idempotency_key_reused | The Idempotency-Key was already used for a different request. Send the first one again unchanged, or use a new key. |
| 404 | not_found | The id names no record of this resource. |
| 403 | permission_denied | The person the key acts as may not do this in the company. error is the sentence they would read on screen. |
| 422 | refused | A rule of the books refuses it: a locked period, an approval still waiting, an entry out of balance. error is the sentence shown on screen. |
| 422 | document_invalid | A sale or bill could not be built from the request's cells. problems names each cell (field, and line for a line's) with the sentence the sheet would show. |
| 422 | cash_terms_in_app | A sale or bill on Cash terms posts with the collection or payment the sheet builds from it, so it is entered in MyBizMate. Send "terms": "on_account" for one recorded on account. |
| 422 | cash_terms_post_in_app | A sales invoice or bill on Cash terms records its payment as it posts. Post it in MyBizMate. |
| 422 | not_a_draft | Only a draft is deleted with a key. Void a posted document instead; a voided one is deleted in MyBizMate. |
| 422 | discount_amount_required | A line names a discount_pct and no discount_amount. Send the amount taken off: the books record the amount. |
| 422 | invalid_request | A value of the request is not valid for this action (an id that names nothing, a number out of range). Correct it and send it again. |
| 422 | limit_reached | A limit of the company's plan was reached. |
| 409 | conflict | It conflicts with a record that already exists, such as a number already taken. |
| 503 | busy | Another request holds the record. Nothing was written: send the same request again. |
| 503 | timeout | The call ran longer than the 8 seconds one call may take, the limit MyBizMate's own screens are held to, and was stopped. Nothing was written: send it again after Retry-After (another request may have been holding the record), and if it is stopped again, send fewer lines in one request. |
| 503 | unavailable | MyBizMate did not answer, so whether a write was made is not known. Send it again under the same Idempotency-Key, which never does it twice; without one, look for what it would have made before sending it again. |
| 500 | server_error | A fault on MyBizMate's side. Send it again with the same Idempotency-Key. |
Some refusals of the books carry a reason of their own in place of refused. Branch on the reasons you handle and treat any other 422 as a refusal to show a person, with its error.
What each tab offers
A resource is a tab of the Sheets, or a list the tabs draw on. The path names the resource and what to do with it.
Sales
From a quotation to the money collected.
| Tab | Resource | Actions |
|---|---|---|
| Quotations | quotation | listgetcreateupdateset_statediscardcancel |
| Sales Orders | sales_order | listgetcreatecreate_fromupdateset_statediscardcancelcreate_from makes an order from a quotation. |
| Fulfillment | fulfillment | listgetcreatecreate_fromupdateset_statediscardcancelcreate_from makes a fulfillment from a sales order. |
| Deliveries | delivery | listgetcreatecreate_fromupdateset_statediscardcancelcreate_from makes a delivery from a sales order or a fulfillment. |
| Sales | invoice | listgetcreatecreate_frompostvoiddeletecreate drafts a sale from its own cells, as the Sales sheet builds it; create_from drafts one from a sales order, a fulfillment or a delivery. |
| Collections | collection | listgetpostvoiddelete |
| Credit Memo | credit_memo | listgetpostvoiddelete |
| Debit Memo | debit_memo | listgetpostvoiddelete |
| CWT (2307 received) | wht_received | listgetpostvoiddeleteA BIR Form 2307 a customer gave for the tax it withheld. |
Purchases
From a request to the money paid.
| Tab | Resource | Actions |
|---|---|---|
| Purchase Requests | purchase_request | listgetcreateupdateset_statediscardcancel |
| Purchase Orders | purchase_order | listgetcreatecreate_fromupdateset_statediscardcancelcreate_from makes an order from a purchase request. |
| Purchases | bill | listgetcreatecreate_frompostvoiddeletecreate drafts a bill from its own cells, as the Purchases sheet builds it; create_from drafts one from a purchase order. |
| Payments | payment | listgetpostvoiddelete |
| Supplier Memo | supplier_memo | listgetpostvoiddelete |
| WTP (2307 issued) | wht_issued | listgetpostvoiddeleteA BIR Form 2307 given to a supplier for the tax withheld from them. |
Stock and the books
Goods in and out, the general journal, and every sheet document in one feed.
| Tab | Resource | Actions |
|---|---|---|
| Stock In | stock_in | listgetpostvoiddelete |
| Stock Out | stock_out | listgetpostvoiddelete |
| Stock Transfer | stock_transfer | listgetpostvoiddelete |
| General Journal | journal_entry | listgetpostvoiddelete |
| All sheet documents | document | listgetRead only: every tab above, and the opening receivables and payables. Payroll is not read with a key. |
Lists
What documents name. Read these to find the ids a document needs.
| Tab | Resource | Actions |
|---|---|---|
| Company | company | get |
| Customers | customer | listAlso filtered by tin. |
| Suppliers | supplier | listAlso filtered by tin. |
| Items | product | list |
| Warehouses | warehouse | list |
| Tax codes | tax_code | listEach code's kind and rate are the ones in force today; a rate recorded from a later day shows from that day. That day moves no updated_at, so a copy of the tax codes is read whole each day, not by updated_since. |
| Chart of accounts | account | list |
The sheet tabs
Sales, Purchases, Collections, Payments, the memos, the stock tabs and the General Journal. <resource> is any of their names above.
POST /api/v1/<resource>/listReadThe tab's documents, a page at a time, each with its total, its party and its status.
| Field | What it is | |
|---|---|---|
status | Optional | draft, posted or voided. Any other word is refused. |
date_from | Optional | Documents dated on or after this day (YYYY-MM-DD). |
date_to | Optional | Documents dated on or before this day (YYYY-MM-DD). |
party_id | Optional | Only this customer's or supplier's documents. |
sort | Optional | updated (the default: oldest change first, for keeping a copy in step; a change is listed once it is 5 minutes old, so read a document you have just written with get) or date_desc (newest document first, at once, paged with offset, for a list on a screen; it reaches the newest 10,000 or so). |
limit | Optional | How many to answer: 1 to 200, 50 when left out. |
updated_since | Optional | Only documents changed at or after this instant (ISO 8601 with an offset). A change is listed once it is 5 minutes old, so a reading that follows next passes no save that finishes within that time: start the next reading where the last one stopped. |
after_id | Optional | With updated_since, both taken from the next of the page before: the page after it. |
offset | Optional | With sort: date_desc: how many to skip, as the next of the page before says; at most 10,000. Past that no next is given, though has_more still says whether more exist: read a whole tab with sort: updated. |
POST /api/v1/<resource>/getReadOne document in full: its lines, what it settles, and what is still open on it.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
POST /api/v1/<resource>/postPost, void and cancelPosts a draft to the books, as Post does on the sheet: its journal entry is written.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
POST /api/v1/<resource>/voidPost, void and cancelVoids a posted document, reversing its journal entry. The document stays, marked voided.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
void_reason | Required | Why, in words. Kept with the document. |
POST /api/v1/<resource>/deleteCreate and change draftsRemoves a DRAFT, and nothing else (not_a_draft): a posted document is voided instead, and a voided one is deleted in MyBizMate.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
POST /api/v1/invoice/create_fromCreate and change draftsDrafts a sales invoice from a sales order, a fulfillment or a delivery, for what is not invoiced yet.
| Field | What it is | |
|---|---|---|
source_document_id | Required | The sales order, fulfillment or delivery. |
doc_date | Optional | The invoice's date (YYYY-MM-DD). Left out, the company's current business day. |
party_id | Optional | The customer, where the source names none. |
POST /api/v1/bill/create_fromCreate and change draftsDrafts a bill from a purchase order, for what is not billed yet.
| Field | What it is | |
|---|---|---|
purchase_order_id | Required | The purchase order. |
doc_date | Optional | The bill's date (YYYY-MM-DD). Left out, the company's current business day. |
Every sheet document
POST /api/v1/document/listReadEvery sheet document, whatever its tab, a page at a time and each with its type: one feed to keep a copy of the books in step. It holds every tab's documents and the opening receivables and payables; payroll is not read with a key.
| Field | What it is | |
|---|---|---|
status | Optional | draft, posted or voided. Any other word is refused. |
date_from | Optional | Documents dated on or after this day (YYYY-MM-DD). |
date_to | Optional | Documents dated on or before this day (YYYY-MM-DD). |
party_id | Optional | Only this customer's or supplier's documents. |
sort | Optional | updated (the default: oldest change first, for keeping a copy in step; a change is listed once it is 5 minutes old, so read a document you have just written with get) or date_desc (newest document first, at once, paged with offset, for a list on a screen; it reaches the newest 10,000 or so). |
limit | Optional | How many to answer: 1 to 200, 50 when left out. |
updated_since | Optional | Only documents changed at or after this instant (ISO 8601 with an offset). A change is listed once it is 5 minutes old, so a reading that follows next passes no save that finishes within that time: start the next reading where the last one stopped. |
after_id | Optional | With updated_since, both taken from the next of the page before: the page after it. |
offset | Optional | With sort: date_desc: how many to skip, as the next of the page before says; at most 10,000. Past that no next is given, though has_more still says whether more exist: read a whole tab with sort: updated. |
POST /api/v1/document/getReadOne sheet document by its id, whatever its tab: what a webhook's document_id is read with.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
The lists and the company
POST /api/v1/<resource>/listReadThe company's records of this kind, a page at a time, in a steady order.
| Field | What it is | |
|---|---|---|
code | Optional | Only the record with this code. |
search | Optional | Only records whose code or name holds this text. |
active | Optional | true for records in use, false for archived ones. Left out, both. |
updated_since | Optional | Only records changed at or after this instant (ISO 8601 with an offset). A filter, not a feed: records are paged by id, and a save still being made while you read can commit afterwards under an earlier time. To keep a copy, start each reading 5 minutes before the last one began, and keep each record by its id. |
limit | Optional | How many to answer: 1 to 200, 100 when left out. |
after_id | Optional | The next.after_id of the page before: the page after it. |
POST /api/v1/company/getReadThe company the key belongs to: its names, TIN, branch code, VAT registration and currency.
It takes no fields: send an empty object.
Creating sales and bills
A sale or a bill is created from its own cells, as a row of the Sales or Purchases sheet is: each line names the account it books to, its tax code and its amount. MyBizMate builds the document as the sheet builds that row: each line's VAT at its tax code's rate on the document's date, a discount taken off before the VAT, the tax withheld from its ATC code, and the receivable or payable on its Trade or Non-Trade account by what the lines sell or buy. It saves a draft, which post posts.
Name each record by its id, as the lists give it: the customer or supplier, each line's account and its tax code. Amounts are numbers. As in a file import, none of the customer's or supplier's defaults is applied (its branch, Terms or payment term): send each cell the document should carry. A request no draft can be made from is answered 422 with every cell at fault in problems, each by its field and, for a line's, its line counted from 1. A warning the sheet would show beside the row comes back in warnings, and the draft is saved.
POST /api/v1/invoice/createCreate and change draftsDrafts a sale from its own cells, built as the Sales sheet builds a row: each line's VAT at its tax code's rate on the document's date, a discount taken off before the VAT, the customer's expected withholding from its ATC code, and the receivable on its Trade or Non-Trade account by what the lines sell. A Regular customer's sale on account, its lines naming accounts and no items. Answered with the draft's id, its entry's total_debit and total_credit, its updated_at and the warnings the sheet would show beside it; post it with post. A request no draft can be made from is refused, each cell at fault named in problems.
| Field | What it is | |
|---|---|---|
date | Required | The document's date (YYYY-MM-DD). |
customer_id | Required | The customer, by its id from the Customers list. |
terms | Required | on_account. A document on Cash terms (cash) is refused (cash_terms_in_app), and so is one that leaves Terms out: as in a file import, a Terms left out is Cash, whatever the customer's or supplier's own default. |
lines | Required | At least one line, at most 200. Each line's fields are listed below. |
reference_no | Optional | The invoice's own number (the SI/OR No.), as your paper prints it. |
particulars | Optional | Particulars: a note kept with the document. |
term_type | Optional | The kind of credit: standard, consignment, charge, cod or check_on_delivery. |
terms_days | Optional | Credit days, 0 to 3,650: the due date follows from them where none is sent. The customer's or supplier's default payment term is not applied. |
due_date | Optional | When it falls due (YYYY-MM-DD). |
branch_id | Optional | Where the company keeps branches: main, or one of its branches by its name as MyBizMate spells it. Left out, the document is booked to Main: the customer's or supplier's default branch is not applied. A company with no branches has no such field. |
cf_… | Optional | A field of the company's own (Settings → Custom fields), by its key. One that names a record of a master is not filled with a key yet. |
POST /api/v1/bill/createCreate and change draftsDrafts a bill from its own cells, built as the Purchases sheet builds a row: each line's Input VAT at its tax code's rate on the document's date (on Importation where the code is one), a discount taken off before the VAT, the tax withheld from its ATC code, and the payable on its Trade or Non-Trade account by what the lines buy. A bill on account, its lines naming accounts and no items. Answered with the draft's id, its entry's total_debit and total_credit, its updated_at and the warnings the sheet would show beside it; post it with post. A request no draft can be made from is refused, each cell at fault named in problems.
| Field | What it is | |
|---|---|---|
date | Required | The document's date (YYYY-MM-DD). |
supplier_id | Required | The supplier, by its id from the Suppliers list. |
terms | Required | on_account. A document on Cash terms (cash) is refused (cash_terms_in_app), and so is one that leaves Terms out: as in a file import, a Terms left out is Cash, whatever the customer's or supplier's own default. |
lines | Required | At least one line, at most 200. Each line's fields are listed below. |
reference_no | Optional | The supplier's invoice number, as their paper prints it. |
particulars | Optional | Particulars: a note kept with the document. |
term_type | Optional | The kind of credit: standard, consignment, charge, cod or check_on_delivery. |
terms_days | Optional | Credit days, 0 to 3,650: the due date follows from them where none is sent. The customer's or supplier's default payment term is not applied. |
due_date | Optional | When it falls due (YYYY-MM-DD). |
branch_id | Optional | Where the company keeps branches: main, or one of its branches by its name as MyBizMate spells it. Left out, the document is booked to Main: the customer's or supplier's default branch is not applied. A company with no branches has no such field. |
cf_… | Optional | A field of the company's own (Settings → Custom fields), by its key. One that names a record of a master is not filled with a key yet. |
A sale's line
| Field | What it is | |
|---|---|---|
revenue_account_id | Required | The income account, by its id from the Chart of accounts list. |
tax_profile_id | Required | The line's tax code, by its id from the Tax codes list, at its rate on the document's date. Where the company's books carry no VAT (a Non-VAT plan, or no VAT registration), a sale takes a non-VAT code: a VAT, zero-rated or exempt one is refused, as the Sales sheet offers none of them there. |
gross | Required | The line's amount, a number: VAT included where its tax code charges VAT. |
discount | Optional | An amount taken off the line before its VAT, a number. |
line_description | Optional | What the line is, in words. |
atc_it_code | Optional | The ATC code of the income tax the customer withholds from this line (its 2307 to come). A code the ATC list does not hold is refused. |
atc_vat_code | Optional | The ATC code of the VAT the customer withholds. |
A bill's line
| Field | What it is | |
|---|---|---|
expense_account_id | Required | The account the bill debits — a purchase, an expense or an asset — by its id from the Chart of accounts list. Where the company tracks PPE items, a line on a fixed-asset account is drafted as the Purchases sheet drafts it, and its PPE items are linked in MyBizMate: bill.post refuses the bill until they cover the line. |
tax_profile_id | Required | The line's tax code, by its id from the Tax codes list, at its rate on the document's date. On a company that is not VAT-registered, a line under a VAT code keeps its VAT in its cost, as the Purchases sheet books it: no Input VAT is claimed. |
gross | Required | The line's amount, a number: VAT included where its tax code charges VAT. |
discount | Optional | An amount taken off the line before its VAT, a number. |
line_description | Optional | What the line is, in words. |
atc_code | Optional | The ATC code of the tax you withhold from the supplier on this line (EWT). A code the ATC list does not hold is refused. |
atc_wvat_code | Optional | The ATC code of the VAT you withhold from the supplier. |
An example
POST /api/v1/invoice/create
Idempotency-Key: shop-sale-SI-004211
{
"date": "2026-11-27",
"customer_id": "0b7e6a52-3c1d-4f8e-9a2b-5d4c3b2a1f0e",
"terms": "on_account",
"terms_days": 30,
"reference_no": "SI-004211",
"lines": [
{
"revenue_account_id": "5f1d3b7a-9c2e-4d6f-8a1b-3c5e7f9a1b2d",
"tax_profile_id": "7d9f1b3a-5c7e-4a2b-8d6f-0e1a2b3c4d5e",
"gross": 11200,
"line_description": "Office chairs, 4 pcs"
},
{
"revenue_account_id": "5f1d3b7a-9c2e-4d6f-8a1b-3c5e7f9a1b2d",
"tax_profile_id": "7d9f1b3a-5c7e-4a2b-8d6f-0e1a2b3c4d5e",
"gross": 560,
"discount": 56,
"line_description": "Delivery"
}
]
}{
"id": "a3c5e7f9-1b2d-4e6f-8a0b-2c4d6e8f0a1b",
"total_debit": 11704,
"total_credit": 11704,
"updated_at": "2026-11-27T02:14:09.512341+00:00",
"warnings": []
}Creating orders
Quotations, Sales Orders, Fulfillment, Deliveries, Purchase Requests and Purchase Orders can be created and changed with a key. <resource> is any of their names.
POST /api/v1/<resource>/listReadThe tab's documents, a page at a time, each with its totals, its step and its status.
| Field | What it is | |
|---|---|---|
state | Optional | Only documents at this step of the tab's flow. |
status | Optional | draft, posted or cancelled. Any other word is refused. |
date_from | Optional | Documents dated on or after this day (YYYY-MM-DD). |
date_to | Optional | Documents dated on or before this day (YYYY-MM-DD). |
party_id | Optional | Only this customer's or supplier's documents. |
sort | Optional | updated (the default: oldest change first, for keeping a copy in step; a change is listed once it is 5 minutes old, so read a document you have just written with get) or date_desc (newest document first, at once, paged with offset, for a list on a screen; it reaches the newest 10,000 or so). |
limit | Optional | How many to answer: 1 to 200, 50 when left out. |
updated_since | Optional | Only documents changed at or after this instant (ISO 8601 with an offset). A change is listed once it is 5 minutes old, so a reading that follows next passes no save that finishes within that time: start the next reading where the last one stopped. |
after_id | Optional | With updated_since, both taken from the next of the page before: the page after it. |
offset | Optional | With sort: date_desc: how many to skip, as the next of the page before says; at most 10,000. Past that no next is given, though has_more still says whether more exist: read a whole tab with sort: updated. |
POST /api/v1/<resource>/getReadOne document in full: its lines, what it was made from, and next_states, the steps its tab's flow allows from where it stands.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
POST /api/v1/<resource>/createCreate and change draftsCreates a draft on the tab. Each line states a quantity and a price; MyBizMate works out its amount, and its tax where it names a tax code.
| Field | What it is | |
|---|---|---|
posting_date | Required | The document's date (YYYY-MM-DD). |
lines | Required | At least one line, at most 200. Each line's fields are listed below. |
party_id | Optional | The customer (sales tabs) or the supplier (purchase tabs). |
reference_no | Optional | Your own reference for the document: an order number of your system. |
memo | Optional | A note kept with the document. |
due_date | Optional | When it falls due (YYYY-MM-DD). |
POST /api/v1/<resource>/create_fromCreate and change draftsCreates the tab's document from the one before it in the flow, carrying the lines named.
| Field | What it is | |
|---|---|---|
source_document_id | Required | The document to carry forward. |
lines | Required | Which of its lines, and how much of each: { "source_line_id": "…", "all": true } for all that is left of a line, or "qty" in place of all for part of it. Line ids come from the source's get. |
POST /api/v1/<resource>/updateCreate and change draftsReplaces a draft's header and lines with the ones sent.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
posting_date | Required | The document's date (YYYY-MM-DD). |
lines | Required | Every line the document should hold: a line left out is removed. Send a line's id, as get answers it, for it to stay the same line. Where you change a line's quantity, price or discount, leave its gross_amount, net_amount and tax_amount out: MyBizMate works them out again, and an amount you send is kept as sent and must agree. |
party_id | Optional | The customer (sales tabs) or the supplier (purchase tabs). |
reference_no | Optional | Your own reference for the document: an order number of your system. |
memo | Optional | A note kept with the document. |
due_date | Optional | When it falls due (YYYY-MM-DD). |
POST /api/v1/<resource>/set_statePost, void and cancelMoves a document to another step of its tab's flow, as the step menu does on the sheet. Leaving the first step finalises it, so this needs the Post permission.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
to_state | Required | The step to move to: the state of one of the next_states that get answers. |
POST /api/v1/<resource>/discardCreate and change draftsRemoves a draft that nothing was made from.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
POST /api/v1/<resource>/cancelPost, void and cancelCancels a document that is past draft. It stays, marked cancelled.
| Field | What it is | |
|---|---|---|
id | Required | The record's id, as list answers it. |
cancel_reason | Required | Why, in words. Kept with the document. |
A line
State what you know about a line. MyBizMate works out its amount as quantity times price less the discount, and its tax from the tax code at the rate of the document's date.
| Field | What it is | |
|---|---|---|
description | Optional | What the line is, in words. Send the item's name when the line is an item. |
item_id | Optional | The item, from the Items list. Needs a qty above zero. |
qty | Optional | The quantity, a number. |
unit_price | Optional | The price of one, a number: what the customer pays, VAT included where the line's tax code is a VAT code. |
discount_amount | Optional | An amount taken off the line, a number. Left out, none. A percentage off is sent as its amount: a line that names a discount_pct other than 0 and no discount_amount is refused (discount_amount_required). |
tax_code_id | Optional | The line's tax code, from the Tax codes list (an item's own is its default_tax_code_id). Left out, the line is not taxed. |
uom | Optional | The unit of measure, one from MyBizMate's list of units. |
warehouse_id | Optional | The warehouse the line ships from or receives into. |
An example
POST /api/v1/quotation/create
Idempotency-Key: web-order-000123
{
"posting_date": "2026-11-27",
"party_id": "0b7e6a52-3c1d-4f8e-9a2b-5d4c3b2a1f0e",
"reference_no": "WEB-000123",
"lines": [
{
"item_id": "c2a4e6f8-1b3d-4a5c-8e7f-9a0b1c2d3e4f",
"description": "A4 copy paper, ream",
"qty": 10,
"unit_price": 285,
"tax_code_id": "7d9f1b3a-5c7e-4a2b-8d6f-0e1a2b3c4d5e"
},
{ "description": "Delivery", "qty": 1, "unit_price": 150 }
]
}{
"id": "e4b1c7a9-2f6d-4b8a-9c3e-1d5f7a9b2c4e",
"total_net": 2694.64,
"total_tax": 305.36,
"total_gross": 3000,
"action": "erp_document.created"
}From a quotation to a posted sales invoice:
// 1. A quotation becomes a sales order: carry every line that is still open.
const { data: quote } = await mybizmate("quotation", "get", { id: quotationId });
const order = await mybizmate(
"sales_order",
"create_from",
{
source_document_id: quote.id,
lines: quote.lines.map((line) => ({ source_line_id: line.id, all: true })),
},
`order-from-${quote.id}`,
);
// 2. Move the order along its flow: the steps it may take next are in next_states.
const { data: current } = await mybizmate("sales_order", "get", { id: order.id });
await mybizmate(
"sales_order",
"set_state",
{ id: order.id, to_state: current.next_states[0].state },
`confirm-${order.id}`,
);
// 3. Draft its sales invoice, then post it to the books.
const invoice = await mybizmate(
"invoice",
"create_from",
{ source_document_id: order.id },
`invoice-from-${order.id}`,
);
await mybizmate("invoice", "post", { id: invoice.id }, `post-${invoice.id}`);Webhooks
A webhook tells your system that something happened, so it does not have to keep asking. In MyBizMate, on the Developers page, add an HTTPS address and choose its events. You are shown the endpoint's signing secret once.
| Event | When it is sent |
|---|---|
document.posted | A sheet document was posted to the books. data.document_id names it: read it with document/get. A posted payroll run sends it too, and is not read with a key. |
erp_document.posted | A document of the earlier ERP module was posted. Sent only for companies that use that module. |
POST /your/endpoint
Content-Type: application/json
X-MyBizMate-Signature: t=1795749165,v1=5f2b…c81e
X-MyBizMate-Event-Id: 9a3c1e5b-7d2f-4b6a-8c0e-2f4a6c8e0b1d
{
"id": "9a3c1e5b-7d2f-4b6a-8c0e-2f4a6c8e0b1d",
"type": "document.posted",
"version": 1,
"occurred_at": "2026-11-27T03:12:45.120Z",
"company_id": "6f1c2d3e-8a4b-4c5d-9e6f-0a1b2c3d4e5f",
"correlation_id": "1e3a5c7e-9b1d-4f3a-8c5e-7a9b1c3d5e7f",
"data": {
"document_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"doc_no": "SI-000042",
"gl_entry_id": "3c5e7a9b-1d2f-4b6c-8e0a-2c4e6a8b0d1f",
"total_debit": 3000,
"updated_at": "2026-11-27T03:12:45.098Z"
}
}- Answer within 10 seconds with any
2xxstatus. Do the slow work after you answer. - A delivery that fails is sent again, up to 8 times in all, the wait doubling from about a minute. A redirect counts as a failure: give the final address.
- The same event can arrive twice. Keep the
X-MyBizMate-Event-Idof what you have handled and skip one you have seen. - Check the signature before you trust a delivery.
X-MyBizMate-Signaturecarries a timestamptandv1, the HMAC-SHA256 of<t>.<the raw body>in hex, keyed with the endpoint's signing secret.
import crypto from "node:crypto";
// rawBody is the request body exactly as it arrived, as text, BEFORE any JSON parsing.
export function isFromMyBizMate(rawBody, signatureHeader, signingSecret, toleranceSeconds = 300) {
const parts = Object.fromEntries((signatureHeader ?? "").split(",").map((p) => p.split("=")));
const timestamp = Number(parts.t);
if (!Number.isFinite(timestamp) || !parts.v1) return false;
// Too old or too far ahead: a valid signature replayed later is refused here.
if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
const expected = crypto
.createHmac("sha256", signingSecret)
.update(`${timestamp}.${rawBody}`)
.digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Not available yet
Said plainly, so that nobody builds on a guess:
- Creating a document from nothing on the other classic sheet tabs: Collections, Payments, the memos, the 2307s (CWT and WTP), Stock In, Stock Out, Stock Transfer and the General Journal. Enter it in MyBizMate; it can then be read, posted, voided and deleted with the API.
- With
createon Sales and Purchases: a sale or purchase on Cash terms, a line naming an item, a statutory buyer's sale (Senior Citizen, PWD, Solo Parent, National Athlete or Coach, Medal of Valor), a custom field that names a record of a master, a named payment term (sendterms_daysordue_date) and a bill's VAT on Invoice cell (on a company that is not VAT-registered, a line under the supplier's VAT code keeps its VAT in its cost and withholds on the amount without it). Enter those in MyBizMate, or draft a sales invoice or a bill from an order withcreate_from. - Posting a sales invoice or a bill on Cash terms. Its collection or payment is recorded as it posts, so it is posted in MyBizMate.
- Creating or changing customers, suppliers and items. They are read here.
- Payroll: a key reads no payroll run, since it would read every employee's pay. A posted payroll run still sends
document.posted, anddocument/getanswers itnot_found. - Timekeeping, tax returns and financial reports.
- Webhook events other than a document being posted, a log of deliveries you can read, and replacing or removing an endpoint's signing secret (an endpoint can be paused).
OpenAPI and help
The same contract is published as an OpenAPI 3.1 document, generated from what the server accepts, for a client generator or an API tool: /api/v1/openapi.json.
Stuck, or need something this page says is not available yet? Write to support@mybizmate.io with the reason you were answered and the time of the request.
Your books, open to your own systems
Developer mode comes with the ERP plans. Start with the books, and connect your online store, your other systems or a field app when you are ready.
