BillingNote
12 tools
CreateBillingNote
WHEN TO USE Use when the customer wants one combined bill instead of receiving multiple separate invoices — typically for customers billed on a recurring/batch cycle. BUSINESS RULES & PRE-CONDITIONS All invoices being combined must already exist (Approve status) — resolve each via GetInvoice first. Populate the `transactions` array with each invoice's `code` and `amount`. FALLBACK & ERROR HANDLING An invoice code in the list doesn't resolve → confirm with the user before dropping it silently from the batch. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
3 required · 24 optional
CreateBillingNote
WHEN TO USE Use when the customer wants one combined bill instead of receiving multiple separate invoices — typically for customers billed on a recurring/batch cycle. BUSINESS RULES & PRE-CONDITIONS All invoices being combined must already exist (Approve status) — resolve each via GetInvoice first. Populate the `transactions` array with each invoice's `code` and `amount`. FALLBACK & ERROR HANDLING An invoice code in the list doesn't resolve → confirm with the user before dropping it silently from the batch. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| transactions | array[BillingNoteTransaction] | required | array[BillingNoteTransaction] — docs to invoice. sub-fields: id, code, amount?array[BillingNoteTransaction] fields
|
||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||
| dueDate | string | required | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||
| withHoldingTaxAmount | string | optional | Withholding tax amount for the document. | ||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||
| accountCode | string | optional | Account code to be used for recording financial transactions | ||||||||
| accountSubId | string | optional | Sub-account ID for recording | ||||||||
| accountSubCode | string | optional | Sub-account code for recording | ||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||
| chequeAccountNo | string | optional | Bank account number | ||||||||
| chequeBranchNo | string | optional | Bank branch number | ||||||||
| chequeNo | string | optional | Cheque number | ||||||||
| chequeAmount | number? | optional | Cheque amount | ||||||||
| chequeDate | string | optional | Cheque date (yyyyMMdd) | ||||||||
| chequeBankId | integer? | optional | Financial institution code (if type=2, required) | ||||||||
| chequePaymentMethodId | string | optional | Payment method ID for the cheque | ||||||||
| chequePaymentMethodCode | string | optional | Payment method code for the cheque | ||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakBillingNotes": {
"resCode": "200",
"resDesc": "PeakBillingNotes have Completed",
"billingNotes": [{
"id": "faa7a1d3-71af-48d0-bdd2-8c262bb15331",
"code": "BAAN01A00039",
"issuedDate": "20211209",
"dueDate": "20211216",
"contactId": "129c968f-23e9-4ee9-9dc7-3f799b47c029",
"contactCode": "C00003",
"transactions": [{ "id": "guid", "code": "IVTZ202112028", "amount": 260 }],
"preTaxAmount": 242.99,
"netAmount": 260,
"vatAmount": 17.01,
"whtAmount": 0,
"paymentAmount": 0,
"remainAmount": 260,
"remainWhtAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}]
}
}
CreateBillingNoteExpense
WHEN TO USE Use when paying several vendor bills together in one batch rather than individually. BUSINESS RULES & PRE-CONDITIONS All expense being combined must already exist (Approve status) — resolve each via GetExpense first. Populate the `transactions` array with each invoice's `code` and `amount`. FALLBACK & ERROR HANDLING An expense code in the list doesn't resolve → confirm with the user before dropping it silently from the batch. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
3 required · 24 optional
CreateBillingNoteExpense
WHEN TO USE Use when paying several vendor bills together in one batch rather than individually. BUSINESS RULES & PRE-CONDITIONS All expense being combined must already exist (Approve status) — resolve each via GetExpense first. Populate the `transactions` array with each invoice's `code` and `amount`. FALLBACK & ERROR HANDLING An expense code in the list doesn't resolve → confirm with the user before dropping it silently from the batch. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| transactions | array[BillingNoteTransaction] | required | array[BillingNoteTransaction] — docs to invoice. sub-fields: id, code, amount?array[BillingNoteTransaction] fields
|
||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||
| dueDate | string | required | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||
| withHoldingTaxAmount | string | optional | Withholding tax amount for the document. | ||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||
| accountCode | string | optional | Account code to be used for recording financial transactions | ||||||||
| accountSubId | string | optional | Sub-account ID for recording | ||||||||
| accountSubCode | string | optional | Sub-account code for recording | ||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||
| chequeAccountNo | string | optional | Bank account number | ||||||||
| chequeBranchNo | string | optional | Bank branch number | ||||||||
| chequeNo | string | optional | Cheque number | ||||||||
| chequeAmount | number? | optional | Cheque amount | ||||||||
| chequeDate | string | optional | Cheque date (yyyyMMdd) | ||||||||
| chequeBankId | integer? | optional | Financial institution code (if type=2, required) | ||||||||
| chequePaymentMethodId | string | optional | Payment method ID for the cheque | ||||||||
| chequePaymentMethodCode | string | optional | Payment method code for the cheque | ||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakBillingNotesExpenses": {
"resCode": "200",
"resDesc": "PeakBillingNotesExpenses have Completed",
"billingNotesExpenses": [{
"id": "faa7a1d3-71af-48d0-bdd2-8c262bb15331",
"code": "BNX01A00039",
"issuedDate": "20211209",
"dueDate": "20211216",
"contactId": "129c968f-23e9-4ee9-9dc7-3f799b47c029",
"contactCode": "C00003",
"transactions": [{ "id": "guid", "code": "IVTZ202112028", "amount": 260 }],
"preTaxAmount": 242.99,
"netAmount": 260,
"vatAmount": 17.01,
"whtAmount": 0,
"paymentAmount": 0,
"remainAmount": 260,
"remainWhtAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetBillingNoteExpense
WHEN TO USE Use to read ONE purchase-side billing note (ใบรวมจ่าย, CPN) you already have an identifier for — to check status or an outstanding balance before referencing or voiding it. For sales-side billing notes, use GetBillingNote instead. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListBillingNoteExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "CPN202605002"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching billing note expense with code, issuedDate, contactId / contactCode, netAmount, remainAmount and documentLink.
0 required · 6 optional
GetBillingNoteExpense
WHEN TO USE Use to read ONE purchase-side billing note (ใบรวมจ่าย, CPN) you already have an identifier for — to check status or an outstanding balance before referencing or voiding it. For sales-side billing notes, use GetBillingNote instead. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListBillingNoteExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "CPN202605002"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching billing note expense with code, issuedDate, contactId / contactCode, netAmount, remainAmount and documentLink.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'BNX0600027'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakBillingNotesExpenses": {
"resCode": "200",
"resDesc": "PeakBillingNotesExpenses have Completed",
"totalBillingNoteExpense": 1,
"billingNotesExpenses": [{
"id": "guid",
"code": "BNX0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}]
}
}
ListBillingNoteExpense
WHEN TO USE Use to review purchase-side billing notes (ใบวางบิลซื้อ, BNX) a vendor has issued to this business — to check status, see an outstanding balance, or find a document code before referencing it. For sales-side billing notes issued to customers, use ListBillingNote instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (format yyyyMMdd), status, and searchText (contact name or document code). Use limit and page to paginate — each page returns 10 entries. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before telling the user nothing was found. On several near-matches, show the list (code + issuedDate + contact + netAmount) and let the user pick; don't guess from a partial code. EXPECTED OUTCOME Returns billing note expenses with code, issuedDate, contactId / contactCode, netAmount, and documentLink for sharing with the user.
0 required · 6 optional
ListBillingNoteExpense
WHEN TO USE Use to review purchase-side billing notes (ใบวางบิลซื้อ, BNX) a vendor has issued to this business — to check status, see an outstanding balance, or find a document code before referencing it. For sales-side billing notes issued to customers, use ListBillingNote instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (format yyyyMMdd), status, and searchText (contact name or document code). Use limit and page to paginate — each page returns 10 entries. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before telling the user nothing was found. On several near-matches, show the list (code + issuedDate + contact + netAmount) and let the user pick; don't guess from a partial code. EXPECTED OUTCOME Returns billing note expenses with code, issuedDate, contactId / contactCode, netAmount, and documentLink for sharing with the user.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Start date for filtering billing note expenses (format yyyyMMdd). |
| dateEnd | string | optional | End date for filtering billing note expenses (format yyyyMMdd). |
| status | integer? | optional | Status of the billing note expense for filtering. (0 = None, 1 = Voided, 2 = Draft, 3 = AwaitApproval, 4 = Outstanding, 5 = Overdue, 6 = PaidOrAwaitReceipt) |
| searchText | string | optional | Text to search for in billing note expenses. |
| limit | integer? | optional | Maximum number of entries to retrieve. |
| page | integer? | optional | Page number for displaying data, where each page will show 10 entries. |
Response
{
"PeakBillingNotesExpenses": {
"resCode": "200",
"resDesc": "PeakBillingNotesExpenses have Completed",
"totalBillingNoteExpense": 3,
"billingNotesExpenses": [{
"id": "guid",
"code": "BNX0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetBillingNote
WHEN TO USE Use to read ONE sales billing note (ใบวางบิล) you already have an identifier for — to check status or remaining balance before recording another or before voiding. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListBillingNote instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "BN202601001"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching billing note with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetBillingNote
WHEN TO USE Use to read ONE sales billing note (ใบวางบิล) you already have an identifier for — to check status or remaining balance before recording another or before voiding. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListBillingNote instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "BN202601001"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching billing note with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'BN0600027'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakBillingNotes": {
"resCode": "200",
"resDesc": "PeakBillingNotes have Completed",
"totalBillingNote": 1,
"billingNotes": [{
"id": "guid",
"code": "BN0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}]
}
}
ListBillingNote
WHEN TO USE Use to check status or remaining balance on billing note already created — e.g. before recording an additional billing note , or before voiding. BUSINESS RULES & PRE-CONDITIONS Filter by date range, status or Search keyword - contact name, document number Default: 1st of last month – End of current month FALLBACK & ERROR HANDLING No match → confirm the filter or date range with the user rather than assuming a typo and guessing a correction. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListBillingNote
WHEN TO USE Use to check status or remaining balance on billing note already created — e.g. before recording an additional billing note , or before voiding. BUSINESS RULES & PRE-CONDITIONS Filter by date range, status or Search keyword - contact name, document number Default: 1st of last month – End of current month FALLBACK & ERROR HANDLING No match → confirm the filter or date range with the user rather than assuming a typo and guessing a correction. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Displays documents starting from the specified date (Format: yyyyMMdd). |
| dateEnd | string | optional | Displays documents ending on the specified date (Format: yyyyMMdd). |
| status | integer? | optional | Doc status (0=None,1=Voided,2=Draft,3=AwaitApproval,4=Outstanding,5=Overdue,6=PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakBillingNotes": {
"resCode": "200",
"resDesc": "PeakBillingNotes have Completed",
"totalBillingNote": 3,
"billingNotes": [{
"id": "guid",
"code": "BN0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}]
}
}
VoidBillingNote
WHEN TO USE Only when the user explicitly asks to cancel an existing billing note (ใบวางบิล). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Billing notes cannot be edited — to correct one, void it and issue a replacement with CreateBillingNote. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetBillingNote to look it up. The billing note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this billing note while another document still references it — void the referencing document first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the billing note was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
VoidBillingNote
WHEN TO USE Only when the user explicitly asks to cancel an existing billing note (ใบวางบิล). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Billing notes cannot be edited — to correct one, void it and issue a replacement with CreateBillingNote. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetBillingNote to look it up. The billing note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this billing note while another document still references it — void the referencing document first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the billing note was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the billing note to be voided |
| id | string | optional | The Unique Identifier of the billing note to be voided |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidBillingNoteExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing combine payment note (ใบรวมจ่าย). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Combine payment notes cannot be edited — to correct one, void it and issue a replacement with CreateBillingNoteExpense. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetBillingNoteExpense to look it up. The combine payment note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this combine payment note while another document still references it — void the referencing document first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the combine payment note was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
VoidBillingNoteExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing combine payment note (ใบรวมจ่าย). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Combine payment notes cannot be edited — to correct one, void it and issue a replacement with CreateBillingNoteExpense. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetBillingNoteExpense to look it up. The combine payment note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this combine payment note while another document still references it — void the referencing document first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the combine payment note was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the combine payment note to be voided |
| id | string | optional | The Unique Identifier of the combine payment note to be voided |
Response
{ "resCode": "200", "resDesc": "Success" }
RecordBillingNotePayment
WHEN TO USE Use when a customer has paid against an existing sales billing note (ใบวางบิลขาย) in full (รับชำระ). Do not use it to record payment on the invoices inside the billing note one by one (the billing note payment settles them together), and not to issue a receipt document (use CreateReceipt). BUSINESS RULES & PRE-CONDITIONS Identify the billing note with code or id, exactly one of the two. Use GetBillingNote to look it up. The billing note must be approved and still awaiting payment. PEAK refuses draft, voided and fully paid documents. PEAK accepts only one payment that settles the whole outstanding amount: paymentAmount plus any withHoldingTaxAmount must equal remainAmount on GetBillingNote. A partial payment is refused with "Should do full payment". paymentDate (yyyyMMdd) is required: ask the user when the money was received if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. withHoldingTaxAmount is the withholding tax deducted, either an amount ("30") or a percentage ("3%"). FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the document number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or a "net amount ... payment" message means the amount is more than what is still outstanding. "Transaction must be Waiting Payment Status." means the billing note is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. remainPaymentAmount in this response is not reliable for billing notes (it can still show the full amount after a full payment), so confirm the balance with GetBillingNote. Report the document number and the amount received. Keep paidPayments.journals[].code (e.g. RV-202610001): VoidBillingNotePayment needs it to cancel this payment.
0 required · 8 optional
RecordBillingNotePayment
WHEN TO USE Use when a customer has paid against an existing sales billing note (ใบวางบิลขาย) in full (รับชำระ). Do not use it to record payment on the invoices inside the billing note one by one (the billing note payment settles them together), and not to issue a receipt document (use CreateReceipt). BUSINESS RULES & PRE-CONDITIONS Identify the billing note with code or id, exactly one of the two. Use GetBillingNote to look it up. The billing note must be approved and still awaiting payment. PEAK refuses draft, voided and fully paid documents. PEAK accepts only one payment that settles the whole outstanding amount: paymentAmount plus any withHoldingTaxAmount must equal remainAmount on GetBillingNote. A partial payment is refused with "Should do full payment". paymentDate (yyyyMMdd) is required: ask the user when the money was received if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. withHoldingTaxAmount is the withholding tax deducted, either an amount ("30") or a percentage ("3%"). FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the document number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or a "net amount ... payment" message means the amount is more than what is still outstanding. "Transaction must be Waiting Payment Status." means the billing note is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. remainPaymentAmount in this response is not reliable for billing notes (it can still show the full amount after a full payment), so confirm the balance with GetBillingNote. Report the document number and the amount received. Keep paidPayments.journals[].code (e.g. RV-202610001): VoidBillingNotePayment needs it to cancel this payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the billing note that was paid (e.g. 'BN-20261000001'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the billing note that was paid. Provide this or code, not both |
| paymentDate | string | optional | Required. The date the money was received, format yyyyMMdd (e.g. '20261014') |
| paymentAmount | number? | optional | Required. The amount received in this payment, excluding withholding tax |
| paymentMethodCode | string | optional | Code of the payment method the money came in through (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | The Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Withholding tax the customer deducted, as an amount (e.g. '30') or a percentage (e.g. '3%'). Omit when none was withheld |
| note | string | optional | Optional note for this payment |
VoidBillingNotePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการรับชำระ) a payment already recorded on a billing note (ใบวางบิลขาย), for example one entered by mistake. This does not void the billing note itself (use VoidBillingNote for that). BUSINESS RULES & PRE-CONDITIONS Identify the billing note with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. RV-202610001). RecordBillingNotePayment returns it, and GetBillingNote lists it under paidPayments[].journals[].code. When the billing note has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the billing note first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the billing note, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetBillingNote and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The billing note's outstanding amount goes up by that amount, and GetBillingNote no longer lists the payment.
0 required · 3 optional
VoidBillingNotePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการรับชำระ) a payment already recorded on a billing note (ใบวางบิลขาย), for example one entered by mistake. This does not void the billing note itself (use VoidBillingNote for that). BUSINESS RULES & PRE-CONDITIONS Identify the billing note with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. RV-202610001). RecordBillingNotePayment returns it, and GetBillingNote lists it under paidPayments[].journals[].code. When the billing note has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the billing note first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the billing note, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetBillingNote and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The billing note's outstanding amount goes up by that amount, and GetBillingNote no longer lists the payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the billing note the payment belongs to (e.g. 'BN-20261000001'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the billing note the payment belongs to. Provide this or code, not both |
| paymentJournalCode | string | optional | Required. Journal code of the payment to cancel (e.g. 'RV-202610001'), from RecordBillingNotePayment or GetBillingNote paidPayments[].journals[].code |
Response
{
"resCode": "200",
"resDesc": "Completed",
"transactionCode": "C001",
"paymentJournalCode": "C001",
"paymentDate": "2026-01-01",
"paymentTotal": 0
}
RecordBillingNoteExpensePayment
WHEN TO USE Use when the user's business paid a supplier against an existing purchase billing note (ใบวางบิลซื้อ) in full (จ่ายชำระ). Do not use it to record payment on the expenses inside the billing note one by one (the billing note payment settles them together). BUSINESS RULES & PRE-CONDITIONS Identify the billing note expense with code or id, exactly one of the two. Use GetBillingNoteExpense to look it up. The billing note expense must be approved and still awaiting payment. PEAK refuses draft, voided and fully paid documents. PEAK accepts only one payment that settles the whole outstanding amount: paymentAmount plus any withHoldingTaxAmount must equal remainAmount on GetBillingNoteExpense. A partial payment is refused with "Should do full payment". paymentDate (yyyyMMdd) is required: ask the user when the money was paid if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. withHoldingTaxAmount is the withholding tax deducted, either an amount ("30") or a percentage ("3%"). When the billing note expense has withholding tax, PEAK requires withHoldingTaxAmount to equal the document's withholding tax exactly (resCode 347 "Payment Wht amount must equal to suggest wht" otherwise): read it from GetBillingNoteExpense first. FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the document number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or a "net amount ... payment" message means the amount is more than what is still outstanding. "Transaction must be Waiting Payment Status." means the billing note expense is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. remainPaymentAmount in this response is not reliable for billing notes (it can still show the full amount after a full payment), so confirm the balance with GetBillingNoteExpense. Report the document number and the amount paid. Keep paidPayments.journals[].code (e.g. PV-202610001): VoidBillingNoteExpensePayment needs it to cancel this payment.
0 required · 8 optional
RecordBillingNoteExpensePayment
WHEN TO USE Use when the user's business paid a supplier against an existing purchase billing note (ใบวางบิลซื้อ) in full (จ่ายชำระ). Do not use it to record payment on the expenses inside the billing note one by one (the billing note payment settles them together). BUSINESS RULES & PRE-CONDITIONS Identify the billing note expense with code or id, exactly one of the two. Use GetBillingNoteExpense to look it up. The billing note expense must be approved and still awaiting payment. PEAK refuses draft, voided and fully paid documents. PEAK accepts only one payment that settles the whole outstanding amount: paymentAmount plus any withHoldingTaxAmount must equal remainAmount on GetBillingNoteExpense. A partial payment is refused with "Should do full payment". paymentDate (yyyyMMdd) is required: ask the user when the money was paid if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. withHoldingTaxAmount is the withholding tax deducted, either an amount ("30") or a percentage ("3%"). When the billing note expense has withholding tax, PEAK requires withHoldingTaxAmount to equal the document's withholding tax exactly (resCode 347 "Payment Wht amount must equal to suggest wht" otherwise): read it from GetBillingNoteExpense first. FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the document number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or a "net amount ... payment" message means the amount is more than what is still outstanding. "Transaction must be Waiting Payment Status." means the billing note expense is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. remainPaymentAmount in this response is not reliable for billing notes (it can still show the full amount after a full payment), so confirm the balance with GetBillingNoteExpense. Report the document number and the amount paid. Keep paidPayments.journals[].code (e.g. PV-202610001): VoidBillingNoteExpensePayment needs it to cancel this payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the billing note expense that was paid (e.g. 'CPN-20261000001'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the billing note expense that was paid. Provide this or code, not both |
| paymentDate | string | optional | Required. The date the money was paid, format yyyyMMdd (e.g. '20261014') |
| paymentAmount | number? | optional | Required. The amount paid in this payment, excluding withholding tax |
| paymentMethodCode | string | optional | Code of the payment method the money was paid out through (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | The Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Withholding tax you deducted from the supplier, as an amount (e.g. '30') or a percentage (e.g. '3%'). Omit when none was withheld |
| note | string | optional | Optional note for this payment |
VoidBillingNoteExpensePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการจ่ายชำระ) a payment already recorded on a billing note expense (ใบวางบิลซื้อ), for example one entered by mistake. This does not void the billing note expense itself (use VoidBillingNoteExpense for that). BUSINESS RULES & PRE-CONDITIONS Identify the billing note expense with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. PV-202610001). RecordBillingNoteExpensePayment returns it, and GetBillingNoteExpense lists it under paidPayments[].journals[].code. When the billing note expense has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the billing note expense first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the billing note expense, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetBillingNoteExpense and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The billing note expense's outstanding amount goes up by that amount, and GetBillingNoteExpense no longer lists the payment.
0 required · 3 optional
VoidBillingNoteExpensePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการจ่ายชำระ) a payment already recorded on a billing note expense (ใบวางบิลซื้อ), for example one entered by mistake. This does not void the billing note expense itself (use VoidBillingNoteExpense for that). BUSINESS RULES & PRE-CONDITIONS Identify the billing note expense with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. PV-202610001). RecordBillingNoteExpensePayment returns it, and GetBillingNoteExpense lists it under paidPayments[].journals[].code. When the billing note expense has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the billing note expense first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the billing note expense, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetBillingNoteExpense and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The billing note expense's outstanding amount goes up by that amount, and GetBillingNoteExpense no longer lists the payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the billing note expense the payment belongs to (e.g. 'CPN-20261000001'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the billing note expense the payment belongs to. Provide this or code, not both |
| paymentJournalCode | string | optional | Required. Journal code of the payment to cancel (e.g. 'PV-202610001'), from RecordBillingNoteExpensePayment or GetBillingNoteExpense paidPayments[].journals[].code |
Response
{
"resCode": "200",
"resDesc": "Completed",
"transactionCode": "C001",
"paymentJournalCode": "C001",
"paymentDate": "2026-01-01",
"paymentTotal": 0
}
Classification
3 tools
GetClassificationGroup
WHEN TO USE Call BEFORE `CreateTransactionClassification`, always — classification groups and items are entirely business-defined, there is no universal default to assume. BUSINESS RULES & PRE-CONDITIONS None — no params required. FALLBACK & ERROR HANDLING Empty result → this business hasn't set up classifications; tell the user tagging isn't configured rather than inventing a group. EXPECTED OUTCOME Returns each group's `number`/`name` and nested `classificationItemList` (each with its own `number`/`name`) — both numbers are required inputs for CreateTransactionClassification.
no params
GetClassificationGroup
WHEN TO USE Call BEFORE `CreateTransactionClassification`, always — classification groups and items are entirely business-defined, there is no universal default to assume. BUSINESS RULES & PRE-CONDITIONS None — no params required. FALLBACK & ERROR HANDLING Empty result → this business hasn't set up classifications; tell the user tagging isn't configured rather than inventing a group. EXPECTED OUTCOME Returns each group's `number`/`name` and nested `classificationItemList` (each with its own `number`/`name`) — both numbers are required inputs for CreateTransactionClassification.
No parameters required.
Response
{
"peakClassification": {
"classificationGroup": [
{
"resCode": "string",
"resDesc": "string",
"number": "string",
"name": "string",
"description": "string",
"classificationDocumentFinanceType": 0,
"classificationItemList": [
{
"number": "string",
"name": "string",
"description": "string"
}
]
}
],
"resDesc": "string",
"resCode": "string"
}
}
GetTransactionClassification
WHEN TO USE To verify tagging before adding more, or when the user asks how a transaction is currently tagged. BUSINESS RULES & PRE-CONDITIONS Provide `transactionId` or `transactionCode` + `transactionType`. FALLBACK & ERROR HANDLING No tags found → transaction simply isn't tagged yet, not an error state. EXPECTED OUTCOME Returns the classification group/item(s) currently applied.
0 required · 3 optional
GetTransactionClassification
WHEN TO USE To verify tagging before adding more, or when the user asks how a transaction is currently tagged. BUSINESS RULES & PRE-CONDITIONS Provide `transactionId` or `transactionCode` + `transactionType`. FALLBACK & ERROR HANDLING No tags found → transaction simply isn't tagged yet, not an error state. EXPECTED OUTCOME Returns the classification group/item(s) currently applied.
| Parameter | Type | Description | |
|---|---|---|---|
| transactionId | string | optional | Unique Identifier of the transaction |
| transactionCode | string | optional | Document Number of the transaction |
| transactionType | integer? | optional | Type (101=Quotation,102=Invoice,103=Receipt,104=TaxInvoice,105=CreditNote,106=BillingNote,107=DebitNote,201=PurchaseOrder,202=Expense,205=CreditNoteExpense,206=BillingNoteExpense,207=DebitNoteExpense) |
Response
{
"peakClassification": {
"transactionCode": "string",
"transactionType": 0,
"classifications": [
{
"classificationGroupCode": "string",
"classificationItemList": [
{
"number": "string",
"percent": 0.0
}
]
}
],
"resDesc": "string",
"resCode": "string"
}
}
CreateTransactionClassification
WHEN TO USE After a transaction already exists (Invoice/Expense/etc. already created) and the user wants it tagged for reporting. BUSINESS RULES & PRE-CONDITIONS Requires: (1) the transaction's `transactionId`/`transactionCode` — from the just-created document; (2) valid `classificationGroupCode` + item `number`(s) — from GetClassificationGroup, never guessed. FALLBACK & ERROR HANDLING Invalid group/item number → re-fetch GetClassificationGroup, don't retry with a guessed number. EXPECTED OUTCOME Tags the transaction; does not alter its financial amounts.
3 required · 2 optional
CreateTransactionClassification
WHEN TO USE After a transaction already exists (Invoice/Expense/etc. already created) and the user wants it tagged for reporting. BUSINESS RULES & PRE-CONDITIONS Requires: (1) the transaction's `transactionId`/`transactionCode` — from the just-created document; (2) valid `classificationGroupCode` + item `number`(s) — from GetClassificationGroup, never guessed. FALLBACK & ERROR HANDLING Invalid group/item number → re-fetch GetClassificationGroup, don't retry with a guessed number. EXPECTED OUTCOME Tags the transaction; does not alter its financial amounts.
| Parameter | Type | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|
| transactionType | integer | required | Type (101=Quotation,102=Invoice,103=Receipt,104=TaxInvoice,105=CreditNote,106=BillingNote,107=DebitNote,201=PurchaseOrder,202=Expense,205=CreditNoteExpense,206=BillingNoteExpense,207=DebitNoteExpense) | ||||||
| classificationGroupCode | string | required | Code of the classification group | ||||||
| classificationItemList | array[TransactionClassificationItemEntry] | required | array[TransactionClassificationItemEntry] — sub-fields: number, percent?array[TransactionClassificationItemEntry] fields
|
||||||
| transactionId | string | optional | Unique Identifier of the transaction | ||||||
| transactionCode | string | optional | Document Number of the transaction |
Response
{
"resCode": "200",
"resDesc": "Success"
}
Contact
4 tools
SearchContacts
WHEN TO USE Call this FIRST, always, before CreateInvoice / CreateExpense / CreateQuotation / CreateReceipt / CreatePurchaseOrder / CreateCreditNote whenever a contact name, company name, or Tax ID appears in the input. Never assume a contact exists. BUSINESS RULES & PRE-CONDITIONS Search by `searchText` (name, company, or 13-digit Tax ID) — Tax ID match is the most reliable, name match can be ambiguous (similar company names are common in Thai SME data). If Tax ID is available in the source document, prefer it over name. FALLBACK & ERROR HANDLING Zero results → do NOT invent a contact silently; prepare a `CreateContact` payload and show it to the user in the confirmation preview before calling it. Multiple results → present the list (name + code + Tax ID) and ask the user to pick, don't guess by string similarity alone. EXPECTED OUTCOME Returns `contactId` + `contactCode`, which are required inputs for every downstream document-creation tool.
0 required · 5 optional
SearchContacts
WHEN TO USE Call this FIRST, always, before CreateInvoice / CreateExpense / CreateQuotation / CreateReceipt / CreatePurchaseOrder / CreateCreditNote whenever a contact name, company name, or Tax ID appears in the input. Never assume a contact exists. BUSINESS RULES & PRE-CONDITIONS Search by `searchText` (name, company, or 13-digit Tax ID) — Tax ID match is the most reliable, name match can be ambiguous (similar company names are common in Thai SME data). If Tax ID is available in the source document, prefer it over name. FALLBACK & ERROR HANDLING Zero results → do NOT invent a contact silently; prepare a `CreateContact` payload and show it to the user in the confirmation preview before calling it. Multiple results → present the list (name + code + Tax ID) and ask the user to pick, don't guess by string similarity alone. EXPECTED OUTCOME Returns `contactId` + `contactCode`, which are required inputs for every downstream document-creation tool.
| Parameter | Type | Description | |
|---|---|---|---|
| status | integer? | optional | Filter by contact status (0=All,1=Active,2=Inactive) Default = 1 |
| groupId | string | optional | Filter by Contact group name |
| searchText | string | optional | Search keyword — company name, contact name, or tax number. |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakContacts": {
"resCode": "200",
"resDesc": "PeakContacts have Completed",
"totalContact": 25,
"contacts": [{
"id": "guid",
"code": "C001",
"name": "Company Name",
"type": 1,
"taxNumber": "0123456789012",
"branchCode": "00000",
"email": "[email protected]",
"address": "123 Main St",
"subDistrict": "...",
"district": "...",
"province": "Bangkok",
"postCode": "10110",
"resCode": "200",
"resDesc": "Success"
}]
}
}
CreateContact
WHEN TO USE Only after `SearchContacts` returns zero matches for this name/Tax ID. Never call speculatively "just in case." BUSINESS RULES & PRE-CONDITIONS `name` is the only required field, but for Thai business documents, always try to populate `taxNumber` (13 digits) and `type` — VAT-registered invoices and WHT certificates need these downstream. If the contact is a vendor, consider setting `purchaseAccount`; if a customer, `sellAccount` — this lets PEAK auto-map future transactions. FALLBACK & ERROR HANDLING If Tax ID or address is missing from the source document, do not fabricate placeholder values — leave optional and flag to the user that the contact record is incomplete. EXPECTED OUTCOME Returns `contactId` + `contactCode` for immediate use in the document currently being created. Must always be shown to the user as a "🆕 New contact will be created" notice before this tool is called (never silent).
2 required · 28 optional
CreateContact
WHEN TO USE Only after `SearchContacts` returns zero matches for this name/Tax ID. Never call speculatively "just in case." BUSINESS RULES & PRE-CONDITIONS `name` is the only required field, but for Thai business documents, always try to populate `taxNumber` (13 digits) and `type` — VAT-registered invoices and WHT certificates need these downstream. If the contact is a vendor, consider setting `purchaseAccount`; if a customer, `sellAccount` — this lets PEAK auto-map future transactions. FALLBACK & ERROR HANDLING If Tax ID or address is missing from the source document, do not fabricate placeholder values — leave optional and flag to the user that the contact record is incomplete. EXPECTED OUTCOME Returns `contactId` + `contactCode` for immediate use in the document currently being created. Must always be shown to the user as a "🆕 New contact will be created" notice before this tool is called (never silent).
| Parameter | Type | Description | |
|---|---|---|---|
| name | string | required | Name without the legal form, which goes in type (e.g. 'PEAK' instead of 'PEAK Co., Ltd.'). For a person (type 5), the full name without the title (e.g. 'Somchai Jaidee'); the title goes in prefixNameType. Required, max 256 characters. |
| type | integer | required | Legal form of the contact: 0=None, 1=LimitedPartnership (ห้างหุ้นส่วนจำกัด), 2=CompanyLimited (บริษัทจำกัด), 3=PublicCompanyLimited (บริษัทมหาชนจำกัด), 4=Shop (ร้านค้า), 5=OrdinaryPerson (บุคคลธรรมดา), 6=BodyOfPersons (คณะบุคคล), 7=Others, 8=OrdinaryPartnership (ห้างหุ้นส่วนสามัญ), 9=Foundation (มูลนิธิ), 10=Association (สมาคม), 11=JointVenture (กิจการร่วมค้า). Required. |
| prefixNameType | integer? | optional | Title, used only when type is 5 (OrdinaryPerson): 0=None, 1=Khun (คุณ), 2=Mr. (นาย), 3=Mrs. (นาง), 4=Miss (นางสาว), 5=Other (then set prefixNameOther). Set it for a person; PEAK saves 0 when it is blank. |
| prefixNameOther | string | optional | Custom title text, only when prefixNameType=5 (e.g. 'Dr.'). Required in that case. |
| taxNumber | string | optional | Tax ID (เลขประจำตัวผู้เสียภาษี). For a Thai contact: 13 digits, digits only (e.g. '0105550123451'). |
| branchCode | string | optional | 5-digit branch number (สาขา): '00000' = head office (สำนักงานใหญ่), '00001' = branch 1. |
| address | string | optional | Street part of the address only: house number, building, moo, soi and road (e.g. '99/1 Moo 2, Soi Sukhumvit 21, Sukhumvit Rd.'). Do NOT include the sub-district, district, province or post code — they have their own fields. |
| subDistrict | string | optional | Sub-district (ตำบล, or แขวง in Bangkok) (e.g. 'Khlong Toei Nuea'). |
| district | string | optional | District (อำเภอ, or เขต in Bangkok) (e.g. 'Watthana'). |
| province | string | optional | Province (จังหวัด) (e.g. 'Bangkok'). |
| country | string | optional | Country (e.g. 'Thailand'). |
| postCode | string | optional | 5-digit post code (รหัสไปรษณีย์) (e.g. '10110'). |
| callCenterNumber | string | optional | Main phone number of the business (e.g. '021234567'). |
| faxNumber | string | optional | Fax number (e.g. '021234568'). |
| string | optional | Email of the business, used to send documents (e.g. '[email protected]'). | |
| website | string | optional | Website (e.g. 'https://www.example.co.th'). |
| contactFirstName | string | optional | First name of the person to contact at this business (e.g. 'Somying'). |
| contactLastName | string | optional | Last name of the person to contact (e.g. 'Rakngan'). |
| contactNickName | string | optional | Nickname of the person to contact (e.g. 'Ying'). |
| contactPosition | string | optional | Job title of the person to contact (e.g. 'Accounting Manager'). |
| contactPhoneNumber | string | optional | Phone number of the person to contact (e.g. '0812345678'). |
| contactEmail | string | optional | Email of the person to contact (e.g. '[email protected]'). |
| purchaseAccount | string | optional | Default account code for expense documents from this contact (e.g. '212101'). Resolve it with GetAccountCodes; never invent one. Leave blank to use PEAK's default. |
| sellAccount | string | optional | Default account code for revenue documents to this contact (e.g. '113101'). Resolve it with GetAccountCodes; never invent one. Leave blank to use PEAK's default. |
| bankId | integer? | optional | Bank, as PEAK's numeric bank code (e.g. 1). Don't guess it: ask the user, or leave every bank field blank. |
| bankBranch | string | optional | Bank branch name (e.g. 'Siam Paragon'). |
| bankAccountNo | string | optional | Bank account number, digits only (e.g. '1234567890'). |
| bankAccountName | string | optional | Name on the bank account (e.g. 'Example Co., Ltd.'). |
| id | string | optional | Unique Identifier generated by PEAK. Leave blank when creating. |
| code | string | optional | Contact code to save (e.g. 'C00001'). Leave blank to let PEAK generate the next code. |
Response
{
"PeakContacts": {
"resCode": "200",
"resDesc": "PeakContacts have Completed",
"contacts": [{
"id": "917c3e8f-b315-4968-b8cc-08e2220d8682",
"code": "C01401",
"name": "Company Name",
"type": 2,
"taxNumber": "0105557083391",
"branchCode": "00000",
"address": "...",
"subDistrict": "...",
"district": "...",
"province": "กรุงเทพมหานคร",
"country": "Thailand",
"postCode": "10220",
"email": "",
"purchaseAccount": "212101",
"sellAccount": "113101",
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetSuggestionAccountCodeExpense
WHEN TO USE Call before CreateExpense once the vendor is known, to narrow the chart of accounts (ผังบัญชี) down to the expense codes that actually fit this vendor instead of choosing from the whole chart. Use the returned code as the accountCode on the expense line item. Prefer this over GetAccountCodes whenever you already have the contact, and fall back to GetAccountCodes only when it returns nothing. BUSINESS RULES & PRE-CONDITIONS You MUST provide at least one of contactId, contactCode, or taxId — calling with none of them returns resCode 400. Resolve contactId or contactCode with SearchContacts first. contactId must be a valid GUID and taxId must be exactly 13 digits. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Two lists come back and they rank differently: 'mostUsed' is what this business has itself recorded for this contact before — the strongest signal, prefer it; 'suggestion' is what other businesses commonly use for this vendor's tax number, and is only returned when the contact has a tax number. Both may be empty for a new vendor: fall back to GetAccountCodes rather than guessing a code. An empty or missing response body means PEAK could not be reached, not that there are no suggestions — never report it to the user as 'no match'. EXPECTED OUTCOME Returns mostUsed and suggestion, each a list of account codes carrying code, name, and nameEn, alongside resCode and resDesc.
0 required · 3 optional
GetSuggestionAccountCodeExpense
WHEN TO USE Call before CreateExpense once the vendor is known, to narrow the chart of accounts (ผังบัญชี) down to the expense codes that actually fit this vendor instead of choosing from the whole chart. Use the returned code as the accountCode on the expense line item. Prefer this over GetAccountCodes whenever you already have the contact, and fall back to GetAccountCodes only when it returns nothing. BUSINESS RULES & PRE-CONDITIONS You MUST provide at least one of contactId, contactCode, or taxId — calling with none of them returns resCode 400. Resolve contactId or contactCode with SearchContacts first. contactId must be a valid GUID and taxId must be exactly 13 digits. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Two lists come back and they rank differently: 'mostUsed' is what this business has itself recorded for this contact before — the strongest signal, prefer it; 'suggestion' is what other businesses commonly use for this vendor's tax number, and is only returned when the contact has a tax number. Both may be empty for a new vendor: fall back to GetAccountCodes rather than guessing a code. An empty or missing response body means PEAK could not be reached, not that there are no suggestions — never report it to the user as 'no match'. EXPECTED OUTCOME Returns mostUsed and suggestion, each a list of account codes carrying code, name, and nameEn, alongside resCode and resDesc.
| Parameter | Type | Description | |
|---|---|---|---|
| contactId | string | optional | Contact ID (GUID) of the vendor/supplier. Get it from SearchContacts. Must be a valid GUID. |
| contactCode | string | optional | Contact code of the vendor/supplier (e.g. 'C001'). Get it from SearchContacts. |
| taxId | string | optional | Tax Identification Number (TIN) of the vendor/supplier. Must be exactly 13 digits. |
Response
{
"PeakContacts": {
"mostUsed": [
{
"code": "C001",
"name": "Sample Name",
"nameEn": "Sample Name"
}
],
"suggestion": [
{
"code": "C001",
"name": "Sample Name",
"nameEn": "Sample Name"
}
],
"resCode": "200",
"resDesc": "Completed"
}
}
EditContact
WHEN TO USE Use to change an existing contact (ผู้ติดต่อ) in PEAK — its name, address, tax ID, branch, phone, email, contact person, default accounts or bank account — when the user says the customer's or vendor's details have changed. To register a new contact use CreateContact instead. BUSINESS RULES & PRE-CONDITIONS Identify the contact by code (recommended) or id; resolve it with SearchContacts first and never guess a code. Send only the fields that change — every field left blank keeps its current value in PEAK. Save names and addresses exactly as the user wrote them, in the user's language; do not translate. A field cannot be cleared with this tool: an empty value also keeps the current one. The contact code itself cannot be changed. taxNumber for a Thai contact must be 13 digits with a valid check digit (spaces and dashes are ignored); a contact whose country is not Thailand is not checked. Changing type to 5 (OrdinaryPerson) needs prefixNameType. This writes master data that every document reuses — always show the user the current and new values and get explicit confirmation before calling, even when the request looks explicit; skip this only when the user has said no confirmation is needed. FALLBACK & ERROR HANDLING If the contact is not found or the tax ID is invalid, nothing is changed: confirm the details with the user. Never compute or suggest a corrected tax ID — ask the user for the right number. Never invent an account code — resolve it with GetAccountCodes. If PEAK rejects the edit, report its message verbatim; the contact was NOT changed. EXPECTED OUTCOME Returns the saved contact as PEAK stored it, with every field, so a separate read-back is not needed.
0 required · 30 optional
EditContact
WHEN TO USE Use to change an existing contact (ผู้ติดต่อ) in PEAK — its name, address, tax ID, branch, phone, email, contact person, default accounts or bank account — when the user says the customer's or vendor's details have changed. To register a new contact use CreateContact instead. BUSINESS RULES & PRE-CONDITIONS Identify the contact by code (recommended) or id; resolve it with SearchContacts first and never guess a code. Send only the fields that change — every field left blank keeps its current value in PEAK. Save names and addresses exactly as the user wrote them, in the user's language; do not translate. A field cannot be cleared with this tool: an empty value also keeps the current one. The contact code itself cannot be changed. taxNumber for a Thai contact must be 13 digits with a valid check digit (spaces and dashes are ignored); a contact whose country is not Thailand is not checked. Changing type to 5 (OrdinaryPerson) needs prefixNameType. This writes master data that every document reuses — always show the user the current and new values and get explicit confirmation before calling, even when the request looks explicit; skip this only when the user has said no confirmation is needed. FALLBACK & ERROR HANDLING If the contact is not found or the tax ID is invalid, nothing is changed: confirm the details with the user. Never compute or suggest a corrected tax ID — ask the user for the right number. Never invent an account code — resolve it with GetAccountCodes. If PEAK rejects the edit, report its message verbatim; the contact was NOT changed. EXPECTED OUTCOME Returns the saved contact as PEAK stored it, with every field, so a separate read-back is not needed.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Code of the contact to edit (e.g. 'C00001'). Recommended. Supply this or id. Get it from SearchContacts. |
| id | string | optional | Unique Identifier (GUID) of the contact to edit (e.g. 'a2aa06da-07c3-40f9-8fbe-841ec6a4146a'). Use only when the code is unknown. |
| name | string | optional | New name without the legal form, which goes in type (e.g. 'PEAK' instead of 'PEAK Co., Ltd.'). For a person (type 5), the full name without the title (e.g. 'Somchai Jaidee'); the title goes in prefixNameType. Leave blank to keep the current name. |
| type | integer? | optional | New legal form of the contact: 0=None, 1=LimitedPartnership (ห้างหุ้นส่วนจำกัด), 2=CompanyLimited (บริษัทจำกัด), 3=PublicCompanyLimited (บริษัทมหาชนจำกัด), 4=Shop (ร้านค้า), 5=OrdinaryPerson (บุคคลธรรมดา), 6=BodyOfPersons (คณะบุคคล), 7=Others, 8=OrdinaryPartnership (ห้างหุ้นส่วนสามัญ), 9=Foundation (มูลนิธิ), 10=Association (สมาคม), 11=JointVenture (กิจการร่วมค้า). Leave blank to keep the current type. |
| prefixNameType | integer? | optional | New title, used only when the contact is type 5 (OrdinaryPerson): 0=None, 1=Khun (คุณ), 2=Mr. (นาย), 3=Mrs. (นาง), 4=Miss (นางสาว), 5=Other (then set prefixNameOther). SearchContacts does not return the current title, so leave this blank unless the user asks to change the title. Leave blank to keep the current title. |
| prefixNameOther | string | optional | Custom title text, only when prefixNameType=5 (e.g. 'Dr.'). Leave blank to keep the current one. |
| taxNumber | string | optional | New tax ID (เลขประจำตัวผู้เสียภาษี). For a Thai contact: 13 digits with a valid check digit (e.g. '0105550123451'); spaces and dashes are ignored. Leave blank to keep the current one. |
| branchCode | string | optional | New 5-digit branch number (สาขา): '00000' = head office (สำนักงานใหญ่), '00001' = branch 1. Leave blank to keep the current one. |
| address | string | optional | New street part of the address only: house number, building, moo, soi and road (e.g. '99/1 Moo 2, Soi Sukhumvit 21, Sukhumvit Rd.'). Do NOT include the sub-district, district, province or post code — they have their own fields. Leave blank to keep the current one. |
| subDistrict | string | optional | New sub-district (ตำบล, or แขวง in Bangkok) (e.g. 'Khlong Toei Nuea'). Leave blank to keep the current one. |
| district | string | optional | New district (อำเภอ, or เขต in Bangkok) (e.g. 'Watthana'). Leave blank to keep the current one. |
| province | string | optional | New province (จังหวัด) (e.g. 'Bangkok'). Leave blank to keep the current one. |
| country | string | optional | New country (e.g. 'Thailand'). A contact whose country is not Thailand skips the Thai tax ID check. Leave blank to keep the current one. |
| postCode | string | optional | New 5-digit post code (รหัสไปรษณีย์) (e.g. '10110'). Leave blank to keep the current one. |
| callCenterNumber | string | optional | New main phone number of the business (e.g. '021234567'). Leave blank to keep the current one. |
| faxNumber | string | optional | New fax number (e.g. '021234568'). Leave blank to keep the current one. |
| string | optional | New email of the business, used to send documents (e.g. '[email protected]'). Leave blank to keep the current one. | |
| website | string | optional | New website (e.g. 'https://www.example.co.th'). Leave blank to keep the current one. |
| contactFirstName | string | optional | New first name of the person to contact at this business (e.g. 'Somying'). Leave blank to keep the current one. |
| contactLastName | string | optional | New last name of the person to contact (e.g. 'Rakngan'). Leave blank to keep the current one. |
| contactNickName | string | optional | New nickname of the person to contact (e.g. 'Ying'). Leave blank to keep the current one. |
| contactPosition | string | optional | New job title of the person to contact (e.g. 'Accounting Manager'). Leave blank to keep the current one. |
| contactPhoneNumber | string | optional | New phone number of the person to contact (e.g. '0812345678'). Leave blank to keep the current one. |
| contactEmail | string | optional | New email of the person to contact (e.g. '[email protected]'). Leave blank to keep the current one. |
| purchaseAccount | string | optional | New default account code for expense documents from this contact (e.g. '212101'). Resolve it with GetAccountCodes; never invent one. Leave blank to keep the current account. |
| sellAccount | string | optional | New default account code for revenue documents to this contact (e.g. '113101'). Resolve it with GetAccountCodes; never invent one. Leave blank to keep the current account. |
| bankId | integer? | optional | New bank, as PEAK's numeric bank code (e.g. 1). Don't guess it: ask the user, or leave it blank to keep the current bank. Bank fields left blank keep their current values. |
| bankBranch | string | optional | New bank branch name (e.g. 'Siam Paragon'). Leave blank to keep the current one. |
| bankAccountNo | string | optional | New bank account number, digits only (e.g. '1234567890'). Leave blank to keep the current one. |
| bankAccountName | string | optional | New name on the bank account (e.g. 'Example Co., Ltd.'). Leave blank to keep the current one. |
CreditNote
10 tools
CreateCreditNote
WHEN TO USE Use when goods are returned, the original price was wrong, or a discount is granted after an invoice already exists — never as a substitute for editing a Draft invoice directly (edit the Draft instead if it hasn't been Approved yet). If there is no original invoice or receipt in PEAK to reference, use CreateCreditNoteWithoutReference instead — never invent a transaction ID. BUSINESS RULES & PRE-CONDITIONS Requires `transactionId`/`transactionCode` of the original document being corrected — fetch via GetInvoice or GetReceipt first if not already known. `reasonType` should reflect the real cause (goods return, pricing error, damage, etc.) since it appears on the printed document. Line items mirror the original invoice's productCode/accountCode choice. FALLBACK & ERROR HANDLING Original transaction not found → confirm the invoice code with the user before proceeding; don't create a credit note against a guessed transaction ID. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
6 required · 40 optional
CreateCreditNote
WHEN TO USE Use when goods are returned, the original price was wrong, or a discount is granted after an invoice already exists — never as a substitute for editing a Draft invoice directly (edit the Draft instead if it hasn't been Approved yet). If there is no original invoice or receipt in PEAK to reference, use CreateCreditNoteWithoutReference instead — never invent a transaction ID. BUSINESS RULES & PRE-CONDITIONS Requires `transactionId`/`transactionCode` of the original document being corrected — fetch via GetInvoice or GetReceipt first if not already known. `reasonType` should reflect the real cause (goods return, pricing error, damage, etc.) since it appears on the printed document. Line items mirror the original invoice's productCode/accountCode choice. FALLBACK & ERROR HANDLING Original transaction not found → confirm the invoice code with the user before proceeding; don't create a credit note against a guessed transaction ID. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| transactionType | integer | required | Type (101=Quotation,102=Invoice,103=Receipt,104=TaxInvoice,105=CreditNote,106=BillingNote,107=DebitNote,201=PurchaseOrder,202=Expense,205=CreditNoteExpense,206=BillingNoteExpense,207=DebitNoteExpense) | ||||||||||||||||||||||||||||
| reasonType | integer | required | Reason (0=None,1=PromotionAndMarketing,2=OfficeUse,3=ProductionUse,4=ServiceUse,5=Donation,6=DamageOrLoss,7=Others) | ||||||||||||||||||||||||||||
| reasonDescription | string | required | Description of reason | ||||||||||||||||||||||||||||
| goodsReturn | integer | required | Involves product return (0=No,1=Yes) | ||||||||||||||||||||||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| transactionId | string | optional | Unique Identifier of the transaction | ||||||||||||||||||||||||||||
| transactionCode | string | optional | Document Number of the transaction | ||||||||||||||||||||||||||||
| creditNoteStyleType | integer? | optional | Display type (0=General) | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| returnPaymentMethodCode | string | optional | Payment method code for return payment | ||||||||||||||||||||||||||||
| returnPaymentMethodId | string | optional | Unique Identifier of return payment method | ||||||||||||||||||||||||||||
| returnPaymentAmount | number? | optional | Return payment amount | ||||||||||||||||||||||||||||
| returnPaymentDate | string | optional | Return payment date (yyyyMMdd) | ||||||||||||||||||||||||||||
| returnPaymentAccountCode | string | optional | Account code for return payment | ||||||||||||||||||||||||||||
| returnPaymentAccountSubId | string | optional | Sub-account ID for return payment | ||||||||||||||||||||||||||||
| returnPaymentAccountSubCode | string | optional | Sub-account code for return payment | ||||||||||||||||||||||||||||
| returnPaymentNote | string | optional | Notes for the return payment | ||||||||||||||||||||||||||||
| returnPaymentIsCheque | integer? | optional | Return payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| returnPaymentWithHoldingTaxAmount | string | optional | WHT amount for return payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakCreditNotes": {
"resCode": "200",
"resDesc": "PeakCreditNotes have Completed",
"totalCreditNote": 1,
"creditNotes": [{
"id": "5c707ff3-bea4-4475-8595-8d91a592403a",
"code": "CNT0800124",
"issuedDate": "20230815",
"dueDate": "20230815",
"contactId": "guid",
"contactCode": "C00002",
"status": "Approve",
"isTaxInvoice": 0,
"preTaxAmount": 5140,
"vatAmount": 0,
"netAmount": 5140,
"whtAmount": 154.2,
"paymentAmount": 0,
"remainAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "PP20180917", "accountCode": "410101", "description": "...", "quantity": 21, "price": 220, "vatType": 2 }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
CreateCreditNoteExpense
WHEN TO USE Use when goods are returned, the original price was wrong, or a discount is granted after an Expense already exists — never as a substitute for editing a Draft expense directly (edit the Draft instead if it hasn't been Approved yet). If there is no original expense in PEAK to reference, use CreateCreditNoteExpenseWithoutReference instead — never invent a transaction ID. BUSINESS RULES & PRE-CONDITIONS Requires `transactionId`/`transactionCode` of the original document being corrected — fetch via GetExpense first if not already known. `reasonType` should reflect the real cause (goods return, pricing error, damage, etc.) since it appears on the printed document. Line items mirror the original invoice's productCode/accountCode choice. FALLBACK & ERROR HANDLING Original transaction not found → confirm the invoice code with the user before proceeding; don't create a credit note against a guessed transaction ID. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
6 required · 40 optional
CreateCreditNoteExpense
WHEN TO USE Use when goods are returned, the original price was wrong, or a discount is granted after an Expense already exists — never as a substitute for editing a Draft expense directly (edit the Draft instead if it hasn't been Approved yet). If there is no original expense in PEAK to reference, use CreateCreditNoteExpenseWithoutReference instead — never invent a transaction ID. BUSINESS RULES & PRE-CONDITIONS Requires `transactionId`/`transactionCode` of the original document being corrected — fetch via GetExpense first if not already known. `reasonType` should reflect the real cause (goods return, pricing error, damage, etc.) since it appears on the printed document. Line items mirror the original invoice's productCode/accountCode choice. FALLBACK & ERROR HANDLING Original transaction not found → confirm the invoice code with the user before proceeding; don't create a credit note against a guessed transaction ID. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| transactionType | integer | required | Type (101=Quotation,102=Invoice,103=Receipt,104=TaxInvoice,105=CreditNote,106=BillingNote,107=DebitNote,201=PurchaseOrder,202=Expense,205=CreditNoteExpense,206=BillingNoteExpense,207=DebitNoteExpense) | ||||||||||||||||||||||||||||
| reasonType | integer | required | Reason (0=None,1=PromotionAndMarketing,2=OfficeUse,3=ProductionUse,4=ServiceUse,5=Donation,6=DamageOrLoss,7=Others) | ||||||||||||||||||||||||||||
| reasonDescription | string | required | Description of reason | ||||||||||||||||||||||||||||
| goodsReturn | integer | required | Involves product return (0=No,1=Yes) | ||||||||||||||||||||||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| transactionId | string | optional | Unique Identifier of the transaction | ||||||||||||||||||||||||||||
| transactionCode | string | optional | Document Number of the transaction | ||||||||||||||||||||||||||||
| creditNoteStyleType | integer? | optional | Display type (0=General) | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| returnPaymentMethodCode | string | optional | Payment method code for return payment | ||||||||||||||||||||||||||||
| returnPaymentMethodId | string | optional | Unique Identifier of return payment method | ||||||||||||||||||||||||||||
| returnPaymentAmount | number? | optional | Return payment amount | ||||||||||||||||||||||||||||
| returnPaymentDate | string | optional | Return payment date (yyyyMMdd) | ||||||||||||||||||||||||||||
| returnPaymentAccountCode | string | optional | Account code for return payment | ||||||||||||||||||||||||||||
| returnPaymentAccountSubId | string | optional | Sub-account ID for return payment | ||||||||||||||||||||||||||||
| returnPaymentAccountSubCode | string | optional | Sub-account code for return payment | ||||||||||||||||||||||||||||
| returnPaymentNote | string | optional | Notes for the return payment | ||||||||||||||||||||||||||||
| returnPaymentIsCheque | integer? | optional | Return payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| returnPaymentWithHoldingTaxAmount | string | optional | WHT amount for return payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakCreditNotesExpenses": {
"resCode": "200",
"resDesc": "PeakCreditNotesExpenses have Completed",
"totalCreditNoteExpense": 1,
"creditNotesExpenses": [{
"id": "5c707ff3-bea4-4475-8595-8d91a592403a",
"code": "CNX0800124",
"issuedDate": "20230815",
"dueDate": "20230815",
"contactId": "guid",
"contactCode": "C00002",
"status": "Approve",
"isTaxInvoice": 0,
"preTaxAmount": 5140,
"vatAmount": 0,
"netAmount": 5140,
"whtAmount": 154.2,
"paymentAmount": 0,
"remainAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "PP20180917", "accountCode": "410101", "description": "...", "quantity": 21, "price": 220, "vatType": 2 }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetCreditNoteExpense
WHEN TO USE Use to read ONE purchase-side credit note (ใบลดหนี้ซื้อ, CNX) you already have an identifier for — to confirm a reduction, check status, or read its details before voiding. For sales-side credit notes, use GetCreditNote instead. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListCreditNoteExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "CNX202601005"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching credit note expense with code, issuedDate, contactId / contactCode, netAmount, remainAmount and documentLink.
0 required · 6 optional
GetCreditNoteExpense
WHEN TO USE Use to read ONE purchase-side credit note (ใบลดหนี้ซื้อ, CNX) you already have an identifier for — to confirm a reduction, check status, or read its details before voiding. For sales-side credit notes, use GetCreditNote instead. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListCreditNoteExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "CNX202601005"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching credit note expense with code, issuedDate, contactId / contactCode, netAmount, remainAmount and documentLink.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'CNX202601005'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakCreditNotesExpenses": {
"creditNotesExpenses": [
{
"id": "guid",
"code": "CNX0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalCreditNoteExpense": 1,
"resDesc": "PeakCreditNotesExpenses have Completed",
"resCode": "200"
}
}
ListCreditNoteExpense
WHEN TO USE Use to review purchase-side credit notes (ใบลดหนี้ซื้อ, CNX) a vendor has issued to this business — to confirm a reduction was recorded, check status, or find a document code. For sales-side credit notes issued to customers, use ListCreditNote instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (format yyyyMMdd), status, and searchText (contact name or document code). Use limit and page to paginate — each page returns 10 entries. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. On several near-matches, show the list and let the user pick. EXPECTED OUTCOME Returns credit note expenses with code, issuedDate, contactId / contactCode, netAmount, and documentLink for sharing with the user.
0 required · 6 optional
ListCreditNoteExpense
WHEN TO USE Use to review purchase-side credit notes (ใบลดหนี้ซื้อ, CNX) a vendor has issued to this business — to confirm a reduction was recorded, check status, or find a document code. For sales-side credit notes issued to customers, use ListCreditNote instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (format yyyyMMdd), status, and searchText (contact name or document code). Use limit and page to paginate — each page returns 10 entries. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. On several near-matches, show the list and let the user pick. EXPECTED OUTCOME Returns credit note expenses with code, issuedDate, contactId / contactCode, netAmount, and documentLink for sharing with the user.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Start date for filtering credit note expenses (format yyyyMMdd). |
| dateEnd | string | optional | End date for filtering credit note expenses (format yyyyMMdd). |
| status | integer? | optional | Filter by document status (0 = None, 1 = Voided, 2 = Draft, 3 = AwaitApproval, 4 = Outstanding, 5 = Overdue, 6 = PaidOrAwaitReceipt) |
| searchText | string | optional | Text to search for in credit note expenses. |
| limit | integer? | optional | Maximum number of entries to retrieve. |
| page | integer? | optional | Page number for displaying data, where each page will show 10 entries. |
Response
{
"PeakCreditNotesExpenses": {
"creditNotesExpenses": [
{
"id": "guid",
"code": "CNX0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalCreditNoteExpense": 1,
"resDesc": "PeakCreditNotesExpenses have Completed",
"resCode": "200"
}
}
GetCreditNote
WHEN TO USE Use to read ONE sales credit note (ใบลดหนี้) you already have an identifier for — to check status or remaining balance before recording another or before voiding. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListCreditNote instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "CN202604001"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching credit note with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetCreditNote
WHEN TO USE Use to read ONE sales credit note (ใบลดหนี้) you already have an identifier for — to check status or remaining balance before recording another or before voiding. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListCreditNote instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "CN202604001"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching credit note with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'CNT0600027'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakCreditNotes": {
"creditNotes": [
{
"id": "guid",
"code": "CNT0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalCreditNote": 1,
"resDesc": "PeakCreditNotes have Completed",
"resCode": "200"
}
}
ListCreditNote
WHEN TO USE Use to check status or remaining balance on credit note already created — e.g. before recording an additional credit note , or before voiding. BUSINESS RULES & PRE-CONDITIONS Filter by date range, status or Search keyword - contact name, document number Default: 1st of last month – End of current month FALLBACK & ERROR HANDLING No match → confirm the filter or date range with the user rather than assuming a typo and guessing a correction. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListCreditNote
WHEN TO USE Use to check status or remaining balance on credit note already created — e.g. before recording an additional credit note , or before voiding. BUSINESS RULES & PRE-CONDITIONS Filter by date range, status or Search keyword - contact name, document number Default: 1st of last month – End of current month FALLBACK & ERROR HANDLING No match → confirm the filter or date range with the user rather than assuming a typo and guessing a correction. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Displays documents starting from the specified date (Format: yyyyMMdd). |
| dateEnd | string | optional | Displays documents ending on the specified date (Format: yyyyMMdd). |
| status | integer? | optional | Doc status (0=None,1=Voided,2=Draft,3=AwaitApproval,4=Outstanding,5=Overdue,6=PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakCreditNotes": {
"creditNotes": [
{
"id": "guid",
"code": "CNT0600027",
"issuedDate": "20230612",
"contactId": "079fa9e4-de10-4020-b290-eae29cdbc1ca",
"contactCode": "C00002",
"netAmount": 10,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalCreditNote": 1,
"resDesc": "PeakCreditNotes have Completed",
"resCode": "200"
}
}
VoidCreditNote
WHEN TO USE Only when the user explicitly asks to cancel an existing sales credit note (ใบลดหนี้). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Credit notes cannot be edited — to correct one, void it and issue a replacement with CreateCreditNote. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetCreditNote to look it up. The sales credit note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this credit note while another document still references it — void the referencing document first. If the sales credit note has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the sales credit note was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 3 optional
VoidCreditNote
WHEN TO USE Only when the user explicitly asks to cancel an existing sales credit note (ใบลดหนี้). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Credit notes cannot be edited — to correct one, void it and issue a replacement with CreateCreditNote. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetCreditNote to look it up. The sales credit note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this credit note while another document still references it — void the referencing document first. If the sales credit note has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the sales credit note was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the sales credit note to be voided |
| id | string | optional | The Unique Identifier of the sales credit note to be voided |
| isVoidETaxInvoice | integer | optional | Set to 1 ONLY to void a document that has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt. Default 0 refuses the void in that case, which is the safe behaviour. Voiding an already-filed e-Tax document is a compliance action and cannot be undone (0 = refuse if already sent as e-Tax, 1 = void anyway) |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidCreditNoteExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing purchase credit note (ใบลดหนี้ค่าใช้จ่าย). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Purchase credit notes cannot be edited — to correct one, void it and issue a replacement with CreateCreditNoteExpense. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetCreditNoteExpense to look it up. The purchase credit note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this credit note while another document still references it — void the referencing document first. If the purchase credit note has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the purchase credit note was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 3 optional
VoidCreditNoteExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing purchase credit note (ใบลดหนี้ค่าใช้จ่าย). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. Purchase credit notes cannot be edited — to correct one, void it and issue a replacement with CreateCreditNoteExpense. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetCreditNoteExpense to look it up. The purchase credit note is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void this credit note while another document still references it — void the referencing document first. If the purchase credit note has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the purchase credit note was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the purchase credit note to be voided |
| id | string | optional | The Unique Identifier of the purchase credit note to be voided |
| isVoidETaxInvoice | integer | optional | Set to 1 ONLY to void a document that has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt. Default 0 refuses the void in that case, which is the safe behaviour. Voiding an already-filed e-Tax document is a compliance action and cannot be undone (0 = refuse if already sent as e-Tax, 1 = void anyway) |
Response
{ "resCode": "200", "resDesc": "Success" }
CreateCreditNoteWithoutReference
WHEN TO USE Use to issue a sales credit note (ใบลดหนี้) to a customer when there is NO original invoice or receipt in PEAK to reference — e.g. a price adjustment after the sale, or the original document is outside PEAK. If the original document exists in PEAK, use CreateCreditNote instead so the credit note is linked to it. For purchase-side credit notes from a vendor, use CreateCreditNoteExpenseWithoutReference. BUSINESS RULES & PRE-CONDITIONS Identify the customer with exactly one of contactCode or contactId — resolve a name with SearchContacts first and never guess a code. A reason is required: reasonType 1–10 (not 0) and a non-blank reasonDescription, since both print on the document. Every priced line needs quantity > 0 and price > 0. taxStatus sets how VAT applies (0 = price excludes VAT, 1 = price includes VAT, 2 = no VAT) and each line's vatType sets its rate. Foreign currency and line sub-accounts are not supported by this tool. `status` is 'Draft' or 'Approve' (default 'Draft'). Send the returnPayment* fields only when the refund has actually been paid out to the customer — resolve the method with GetPaymentMethod; leave them blank otherwise. FALLBACK & ERROR HANDLING A missing reason or amount, or a refund method without an amount, is refused before anything is sent — ask the user for it rather than inventing one. An unknown contactCode, productCode or accountCode is a fixable argument error: confirm the right value with the user and retry. Any resCode other than 200 means NO credit note was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the credit note in Draft or Approve status and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
4 required · 26 optional
CreateCreditNoteWithoutReference
WHEN TO USE Use to issue a sales credit note (ใบลดหนี้) to a customer when there is NO original invoice or receipt in PEAK to reference — e.g. a price adjustment after the sale, or the original document is outside PEAK. If the original document exists in PEAK, use CreateCreditNote instead so the credit note is linked to it. For purchase-side credit notes from a vendor, use CreateCreditNoteExpenseWithoutReference. BUSINESS RULES & PRE-CONDITIONS Identify the customer with exactly one of contactCode or contactId — resolve a name with SearchContacts first and never guess a code. A reason is required: reasonType 1–10 (not 0) and a non-blank reasonDescription, since both print on the document. Every priced line needs quantity > 0 and price > 0. taxStatus sets how VAT applies (0 = price excludes VAT, 1 = price includes VAT, 2 = no VAT) and each line's vatType sets its rate. Foreign currency and line sub-accounts are not supported by this tool. `status` is 'Draft' or 'Approve' (default 'Draft'). Send the returnPayment* fields only when the refund has actually been paid out to the customer — resolve the method with GetPaymentMethod; leave them blank otherwise. FALLBACK & ERROR HANDLING A missing reason or amount, or a refund method without an amount, is refused before anything is sent — ask the user for it rather than inventing one. An unknown contactCode, productCode or accountCode is a fixable argument error: confirm the right value with the user and retry. Any resCode other than 200 means NO credit note was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the credit note in Draft or Approve status and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Line items, at least one. array[InvoiceProduct] — sub-fields: productId or productCode (not both), or accountCode for a non-stock line; description; quantity (> 0); price (> 0, the amount credited per unit); discount (amount like "100" or percent like "10%"); vatType (1 = No VAT, 2 = 0%, 3 = 7%, default 3); isDescription (1 = text-only row, no price/quantity). accountSubId / accountSubCode are NOT supported here.array[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| reasonType | integer | required | Reason code printed on the document (1=Price reduction of goods, 2=Price reduction of services, 3=Return of goods / goods not as ordered, 4=Fine or compensation, 5=Refund of advance payment, 6=Return or exchange of goods — VAT-registered buyer, 7=Return or exchange of goods — non-VAT buyer, 8=Cancellation of a service agreement, 9=Cancellation of a service already provided, 10=Other). 0 (Not Specified) is refused. | ||||||||||||||||||||||||||||
| reasonDescription | string | required | Why the credit note is issued, in the user's words. Required; printed on the document. | ||||||||||||||||||||||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the customer (send this or contactCode, not both) | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the customer (send this or contactId, not both). SearchContacts if not known | ||||||||||||||||||||||||||||
| goodsReturn | integer? | optional | Involves product return — stock comes back (0=No,1=Yes). Default 0 | ||||||||||||||||||||||||||||
| creditNoteStyleType | integer? | optional | Display type (0=General, 1=Thai standard format, required for e-Tax Invoice) | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as the customer's PO number | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes. Leave blank to use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=Price excludes VAT,1=Price includes VAT,2=No VAT) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount, amount or percent. Must not exceed the document total. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| returnPaymentMethodCode | string | optional | Refund paid back to the customer (จ่ายคืน). Code of the payment method (e.g. 'CSH001'); send this or returnPaymentMethodId. GetPaymentMethod if not known. Leave both blank when nothing has been paid yet. | ||||||||||||||||||||||||||||
| returnPaymentMethodId | string | optional | Unique Identifier of the payment method for the refund | ||||||||||||||||||||||||||||
| returnPaymentAmount | number? | optional | Refund amount (> 0). Required when a payment method is sent. | ||||||||||||||||||||||||||||
| returnPaymentDate | string | optional | Refund date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| returnPaymentAccountCode | string | optional | Account code for the refund | ||||||||||||||||||||||||||||
| returnPaymentAccountSubId | string | optional | Sub-account ID for the refund | ||||||||||||||||||||||||||||
| returnPaymentAccountSubCode | string | optional | Sub-account code for the refund | ||||||||||||||||||||||||||||
| returnPaymentNote | string | optional | Notes for the refund | ||||||||||||||||||||||||||||
| returnPaymentWithHoldingTaxAmount | string | optional | WithHoldingTax on the refund, amount like "30" or percent like "3%" | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
CreateCreditNoteExpenseWithoutReference
WHEN TO USE Use to record a purchase-side credit note (ใบลดหนี้ซื้อ, CNX) a vendor issued to this business when there is NO original expense in PEAK to reference — e.g. the vendor lowered a price after the purchase, or the original bill is outside PEAK. If the original expense exists in PEAK, use CreateCreditNoteExpense instead so the credit note is linked to it. For sales-side credit notes to a customer, use CreateCreditNoteWithoutReference. BUSINESS RULES & PRE-CONDITIONS Identify the vendor with exactly one of contactCode or contactId — resolve a name with SearchContacts first and never guess a code. A reason is required: reasonType 1–10 (not 0) and a non-blank reasonDescription, since both print on the document. Every priced line needs quantity > 0 and price > 0. taxStatus sets how VAT applies (0 = price excludes VAT, 1 = price includes VAT, 2 = no VAT) and each line's vatType sets its rate. Foreign currency and line sub-accounts are not supported by this tool. `status` is 'Draft' or 'Approve' (default 'Draft'). Send the returnPayment* fields only when the vendor has actually refunded the money — resolve the method with GetPaymentMethod; leave them blank otherwise. FALLBACK & ERROR HANDLING A missing reason or amount, or a refund method without an amount, is refused before anything is sent — ask the user for it rather than inventing one. An unknown contactCode, productCode or accountCode is a fixable argument error: confirm the right value with the user and retry. Any resCode other than 200 means NO credit note was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the purchase credit note in Draft or Approve status and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
4 required · 26 optional
CreateCreditNoteExpenseWithoutReference
WHEN TO USE Use to record a purchase-side credit note (ใบลดหนี้ซื้อ, CNX) a vendor issued to this business when there is NO original expense in PEAK to reference — e.g. the vendor lowered a price after the purchase, or the original bill is outside PEAK. If the original expense exists in PEAK, use CreateCreditNoteExpense instead so the credit note is linked to it. For sales-side credit notes to a customer, use CreateCreditNoteWithoutReference. BUSINESS RULES & PRE-CONDITIONS Identify the vendor with exactly one of contactCode or contactId — resolve a name with SearchContacts first and never guess a code. A reason is required: reasonType 1–10 (not 0) and a non-blank reasonDescription, since both print on the document. Every priced line needs quantity > 0 and price > 0. taxStatus sets how VAT applies (0 = price excludes VAT, 1 = price includes VAT, 2 = no VAT) and each line's vatType sets its rate. Foreign currency and line sub-accounts are not supported by this tool. `status` is 'Draft' or 'Approve' (default 'Draft'). Send the returnPayment* fields only when the vendor has actually refunded the money — resolve the method with GetPaymentMethod; leave them blank otherwise. FALLBACK & ERROR HANDLING A missing reason or amount, or a refund method without an amount, is refused before anything is sent — ask the user for it rather than inventing one. An unknown contactCode, productCode or accountCode is a fixable argument error: confirm the right value with the user and retry. Any resCode other than 200 means NO credit note was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the purchase credit note in Draft or Approve status and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Line items, at least one. array[InvoiceProduct] — sub-fields: productId or productCode (not both), or accountCode for a non-stock line; description; quantity (> 0); price (> 0, the amount credited per unit); discount (amount like "100" or percent like "10%"); vatType (1 = No VAT, 2 = 0%, 3 = 7%, default 3); isDescription (1 = text-only row, no price/quantity). accountSubId / accountSubCode are NOT supported here.array[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| reasonType | integer | required | Reason code printed on the document (1=Price reduction of goods, 2=Price reduction of services, 3=Return of goods / goods not as ordered, 4=Fine or compensation, 5=Refund of advance payment, 6=Return or exchange of goods — VAT-registered buyer, 7=Return or exchange of goods — non-VAT buyer, 8=Cancellation of a service agreement, 9=Cancellation of a service already provided, 10=Other). 0 (Not Specified) is refused. | ||||||||||||||||||||||||||||
| reasonDescription | string | required | Why the credit note is issued, in the user's words. Required; printed on the document. | ||||||||||||||||||||||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the vendor (send this or contactCode, not both) | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the vendor (send this or contactId, not both). SearchContacts if not known | ||||||||||||||||||||||||||||
| goodsReturn | integer? | optional | Involves product return — stock goes back to the vendor (0=No,1=Yes). Default 0 | ||||||||||||||||||||||||||||
| creditNoteStyleType | integer? | optional | Display type (0=General, 1=Thai standard format) | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as the vendor's credit note number | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes. Leave blank to use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=Price excludes VAT,1=Price includes VAT,2=No VAT) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount, amount or percent. Must not exceed the document total. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| returnPaymentMethodCode | string | optional | Refund received back from the vendor (รับคืน). Code of the payment method (e.g. 'CSH001'); send this or returnPaymentMethodId. GetPaymentMethod if not known. Leave both blank when nothing has been paid yet. | ||||||||||||||||||||||||||||
| returnPaymentMethodId | string | optional | Unique Identifier of the payment method for the refund | ||||||||||||||||||||||||||||
| returnPaymentAmount | number? | optional | Refund amount (> 0). Required when a payment method is sent. | ||||||||||||||||||||||||||||
| returnPaymentDate | string | optional | Refund date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| returnPaymentAccountCode | string | optional | Account code for the refund | ||||||||||||||||||||||||||||
| returnPaymentAccountSubId | string | optional | Sub-account ID for the refund | ||||||||||||||||||||||||||||
| returnPaymentAccountSubCode | string | optional | Sub-account code for the refund | ||||||||||||||||||||||||||||
| returnPaymentNote | string | optional | Notes for the refund | ||||||||||||||||||||||||||||
| returnPaymentWithHoldingTaxAmount | string | optional | WithHoldingTax on the refund, amount like "30" or percent like "3%" | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
DailyJournal
4 tools
GetAccountCodes
WHEN TO USE Call once per session (cache the result) whenever: (a) the document is an Expense, (b) `use_product_code = false`, or (c) a line item fell back from productCode because ListProduct found nothing. Do not call it repeatedly per line item — one call covers the whole chart. BUSINESS RULES & PRE-CONDITIONS If a business-profile.md exists with a pre-mapped account table (e.g. ค่าเช่า → 530201), prefer that mapping over re-deriving one from the raw chart — it reflects this specific business's past decisions. Only fall back to the raw chart when the category isn't already mapped. FALLBACK & ERROR HANDLING No exact category match in either the business profile or common defaults → show the closest 2-3 candidate accounts to the user and ask them to confirm; never silently pick the "closest guess." EXPECTED OUTCOME Returns `code`, `name`, `nameEn` for every account. Common anchors: 410101 = รายได้จากการขาย, 114102 = สินค้าสำเร็จรูป, 212101 = เจ้าหนี้การค้า, 113101 = ลูกหนี้การค้า.
no params
GetAccountCodes
WHEN TO USE Call once per session (cache the result) whenever: (a) the document is an Expense, (b) `use_product_code = false`, or (c) a line item fell back from productCode because ListProduct found nothing. Do not call it repeatedly per line item — one call covers the whole chart. BUSINESS RULES & PRE-CONDITIONS If a business-profile.md exists with a pre-mapped account table (e.g. ค่าเช่า → 530201), prefer that mapping over re-deriving one from the raw chart — it reflects this specific business's past decisions. Only fall back to the raw chart when the category isn't already mapped. FALLBACK & ERROR HANDLING No exact category match in either the business profile or common defaults → show the closest 2-3 candidate accounts to the user and ask them to confirm; never silently pick the "closest guess." EXPECTED OUTCOME Returns `code`, `name`, `nameEn` for every account. Common anchors: 410101 = รายได้จากการขาย, 114102 = สินค้าสำเร็จรูป, 212101 = เจ้าหนี้การค้า, 113101 = ลูกหนี้การค้า.
No parameters required.
Response
{
"PeakAccountCode": {
"resCode": "200",
"resDesc": "Success",
"accountCode": [{
"code": "11000",
"name": "เงินสด",
"nameEn": "Cash"
}]
}
}
CreateDailyJournal
WHEN TO USE Use when the user wants to post a manual journal entry (สมุดรายวัน / บันทึกบัญชี) directly to the ledger — e.g. depreciation, accruals, reclassifications, opening balances or adjustments — rather than creating a sales/purchase document. If the user describes a sale, a purchase or a payment of a document, use that document's tool (CreateInvoice, CreateExpense, CreateReceipt …) instead: those post their own journals. BUSINESS RULES & PRE-CONDITIONS Resolve every accountCode via GetAccountCodes first (once per session) — never invent one. journalTypeId is required: 1 = Purchase (สมุดรายวันซื้อ), 2 = Sales (สมุดรายวันขาย), 3 = Payment (สมุดรายวันจ่าย), 4 = Receive (สมุดรายวันรับ), 5 = General (สมุดรายวันทั่วไป); ask the user when the intent doesn't fix the type. Each line is either a debit or a credit (the other side 0, no negatives), and total debit MUST equal total credit — PEAK itself does not check this, so this tool refuses an unbalanced set before sending it. description is required. One journal per call. FALLBACK & ERROR HANDLING An unbalanced set is refused by this tool and an unknown account code is rejected by PEAK: report the message and correct the lines with the user; never silently rebalance by adding a line of your own. Any resCode other than 200 (on the envelope or on the journal row) means the journal was NOT created. Without contactId PEAK attaches the default contact (C00000). EXPECTED OUTCOME Returns the created journal with id, code, issuedDate, totalDebit, totalCredit and journalEntries. Display the Journal Number, date, and total debit/credit to the user.
4 required · 2 optional
CreateDailyJournal
WHEN TO USE Use when the user wants to post a manual journal entry (สมุดรายวัน / บันทึกบัญชี) directly to the ledger — e.g. depreciation, accruals, reclassifications, opening balances or adjustments — rather than creating a sales/purchase document. If the user describes a sale, a purchase or a payment of a document, use that document's tool (CreateInvoice, CreateExpense, CreateReceipt …) instead: those post their own journals. BUSINESS RULES & PRE-CONDITIONS Resolve every accountCode via GetAccountCodes first (once per session) — never invent one. journalTypeId is required: 1 = Purchase (สมุดรายวันซื้อ), 2 = Sales (สมุดรายวันขาย), 3 = Payment (สมุดรายวันจ่าย), 4 = Receive (สมุดรายวันรับ), 5 = General (สมุดรายวันทั่วไป); ask the user when the intent doesn't fix the type. Each line is either a debit or a credit (the other side 0, no negatives), and total debit MUST equal total credit — PEAK itself does not check this, so this tool refuses an unbalanced set before sending it. description is required. One journal per call. FALLBACK & ERROR HANDLING An unbalanced set is refused by this tool and an unknown account code is rejected by PEAK: report the message and correct the lines with the user; never silently rebalance by adding a line of your own. Any resCode other than 200 (on the envelope or on the journal row) means the journal was NOT created. Without contactId PEAK attaches the default contact (C00000). EXPECTED OUTCOME Returns the created journal with id, code, issuedDate, totalDebit, totalCredit and journalEntries. Display the Journal Number, date, and total debit/credit to the user.
| Parameter | Type | Description | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| issuedDate | string | required | Journal date (yyyyMMdd). | ||||||||||||
| journalTypeId | integer | required | Journal type (required): 1 = Purchase, 2 = Sales, 3 = Payment, 4 = Receive, 5 = General. Ask the user when unsure. | ||||||||||||
| description | string | required | Journal description / narration (required), e.g. 'ค่าเสื่อมราคา ก.ย. 2569'. | ||||||||||||
| journalEntries | array[DailyJournalEntry] | required | array[DailyJournalEntry] — journal lines. sub-fields: accountCode, debit, credit, accountSubId?, description?. Each line is debit-only or credit-only; total debit must equal total credit.array[DailyJournalEntry] fields
|
||||||||||||
| code | string | optional | Journal number displayed in PEAK. Auto-generated if blank | ||||||||||||
| contactId | string | optional | Unique Identifier of the contact the journal relates to (optional). SearchContacts if don't known |
GetDailyJournal
WHEN TO USE Use to read ONE journal entry (สมุดรายวัน) you already have an identifier for — to check its lines, totals or status, or to confirm the right journal before voiding it. BUSINESS RULES & PRE-CONDITIONS Supply code (the journal number shown in PEAK or returned by CreateDailyJournal) or id; one of the two is required. There is no date or keyword search on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the journal is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate journal lines. An empty dailyJournals list means no match. A code can return more than one journal — PEAK reuses a journal number after a void — so pick the one with isVoid null, or read by id when you have it. EXPECTED OUTCOME Returns the journal with code, issuedDate, journalTypeId, isVoid, totalDebit, totalCredit and journalEntries (accountCode, description, debit, credit). isVoid = 1 means the journal is voided; null means it is active. documentStatus is not populated by PEAK — don't report it. referenceNumber / referenceTransactionType identify the source document that produced the journal (e.g. the invoice number and 102). referenceTransactionType codes: 101 Quotation, 102 Invoice, 103 Receipt, 104 TaxInvoice, 105 CreditNote, 106 BillingNote, 107 DebitNote, 121 Deposit, 201 PurchaseOrder, 202 Expense, 205 CreditNoteExpense, 206 BillingNoteExpense, 207 DebitNoteExpense, 221 DepositExpense, 222 GoodsReceipt, 223 InvoiceReceipt — use referenceNumber as the code for that document's Get tool. Both are null on a manual journal; referenceTransactionType is also null for source types with no public code, even when referenceNumber is present. The response carries contactId and contactCode but not the contact name — never print a name as if it came from this response.
0 required · 2 optional
GetDailyJournal
WHEN TO USE Use to read ONE journal entry (สมุดรายวัน) you already have an identifier for — to check its lines, totals or status, or to confirm the right journal before voiding it. BUSINESS RULES & PRE-CONDITIONS Supply code (the journal number shown in PEAK or returned by CreateDailyJournal) or id; one of the two is required. There is no date or keyword search on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the journal is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate journal lines. An empty dailyJournals list means no match. A code can return more than one journal — PEAK reuses a journal number after a void — so pick the one with isVoid null, or read by id when you have it. EXPECTED OUTCOME Returns the journal with code, issuedDate, journalTypeId, isVoid, totalDebit, totalCredit and journalEntries (accountCode, description, debit, credit). isVoid = 1 means the journal is voided; null means it is active. documentStatus is not populated by PEAK — don't report it. referenceNumber / referenceTransactionType identify the source document that produced the journal (e.g. the invoice number and 102). referenceTransactionType codes: 101 Quotation, 102 Invoice, 103 Receipt, 104 TaxInvoice, 105 CreditNote, 106 BillingNote, 107 DebitNote, 121 Deposit, 201 PurchaseOrder, 202 Expense, 205 CreditNoteExpense, 206 BillingNoteExpense, 207 DebitNoteExpense, 221 DepositExpense, 222 GoodsReceipt, 223 InvoiceReceipt — use referenceNumber as the code for that document's Get tool. Both are null on a manual journal; referenceTransactionType is also null for source types with no public code, even when referenceNumber is present. The response carries contactId and contactCode but not the contact name — never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Journal number of ONE specific journal, as shown in PEAK or returned by CreateDailyJournal. Recommended |
| id | string | optional | The Unique Identifier of ONE specific journal. Use when the code is unknown |
VoidDailyJournal
WHEN TO USE Only when the user explicitly asks to cancel an existing journal entry (สมุดรายวัน). This cannot be undone — never void a journal to tidy up or to redo it on your own initiative. Journals cannot be edited — to correct one, void it and post a replacement with CreateDailyJournal. BUSINESS RULES & PRE-CONDITIONS Identify the journal with code or id; one of the two is required — use GetDailyJournal to look it up. Prefer id: a journal number can be shared by a voided journal and its active replacement. The journal is permanently marked voided. PEAK refuses to void a journal in a locked accounting period. FALLBACK & ERROR HANDLING This permanently cancels a posted journal — show the user the journal number, date and total amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the journal was NOT voided: report resDesc. resCode 384 "Transaction not found" is returned both for a wrong identifier and for a journal that is already voided — check with GetDailyJournal (isVoid = 1) before telling the user it doesn't exist. EXPECTED OUTCOME Returns resCode 200 on success; confirm to the user which journal number was voided.
0 required · 2 optional
VoidDailyJournal
WHEN TO USE Only when the user explicitly asks to cancel an existing journal entry (สมุดรายวัน). This cannot be undone — never void a journal to tidy up or to redo it on your own initiative. Journals cannot be edited — to correct one, void it and post a replacement with CreateDailyJournal. BUSINESS RULES & PRE-CONDITIONS Identify the journal with code or id; one of the two is required — use GetDailyJournal to look it up. Prefer id: a journal number can be shared by a voided journal and its active replacement. The journal is permanently marked voided. PEAK refuses to void a journal in a locked accounting period. FALLBACK & ERROR HANDLING This permanently cancels a posted journal — show the user the journal number, date and total amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the journal was NOT voided: report resDesc. resCode 384 "Transaction not found" is returned both for a wrong identifier and for a journal that is already voided — check with GetDailyJournal (isVoid = 1) before telling the user it doesn't exist. EXPECTED OUTCOME Returns resCode 200 on success; confirm to the user which journal number was voided.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the journal to be voided |
| id | string | optional | The Unique Identifier of the journal to be voided |
DepositExpense
4 tools
CreateDepositExpense
WHEN TO USE Use to record a deposit PAID (ใบมัดจำจ่าย, DP) — money this business pays a VENDOR in advance, before the goods or service are delivered. Direction matters: this is the pay/OutFlow side. For a deposit RECEIVED from a customer (ใบมัดจำรับ, DR) use CreateDeposit instead, and for the purchase itself once goods arrive use CreateExpense. A deposit paid is an asset until a later purchase document draws it down. BUSINESS RULES & PRE-CONDITIONS Identify the VENDOR with contactCode or contactId — resolve a name to a code with SearchContacts first and never guess one. Every line item needs an accountCode; the deposit-paid asset account is commonly 115104 (เงินมัดจำจ่ายล่วงหน้า) but confirm with GetAccountCodes rather than assuming it. Note this is the asset mirror of DR's liability account 212104 — do not use 212104 here. `status` here is the STRING 'Draft' or 'Approve' (default 'Draft') — it is NOT the integer used by ListDepositExpense. Supply the payment fields only when the money has actually been paid. The user needs both the deposit-expense-create and the payment permission in PEAK, even when no payment is supplied. FALLBACK & ERROR HANDLING An unknown contactCode or accountCode is a fixable argument error — confirm the right value with the user and retry; never invent a code. Any resCode other than 200 means NO deposit expense was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the deposit expense in Draft or Approve status and returns its code (format DP-YYYYMM000NN, never DR-), contactId / contactCode, netAmount and documentLink. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
2 required · 19 optional
CreateDepositExpense
WHEN TO USE Use to record a deposit PAID (ใบมัดจำจ่าย, DP) — money this business pays a VENDOR in advance, before the goods or service are delivered. Direction matters: this is the pay/OutFlow side. For a deposit RECEIVED from a customer (ใบมัดจำรับ, DR) use CreateDeposit instead, and for the purchase itself once goods arrive use CreateExpense. A deposit paid is an asset until a later purchase document draws it down. BUSINESS RULES & PRE-CONDITIONS Identify the VENDOR with contactCode or contactId — resolve a name to a code with SearchContacts first and never guess one. Every line item needs an accountCode; the deposit-paid asset account is commonly 115104 (เงินมัดจำจ่ายล่วงหน้า) but confirm with GetAccountCodes rather than assuming it. Note this is the asset mirror of DR's liability account 212104 — do not use 212104 here. `status` here is the STRING 'Draft' or 'Approve' (default 'Draft') — it is NOT the integer used by ListDepositExpense. Supply the payment fields only when the money has actually been paid. The user needs both the deposit-expense-create and the payment permission in PEAK, even when no payment is supplied. FALLBACK & ERROR HANDLING An unknown contactCode or accountCode is a fixable argument error — confirm the right value with the user and retry; never invent a code. Any resCode other than 200 means NO deposit expense was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the deposit expense in Draft or Approve status and returns its code (format DP-YYYYMM000NN, never DR-), contactId / contactCode, netAmount and documentLink. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[DepositExpenseProduct] | required | Products/services. array[DepositExpenseProduct] - line items. sub-fields: productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1=None,2=ZeroPercent,3=SevenPercent, default 3), withHoldingTaxAmountarray[DepositExpenseProduct] fields
|
||||||||||||||||||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Default = issuedDate. | ||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact (the vendor being paid) | ||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact / vendor (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK (e.g. 'DP-20260800001'). Auto-generated if blank | ||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes. Leave blank to automatically use the default value. | ||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. This is a STRING - not the integer status used by ListDepositExpense. | ||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'BSV003') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Supply only when the deposit has actually been paid. | ||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount paid. | ||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording the payment | ||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
GetDepositExpense
WHEN TO USE Use to read ONE deposit paid (ใบมัดจำจ่าย, DP) you already have an identifier for — to check its status, how much of it is still undrawn, or its details before voiding it. This is the purchase/OutFlow side: for a deposit RECEIVED from a customer (DR) use GetDeposit instead. This tool addresses a document directly by id or code; to search by date range, status or contact use ListDepositExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id or code (e.g. 'DP-20260700002'). There is no date filter and no `reference` lookup on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Voided deposit expenses are NOT returned here — use ListDepositExpense with status=7 for those. Otherwise no match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. A DR- code will never be found here — that is a deposit received, so retry with GetDeposit rather than assuming the document is missing. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the full deposit expense — code, issuedDate, dueDate, contactId / contactCode, status, the amount breakdown (preTaxAmount, vatAmount, netAmount, whtAmount, paymentAmount, remainAmount), its products, paidPayments and journals, and documentLink. Journals on this side are payment vouchers (PV-), not the receipt vouchers (RV-) a deposit received produces. It may also carry receivedTaxInvoice — the tax invoice the VENDOR issued to this business, which has no equivalent on the receive side. remainAmount is how much of the deposit is still undrawn. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
0 required · 2 optional
GetDepositExpense
WHEN TO USE Use to read ONE deposit paid (ใบมัดจำจ่าย, DP) you already have an identifier for — to check its status, how much of it is still undrawn, or its details before voiding it. This is the purchase/OutFlow side: for a deposit RECEIVED from a customer (DR) use GetDeposit instead. This tool addresses a document directly by id or code; to search by date range, status or contact use ListDepositExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id or code (e.g. 'DP-20260700002'). There is no date filter and no `reference` lookup on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Voided deposit expenses are NOT returned here — use ListDepositExpense with status=7 for those. Otherwise no match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. A DR- code will never be found here — that is a deposit received, so retry with GetDeposit rather than assuming the document is missing. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the full deposit expense — code, issuedDate, dueDate, contactId / contactCode, status, the amount breakdown (preTaxAmount, vatAmount, netAmount, whtAmount, paymentAmount, remainAmount), its products, paidPayments and journals, and documentLink. Journals on this side are payment vouchers (PV-), not the receipt vouchers (RV-) a deposit received produces. It may also carry receivedTaxInvoice — the tax invoice the VENDOR issued to this business, which has no equivalent on the receive side. remainAmount is how much of the deposit is still undrawn. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific deposit expense (e.g. 'DP-20260700002'). Recommended - it also identifies the document number. A DR- code belongs to GetDeposit, not here. |
| id | string | optional | The Unique Identifier of ONE specific deposit expense. Use when the code is unknown |
ListDepositExpense
WHEN TO USE Use to search deposits PAID (ใบมัดจำจ่าย, DP) — to find a document code, review what this business has paid vendors in advance, or check which deposits paid are still undrawn. This is the purchase/OutFlow side: to search deposits RECEIVED from customers (DR) use ListDeposit instead. To read one document you already have an id or code for, use GetDepositExpense. BUSINESS RULES & PRE-CONDITIONS fromDate and toDate (yyyyMMdd) are REQUIRED and fromDate must not be after toDate; status, contactCode (the vendor) and transactionNumber (the document number) are optional. IMPORTANT: `status` here is an INTEGER on the list-filter scale where 0=All and 1=Draft — it is NOT the same numbering as the `statusId` returned in the response, and NOT the same as the string status used by CreateDepositExpense. This endpoint is NOT paginated and returns at most 1000 rows, so narrow the date range rather than widening it. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the deposit expense does not exist — widen the date range or drop the status filter before concluding it is not there. If the user was actually asking about money received from a customer, switch to ListDeposit rather than reporting nothing found. On several near-matches, show the list and let the user pick. Never re-use a returned statusId as the status filter; they are different scales. EXPECTED OUTCOME Returns a slimmer row per deposit expense — code, issuedDate, dueDate, contactId / contactCode, status, netAmount, documentLink, plus isVoid and statusId. It does NOT include the amount breakdown, products, payments or receivedTaxInvoice; call GetDepositExpense for those. Treat isVoid = 1 as the authoritative sign that a deposit expense is cancelled.
2 required · 3 optional
ListDepositExpense
WHEN TO USE Use to search deposits PAID (ใบมัดจำจ่าย, DP) — to find a document code, review what this business has paid vendors in advance, or check which deposits paid are still undrawn. This is the purchase/OutFlow side: to search deposits RECEIVED from customers (DR) use ListDeposit instead. To read one document you already have an id or code for, use GetDepositExpense. BUSINESS RULES & PRE-CONDITIONS fromDate and toDate (yyyyMMdd) are REQUIRED and fromDate must not be after toDate; status, contactCode (the vendor) and transactionNumber (the document number) are optional. IMPORTANT: `status` here is an INTEGER on the list-filter scale where 0=All and 1=Draft — it is NOT the same numbering as the `statusId` returned in the response, and NOT the same as the string status used by CreateDepositExpense. This endpoint is NOT paginated and returns at most 1000 rows, so narrow the date range rather than widening it. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the deposit expense does not exist — widen the date range or drop the status filter before concluding it is not there. If the user was actually asking about money received from a customer, switch to ListDeposit rather than reporting nothing found. On several near-matches, show the list and let the user pick. Never re-use a returned statusId as the status filter; they are different scales. EXPECTED OUTCOME Returns a slimmer row per deposit expense — code, issuedDate, dueDate, contactId / contactCode, status, netAmount, documentLink, plus isVoid and statusId. It does NOT include the amount breakdown, products, payments or receivedTaxInvoice; call GetDepositExpense for those. Treat isVoid = 1 as the authoritative sign that a deposit expense is cancelled.
| Parameter | Type | Description | |
|---|---|---|---|
| fromDate | string | required | REQUIRED. Displays deposit expenses starting from the specified date (Format: yyyyMMdd). Note this is fromDate, not dateStart. |
| toDate | string | required | REQUIRED. Displays deposit expenses up to the specified date (Format: yyyyMMdd). Must not be before fromDate. Note this is toDate, not dateEnd. |
| status | integer? | optional | Deposit expense list filter (0=All,1=Draft,2=AwaitApproval,3=WaitingPayment,4=Overdue,5=Paid,6=AlreadyIssued,7=Voided). This is the LIST-FILTER scale. It is NOT the statusId returned in the response (where 2=Draft), and not the string status used by CreateDepositExpense. Do not pass a statusId back into this parameter. |
| contactCode | string | optional | Code of the contact / vendor to filter by (e.g. 'C00001'), SearchContacts if don't known |
| transactionNumber | string | optional | Document number to filter by (e.g. 'DP-20260800001') |
VoidDepositExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing deposit paid (ใบมัดจำจ่าย, DP). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. To correct a deposit expense, void it and issue a replacement with CreateDepositExpense. For a deposit RECEIVED from a customer (DR) use VoidDeposit instead — voiding the wrong side of the pair cancels a real document that the user did not ask about. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetDepositExpense or ListDepositExpense to look it up. PEAK voids by id only, so a code is first resolved to its id through GetDepositExpense. The deposit expense is permanently marked as voided and cannot be reused afterwards. PEAK will refuse the void if another document has already drawn the deposit down, if its payment has to be voided first, or if the journal period is locked — the blocking item has to be dealt with first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the deposit expense was NOT voided: report resDesc. If PEAK refuses because the deposit has been drawn down, say so plainly instead of retrying. EXPECTED OUTCOME Returns a flat resCode / resDesc pair. On success, GetDepositExpense no longer returns the document; ListDepositExpense with status=7 shows it with isVoid = 1 — that flag is how a voided deposit expense is identified.
0 required · 2 optional
VoidDepositExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing deposit paid (ใบมัดจำจ่าย, DP). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. To correct a deposit expense, void it and issue a replacement with CreateDepositExpense. For a deposit RECEIVED from a customer (DR) use VoidDeposit instead — voiding the wrong side of the pair cancels a real document that the user did not ask about. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetDepositExpense or ListDepositExpense to look it up. PEAK voids by id only, so a code is first resolved to its id through GetDepositExpense. The deposit expense is permanently marked as voided and cannot be reused afterwards. PEAK will refuse the void if another document has already drawn the deposit down, if its payment has to be voided first, or if the journal period is locked — the blocking item has to be dealt with first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the deposit expense was NOT voided: report resDesc. If PEAK refuses because the deposit has been drawn down, say so plainly instead of retrying. EXPECTED OUTCOME Returns a flat resCode / resDesc pair. On success, GetDepositExpense no longer returns the document; ListDepositExpense with status=7 shows it with isVoid = 1 — that flag is how a voided deposit expense is identified.
| Parameter | Type | Description | |
|---|---|---|---|
| id | string | optional | The Unique Identifier of the deposit expense to be voided |
| code | string | optional | The code of the deposit expense to be voided (e.g. 'DP-20260800001'). Resolved to its id through GetDepositExpense when id is not given |
Deposit
4 tools
CreateDeposit
WHEN TO USE Use to record a deposit received (ใบมัดจำรับ, DR) — money a customer pays IN ADVANCE, before the goods or service are delivered. Do not use it for money received against an invoice that already exists (use CreateReceipt) and not for the sale itself (use CreateInvoice). A deposit is a liability until a later document draws it down. BUSINESS RULES & PRE-CONDITIONS Identify the customer with contactCode or contactId — resolve a name to a code with SearchContacts first and never guess one. Every line item needs an accountCode; the deposit liability account is commonly 212104 (เงินมัดจำรับล่วงหน้า) but confirm with GetAccountCodes rather than assuming it. `status` here is the STRING 'Draft' or 'Approve' (default 'Draft') — it is NOT the integer used by ListDeposit. Supply the payment fields only when the money has actually been received. The user needs both the deposit-create and the payment permission in PEAK, even when no payment is supplied. FALLBACK & ERROR HANDLING An unknown contactCode or accountCode is a fixable argument error — confirm the right value with the user and retry; never invent a code. Any resCode other than 200 means NO deposit was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the deposit in Draft or Approve status and returns its code (format DR-YYYYMM000NN), contactId / contactCode, netAmount and documentLink. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
2 required · 19 optional
CreateDeposit
WHEN TO USE Use to record a deposit received (ใบมัดจำรับ, DR) — money a customer pays IN ADVANCE, before the goods or service are delivered. Do not use it for money received against an invoice that already exists (use CreateReceipt) and not for the sale itself (use CreateInvoice). A deposit is a liability until a later document draws it down. BUSINESS RULES & PRE-CONDITIONS Identify the customer with contactCode or contactId — resolve a name to a code with SearchContacts first and never guess one. Every line item needs an accountCode; the deposit liability account is commonly 212104 (เงินมัดจำรับล่วงหน้า) but confirm with GetAccountCodes rather than assuming it. `status` here is the STRING 'Draft' or 'Approve' (default 'Draft') — it is NOT the integer used by ListDeposit. Supply the payment fields only when the money has actually been received. The user needs both the deposit-create and the payment permission in PEAK, even when no payment is supplied. FALLBACK & ERROR HANDLING An unknown contactCode or accountCode is a fixable argument error — confirm the right value with the user and retry; never invent a code. Any resCode other than 200 means NO deposit was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the deposit in Draft or Approve status and returns its code (format DR-YYYYMM000NN), contactId / contactCode, netAmount and documentLink. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[DepositProduct] | required | Products/services. array[DepositProduct] - line items. sub-fields: productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1=None,2=ZeroPercent,3=SevenPercent, default 3), withHoldingTaxAmountarray[DepositProduct] fields
|
||||||||||||||||||||||||
| issuedDate | string | required | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Default = issuedDate. | ||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK (e.g. 'DR-20260800009'). Auto-generated if blank | ||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes. Leave blank to automatically use the default value. | ||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. This is a STRING - not the integer status used by ListDeposit. | ||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Supply only when the deposit has actually been received. | ||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount received. | ||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording the payment | ||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
GetDeposit
WHEN TO USE Use to read ONE deposit received (ใบมัดจำรับ, DR) you already have an identifier for — to check its status, its remaining balance before it is drawn down, or its details before voiding it. This tool addresses a document directly by id or code; to search by date range, status or contact use ListDeposit instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id or code (e.g. 'DR-20260800007'). There is no date filter and no `reference` lookup on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Voided deposits are NOT returned here — use ListDeposit with status=7 for those. Otherwise no match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the full deposit — code, issuedDate, dueDate, contactId / contactCode, status, the amount breakdown (preTaxAmount, vatAmount, netAmount, whtAmount, paymentAmount, remainAmount), its products, paidPayments and journals, and documentLink. remainAmount is how much of the deposit is still undrawn. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
0 required · 2 optional
GetDeposit
WHEN TO USE Use to read ONE deposit received (ใบมัดจำรับ, DR) you already have an identifier for — to check its status, its remaining balance before it is drawn down, or its details before voiding it. This tool addresses a document directly by id or code; to search by date range, status or contact use ListDeposit instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id or code (e.g. 'DR-20260800007'). There is no date filter and no `reference` lookup on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Voided deposits are NOT returned here — use ListDeposit with status=7 for those. Otherwise no match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the full deposit — code, issuedDate, dueDate, contactId / contactCode, status, the amount breakdown (preTaxAmount, vatAmount, netAmount, whtAmount, paymentAmount, remainAmount), its products, paidPayments and journals, and documentLink. remainAmount is how much of the deposit is still undrawn. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific deposit (e.g. 'DR-20260800007'). Recommended - it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific deposit. Use when the code is unknown |
ListDeposit
WHEN TO USE Use to search deposits received (ใบมัดจำรับ, DR) — to find a document code, review what a customer has paid in advance, or check which deposits are still undrawn. To read one document you already have an id or code for, use GetDeposit instead. BUSINESS RULES & PRE-CONDITIONS fromDate and toDate (yyyyMMdd) are REQUIRED and fromDate must not be after toDate; status, contactCode and transactionNumber (the document number) are optional. IMPORTANT: `status` here is an INTEGER on the list-filter scale where 0=All and 1=Draft — it is NOT the same numbering as the `statusId` returned in the response, and NOT the same as the string status used by CreateDeposit. This endpoint is NOT paginated and returns at most 1000 rows, so narrow the date range rather than widening it. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the deposit does not exist — widen the date range or drop the status filter before concluding it is not there. On several near-matches, show the list and let the user pick. Never re-use a returned statusId as the status filter; they are different scales. EXPECTED OUTCOME Returns a slimmer row per deposit — code, issuedDate, dueDate, contactId / contactCode, status, netAmount, documentLink, plus isVoid and statusId. It does NOT include the amount breakdown, products or payments; call GetDeposit for those. Treat isVoid = 1 as the authoritative sign that a deposit is cancelled.
2 required · 3 optional
ListDeposit
WHEN TO USE Use to search deposits received (ใบมัดจำรับ, DR) — to find a document code, review what a customer has paid in advance, or check which deposits are still undrawn. To read one document you already have an id or code for, use GetDeposit instead. BUSINESS RULES & PRE-CONDITIONS fromDate and toDate (yyyyMMdd) are REQUIRED and fromDate must not be after toDate; status, contactCode and transactionNumber (the document number) are optional. IMPORTANT: `status` here is an INTEGER on the list-filter scale where 0=All and 1=Draft — it is NOT the same numbering as the `statusId` returned in the response, and NOT the same as the string status used by CreateDeposit. This endpoint is NOT paginated and returns at most 1000 rows, so narrow the date range rather than widening it. Read-only; it never changes a document. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the deposit does not exist — widen the date range or drop the status filter before concluding it is not there. On several near-matches, show the list and let the user pick. Never re-use a returned statusId as the status filter; they are different scales. EXPECTED OUTCOME Returns a slimmer row per deposit — code, issuedDate, dueDate, contactId / contactCode, status, netAmount, documentLink, plus isVoid and statusId. It does NOT include the amount breakdown, products or payments; call GetDeposit for those. Treat isVoid = 1 as the authoritative sign that a deposit is cancelled.
| Parameter | Type | Description | |
|---|---|---|---|
| fromDate | string | required | REQUIRED. Displays deposits starting from the specified date (Format: yyyyMMdd). Note this is fromDate, not dateStart. |
| toDate | string | required | REQUIRED. Displays deposits up to the specified date (Format: yyyyMMdd). Must not be before fromDate. Note this is toDate, not dateEnd. |
| status | integer? | optional | Deposit list filter (0=All,1=Draft,2=AwaitApproval,3=WaitingPayment,4=Overdue,5=Paid,6=AlreadyIssued,7=Voided). This is the LIST-FILTER scale. It is NOT the statusId returned in the response (where 2=Draft), and not the string status used by CreateDeposit. Do not pass a statusId back into this parameter. |
| contactCode | string | optional | Code of the contact to filter by (e.g. 'C00001'), SearchContacts if don't known |
| transactionNumber | string | optional | Document number to filter by (e.g. 'DR-20260800008') |
VoidDeposit
WHEN TO USE Only when the user explicitly asks to cancel an existing deposit received (ใบมัดจำรับ). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. To correct a deposit, void it and issue a replacement with CreateDeposit. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetDeposit or ListDeposit to look it up. PEAK voids by id only, so a code is first resolved to its id through GetDeposit. The deposit is permanently marked as voided and cannot be reused afterwards. PEAK will refuse the void if another document has already drawn the deposit down, if its payment has to be voided first, or if the journal period is locked — the blocking item has to be dealt with first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the deposit was NOT voided: report resDesc. If PEAK refuses because the deposit has been drawn down, say so plainly instead of retrying. EXPECTED OUTCOME Returns a flat resCode / resDesc pair. On success, GetDeposit no longer returns the document; ListDeposit with status=7 shows it with isVoid = 1 — that flag is how a voided deposit is identified.
0 required · 2 optional
VoidDeposit
WHEN TO USE Only when the user explicitly asks to cancel an existing deposit received (ใบมัดจำรับ). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. To correct a deposit, void it and issue a replacement with CreateDeposit. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetDeposit or ListDeposit to look it up. PEAK voids by id only, so a code is first resolved to its id through GetDeposit. The deposit is permanently marked as voided and cannot be reused afterwards. PEAK will refuse the void if another document has already drawn the deposit down, if its payment has to be voided first, or if the journal period is locked — the blocking item has to be dealt with first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the deposit was NOT voided: report resDesc. If PEAK refuses because the deposit has been drawn down, say so plainly instead of retrying. EXPECTED OUTCOME Returns a flat resCode / resDesc pair. On success, GetDeposit no longer returns the document; ListDeposit with status=7 shows it with isVoid = 1 — that flag is how a voided deposit is identified.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the deposit to be voided (e.g. 'DR-20260800009') |
| id | string | optional | The Unique Identifier of the deposit to be voided |
Expense
9 tools
CreateExpense
WHEN TO USE Use when the input describes money the business paid or owes to pay: vendor bills, rent, utilities, salaries, service fees. Never use `productCode` on Expense line items — Expense always uses `accountCode`, with no exception, even if the business has `use_product_code = true` for its sales documents. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) resolve each line item's `accountCode` via business-profile.md mapping or GetAccountCodes; (3) if withholding tax applies, prepare both WHT fields together — paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item; there is no document-level WHT field. VAT logic (line-item vatType: 1 = None, 2 = ZeroPercent, 3 = SevenPercent): has tax invoice + 7% VAT stated → `taxStatus=1, vatType=3`; has tax invoice + 0% VAT (zero-rated) → `taxStatus=1, vatType=2`; VAT-exempt item or no tax invoice at all → `taxStatus=1, vatType=1`. Do not use `taxStatus=2` (NonTax) for no-VAT items — some environments compute total as 0. Purchase tax invoice (ลงทะเบียนภาษีซื้อ): when the vendor issued a tax invoice, pass `receivedTaxInvoice` with the number and dates exactly as printed, and set `isTaxInvoice=1` — the line items must carry 7% VAT (`vatType=3`; vatType is 1 = None, 2 = ZeroPercent, 3 = SevenPercent), and never invent a tax invoice number; omit `receivedTaxInvoice` when there is no tax invoice. A duplicate number for the same vendor is only rejected once the expense is approved, not while it is a Draft. FALLBACK & ERROR HANDLING Tax invoice number already registered for this vendor → confirm with the user instead of changing the number. periodDate out of range → it must be the taxInvoiceDate month or up to 6 months after it. VAT total error with receivedTaxInvoice → the expense has no VAT or less VAT than the tax invoice; fix the line items' vatType instead of silently dropping the tax invoice. Locked period → taxInvoiceDate or journalDate falls in a closed accounting period; ask the user for a later date. `"Should be paid full amount"` → WHT present but paymentAmount wasn't reduced; recompute `paymentAmount = netAmount − withHoldingTaxAmount`. `"Invoice net amount less than payment"` → paymentAmount + WHT exceeds netAmount; re-check the formula. `"Bank Account not found"` → payment method code wrong or points to a Cheque-type account; re-fetch via GetPaymentMethod or use `paymentMethodId`. Product-related error → fall back to accountCode and confirm with the user before retrying. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
1 required · 29 optional
CreateExpense
WHEN TO USE Use when the input describes money the business paid or owes to pay: vendor bills, rent, utilities, salaries, service fees. Never use `productCode` on Expense line items — Expense always uses `accountCode`, with no exception, even if the business has `use_product_code = true` for its sales documents. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) resolve each line item's `accountCode` via business-profile.md mapping or GetAccountCodes; (3) if withholding tax applies, prepare both WHT fields together — paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item; there is no document-level WHT field. VAT logic (line-item vatType: 1 = None, 2 = ZeroPercent, 3 = SevenPercent): has tax invoice + 7% VAT stated → `taxStatus=1, vatType=3`; has tax invoice + 0% VAT (zero-rated) → `taxStatus=1, vatType=2`; VAT-exempt item or no tax invoice at all → `taxStatus=1, vatType=1`. Do not use `taxStatus=2` (NonTax) for no-VAT items — some environments compute total as 0. Purchase tax invoice (ลงทะเบียนภาษีซื้อ): when the vendor issued a tax invoice, pass `receivedTaxInvoice` with the number and dates exactly as printed, and set `isTaxInvoice=1` — the line items must carry 7% VAT (`vatType=3`; vatType is 1 = None, 2 = ZeroPercent, 3 = SevenPercent), and never invent a tax invoice number; omit `receivedTaxInvoice` when there is no tax invoice. A duplicate number for the same vendor is only rejected once the expense is approved, not while it is a Draft. FALLBACK & ERROR HANDLING Tax invoice number already registered for this vendor → confirm with the user instead of changing the number. periodDate out of range → it must be the taxInvoiceDate month or up to 6 months after it. VAT total error with receivedTaxInvoice → the expense has no VAT or less VAT than the tax invoice; fix the line items' vatType instead of silently dropping the tax invoice. Locked period → taxInvoiceDate or journalDate falls in a closed accounting period; ask the user for a later date. `"Should be paid full amount"` → WHT present but paymentAmount wasn't reduced; recompute `paymentAmount = netAmount − withHoldingTaxAmount`. `"Invoice net amount less than payment"` → paymentAmount + WHT exceeds netAmount; re-check the formula. `"Bank Account not found"` → payment method code wrong or points to a Cheque-type account; re-fetch via GetPaymentMethod or use `paymentMethodId`. Product-related error → fall back to accountCode and confirm with the user before retrying. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. | ||||||||||||||||||||||||||||
| receivedTaxInvoice | ReceivedTaxInvoiceDetail | optional | Purchase tax invoice to register (ลงทะเบียนภาษีซื้อ) together with this expense. Send only when the vendor issued a tax invoice; omit the whole object otherwise. taxInvoiceNumber, taxInvoiceDate and journalDate are required (yyyyMMdd); periodDate is the optional VAT reporting month — PEAK stores the 1st of that month, and it must be the taxInvoiceDate month or up to 6 months after it.ReceivedTaxInvoiceDetail fields
|
Response
{
"PeakExpenses": {
"resCode": "200",
"resDesc": "Success",
"expenses": [{
"id": "guid",
"code": "EXP20240001",
"status": "Draft",
"issuedDate": "20240101",
"dueDate": "20240108",
"preTaxAmount": 1000.00,
"vatAmount": 70.00,
"netAmount": 1070.00,
"receivedTaxInvoice": {
"taxInvoiceNumber": "IV-0001",
"taxInvoiceDate": "20240101",
"journalDate": "20240101",
"periodDate": "20240101"
}
}]
}
}
GetExpense
WHEN TO USE Use to read ONE expense (บันทึกค่าใช้จ่าย) you already have an identifier for — typically to check its remainAmount, verify it is Approved before a payment is recorded against it, or read its full line items before EditExpense. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "EXP20240001"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching expense with status (Draft/Approve/Voided), document number, netAmount and remainAmount, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetExpense
WHEN TO USE Use to read ONE expense (บันทึกค่าใช้จ่าย) you already have an identifier for — typically to check its remainAmount, verify it is Approved before a payment is recorded against it, or read its full line items before EditExpense. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListExpense instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "EXP20240001"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching expense with status (Draft/Approve/Voided), document number, netAmount and remainAmount, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'EXP20240001'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakExpenses": {
"resCode": "200",
"resDesc": "Success",
"totalExpense": 1,
"expenses": [{
"id": "guid",
"code": "EXP20240001",
"status": "Draft",
"issuedDate": "20240101",
"dueDate": "20240108",
"contactId": "guid",
"contactCode": "C00002",
"isTaxInvoice": 0,
"preTaxAmount": 1000.00,
"vatAmount": 70.00,
"netAmount": 1070.00,
"whtAmount": 0,
"paymentAmount": 1070.00,
"remainAmount": 0,
"remainWhtAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "P001", "accountCode": "530101", "description": "...", "quantity": 1, "price": 1000, "vatType": 3 }],
"paidPayments": [{ "paymentDate": "20240101", "paymentTotal": 1070, "payments": [{ "paymentMethodCode": "CSH260", "amount": 1070 }] }],
"journals": [{ "id": "guid", "code": "PV-..." }]
}]
}
}
ListExpense
WHEN TO USE Use to search expenses (บันทึกค่าใช้จ่าย) by date range, status, or keyword — to find a document code, review outstanding/overdue expenses, or list recent activity. This tool returns a filtered LIST; it does not read one document by exact id/code/reference. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching expenses with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListExpense
WHEN TO USE Use to search expenses (บันทึกค่าใช้จ่าย) by date range, status, or keyword — to find a document code, review outstanding/overdue expenses, or list recent activity. This tool returns a filtered LIST; it does not read one document by exact id/code/reference. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching expenses with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Displays documents starting from the specified date (Format: yyyyMMdd). |
| dateEnd | string | optional | Displays documents ending on the specified date (Format: yyyyMMdd). |
| status | integer? | optional | Document status (0=None,1=Voided,2=Draft,3=AwaitApproval,4=Outstanding,5=Overdue,6=PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakExpenses": {
"resCode": "200",
"resDesc": "Success",
"totalExpense": 1,
"expenses": [{
"id": "guid",
"code": "EXP20240001",
"status": "Draft",
"issuedDate": "20240101",
"contactId": "guid",
"contactCode": "C00002",
"isTaxInvoice": 0,
"netAmount": 1070.00,
"remainAmount": 0,
"documentLink": "https://..."
}]
}
}
EditExpense
WHEN TO USE Call when the user wants to change an existing Draft expense (บันทึกค่าใช้จ่าย) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidExpense; to move it out of Draft use ApproveExpense. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetExpense to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. If withholding tax applies, send it at both levels: paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item (there is no document-level withholding-tax field). FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the expense was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
4 required · 27 optional
EditExpense
WHEN TO USE Call when the user wants to change an existing Draft expense (บันทึกค่าใช้จ่าย) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidExpense; to move it out of Draft use ApproveExpense. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetExpense to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. If withholding tax applies, send it at both levels: paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item (there is no document-level withholding-tax field). FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the expense was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | The COMPLETE array of products or services for the document. Any existing line omitted here is permanently deleted — copy the full list from GetExpense and modify it. array[InvoiceProduct] — sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| issuedDate | string | required | Document issuance date (yyyyMMdd). REQUIRED on edit: copy the existing value from GetExpense unless you intend to change it, otherwise the document date would be overwritten | ||||||||||||||||||||||||||||
| dueDate | string | required | Document due date (yyyyMMdd), which must be after the document issuance date. REQUIRED on edit: copy the existing value from GetExpense | ||||||||||||||||||||||||||||
| status | string | required | Status of the document (Draft, Approve, Voided, etc). REQUIRED on edit: copy the existing value from GetExpense so the edit does not change the document state | ||||||||||||||||||||||||||||
| code | string | optional | The code of the expense to be edited. Recommended over id: it also preserves the document number | ||||||||||||||||||||||||||||
| id | string | optional | The Unique Identifier of the expense to be edited. Use only when the code is unknown | ||||||||||||||||||||||||||||
| newCode | string | optional | New document number to write into the edited document. Leave blank to keep the existing document number. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact associated with the document | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact associated with the document (If contactId has been assigned a value, contactCode is not required) | ||||||||||||||||||||||||||||
| reference | string | optional | Reference information of the document | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Specify the tax status of the document to indicate whether the price includes tax or the tax is separate (0 = ExcludeTax, 1 = IncludeTax, 2 = NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | The total discount should not exceed the net total of the document or be greater than 100%. Additionally, it can only be applied when the tax type of each item is the same | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Whether the document can be used as a tax invoice (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Label attached to someone or something for the purpose of identification or to give other information | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax is applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | Tax collected from the increased value of products or services (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Total value of the document after tax and discounts have been applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency transactions | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency transactions | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Include the existing payment details when editing a document that already has a payment recorded. | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | The Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date in the format yyyyMMdd | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Payment account code. | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub account Unique Identifier to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Additional remarks or notes for that specific payment received | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Whether this payment is made by Cheque (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | Withholding tax amount for the payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakExpenses": {
"resCode": "200",
"resDesc": "Completed",
"totalExpense": 1,
"expenses": [{
"id": "guid",
"code": "EXP20240001",
"issuedDate": "20240101",
"dueDate": "20240108",
"contactId": "guid",
"contactCode": "C00002",
"status": "Draft",
"isTaxInvoice": 0,
"preTaxAmount": 1000,
"vatAmount": 70,
"netAmount": 1070,
"whtAmount": 0,
"paymentAmount": 0,
"remainAmount": 1070,
"remainWhtAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "P001", "accountCode": "530101", "description": "...", "quantity": 1, "price": 1000, "vatType": 3 }],
"paidPayments": [],
"journals": [],
"resCode": "200",
"resDesc": "Success"
}]
}
}
ApproveExpense
WHEN TO USE Call when the user asks to approve or confirm a Draft expense (บันทึกค่าใช้จ่าย) — the step that turns a Draft into a live accounting document. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetExpense to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditExpense first — an approved expense can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the expense was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
ApproveExpense
WHEN TO USE Call when the user asks to approve or confirm a Draft expense (บันทึกค่าใช้จ่าย) — the step that turns a Draft into a live accounting document. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetExpense to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditExpense first — an approved expense can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the expense was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the expense to be approved |
| id | string | optional | The Unique Identifier of the expense to be approved |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing expense (บันทึกค่าใช้จ่าย). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditExpense instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetExpense to look it up. The expense is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference (attached credit notes, billing notes or debit notes) — void those referencing documents first. If the expense has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the expense was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 3 optional
VoidExpense
WHEN TO USE Only when the user explicitly asks to cancel an existing expense (บันทึกค่าใช้จ่าย). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditExpense instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetExpense to look it up. The expense is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference (attached credit notes, billing notes or debit notes) — void those referencing documents first. If the expense has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the expense was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the expense to be voided |
| id | string | optional | The Unique Identifier of the expense to be voided |
| isVoidETaxInvoice | integer | optional | Set to 1 ONLY to void a document that has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt. Default 0 refuses the void in that case, which is the safe behaviour. Voiding an already-filed e-Tax document is a compliance action and cannot be undone (0 = refuse if already sent as e-Tax, 1 = void anyway) |
Response
{ "resCode": "200", "resDesc": "Success" }
RecordExpensePayment
WHEN TO USE Use when the user's business paid a supplier against an existing expense (ค่าใช้จ่าย), in full or in part (จ่ายชำระ). Do not use it to create a new expense that is paid at issuance (put the payment fields on CreateExpense). BUSINESS RULES & PRE-CONDITIONS Identify the expense with code or id, exactly one of the two. Use GetExpense to look it up. The expense must be approved and still awaiting payment. PEAK refuses draft, voided and fully paid documents. paymentDate (yyyyMMdd) is required: ask the user when the money was paid if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. paymentAmount plus any withHoldingTaxAmount must not exceed what is still outstanding (remainAmount on GetExpense). withHoldingTaxAmount is the withholding tax deducted, either an amount ("30") or a percentage ("3%"). FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the document number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or a "net amount ... payment" message means the amount is more than what is still outstanding. "Transaction must be Waiting Payment Status." means the expense is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. Report the document number, the amount paid and what is still outstanding. Keep paidPayments.journals[].code (e.g. PV-202610001): VoidExpensePayment needs it to cancel this payment.
0 required · 8 optional
RecordExpensePayment
WHEN TO USE Use when the user's business paid a supplier against an existing expense (ค่าใช้จ่าย), in full or in part (จ่ายชำระ). Do not use it to create a new expense that is paid at issuance (put the payment fields on CreateExpense). BUSINESS RULES & PRE-CONDITIONS Identify the expense with code or id, exactly one of the two. Use GetExpense to look it up. The expense must be approved and still awaiting payment. PEAK refuses draft, voided and fully paid documents. paymentDate (yyyyMMdd) is required: ask the user when the money was paid if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. paymentAmount plus any withHoldingTaxAmount must not exceed what is still outstanding (remainAmount on GetExpense). withHoldingTaxAmount is the withholding tax deducted, either an amount ("30") or a percentage ("3%"). FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the document number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or a "net amount ... payment" message means the amount is more than what is still outstanding. "Transaction must be Waiting Payment Status." means the expense is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. Report the document number, the amount paid and what is still outstanding. Keep paidPayments.journals[].code (e.g. PV-202610001): VoidExpensePayment needs it to cancel this payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the expense that was paid (e.g. 'EXP-20261000001'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the expense that was paid. Provide this or code, not both |
| paymentDate | string | optional | Required. The date the money was paid, format yyyyMMdd (e.g. '20261014') |
| paymentAmount | number? | optional | Required. The amount paid in this payment, excluding withholding tax |
| paymentMethodCode | string | optional | Code of the payment method the money was paid out through (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | The Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Withholding tax you deducted from the supplier, as an amount (e.g. '30') or a percentage (e.g. '3%'). Omit when none was withheld |
| note | string | optional | Optional note for this payment |
VoidExpensePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการจ่ายชำระ) a payment already recorded on an expense (ค่าใช้จ่าย), for example one entered by mistake. This does not void the expense itself (use VoidExpense for that). BUSINESS RULES & PRE-CONDITIONS Identify the expense with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. PV-202610001). RecordExpensePayment returns it, and GetExpense lists it under paidPayments[].journals[].code. When the expense has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the expense first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the expense, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetExpense and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The expense's outstanding amount goes up by that amount, and GetExpense no longer lists the payment.
0 required · 3 optional
VoidExpensePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการจ่ายชำระ) a payment already recorded on an expense (ค่าใช้จ่าย), for example one entered by mistake. This does not void the expense itself (use VoidExpense for that). BUSINESS RULES & PRE-CONDITIONS Identify the expense with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. PV-202610001). RecordExpensePayment returns it, and GetExpense lists it under paidPayments[].journals[].code. When the expense has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the expense first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the expense, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetExpense and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The expense's outstanding amount goes up by that amount, and GetExpense no longer lists the payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the expense the payment belongs to (e.g. 'EXP-20261000001'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the expense the payment belongs to. Provide this or code, not both |
| paymentJournalCode | string | optional | Required. Journal code of the payment to cancel (e.g. 'PV-202610001'), from RecordExpensePayment or GetExpense paidPayments[].journals[].code |
Response
{
"resCode": "200",
"resDesc": "Completed",
"transactionCode": "C001",
"paymentJournalCode": "C001",
"paymentDate": "2026-01-01",
"paymentTotal": 0
}
CreateExpenseFromPurchaseOrder
WHEN TO USE Use when goods or services ordered on a purchase order (ใบสั่งซื้อ) have arrived and the user wants to record the expense against it (บันทึกค่าใช้จ่ายจากใบสั่งซื้อ / สร้างค่าใช้จ่ายต่อจากใบสั่งซื้อ). Prefer this over CreateExpense whenever a purchase order exists: PEAK copies the supplier, product lines, prices, discounts, VAT and withholding tax from the purchase order and links the two documents. Use CreateExpense only when there is no purchase order. BUSINESS RULES & PRE-CONDITIONS Identify the purchase order with purchaseOrderCode or purchaseOrderId, exactly one of the two (use GetPurchaseOrder or ListPurchaseOrder to find it). The purchase order must be approved; a draft or voided one is refused ("Purchase order not Approved"). issuedDate and dueDate (yyyyMMdd) are required; ask the user if they did not say, and dueDate must not be before issuedDate. The supplier and items cannot be changed here; if they differ, use CreateExpense instead. taxStatus is required and must be the purchase order's own taxStatus (read it with GetPurchaseOrder): unlike the other fields PEAK does not copy it, and a wrong value changes the totals (a 1,070 VAT-inclusive order sent as 0 becomes 1,144.90). status defaults to Draft (the expense can still be edited); pass Approve only when the user asks for an approved expense. You may record one payment made at the same time (paymentDate, paymentAmount, paymentMethodCode or paymentMethodId, optional withHoldingTaxAmount and paymentNote); this needs status Approve. FALLBACK & ERROR HANDLING Nothing is created if an input is missing or invalid. Any resCode other than 200 means the expense was NOT created, so report resDesc as it is. A purchase order that was already converted is refused with resCode 100 and the message "Quotation already created invoice" (PEAK uses the quotation wording for purchase orders too); tell the user the order already has an expense rather than retrying. When a payment was included and the call fails, check with ListExpense whether an expense was created before trying again. EXPECTED OUTCOME Returns the new expense (id, code, status, netAmount, remainAmount, documentLink, paidPayments). Report the expense number, the amount and the status, and that it was created from the purchase order.
0 required · 17 optional
CreateExpenseFromPurchaseOrder
WHEN TO USE Use when goods or services ordered on a purchase order (ใบสั่งซื้อ) have arrived and the user wants to record the expense against it (บันทึกค่าใช้จ่ายจากใบสั่งซื้อ / สร้างค่าใช้จ่ายต่อจากใบสั่งซื้อ). Prefer this over CreateExpense whenever a purchase order exists: PEAK copies the supplier, product lines, prices, discounts, VAT and withholding tax from the purchase order and links the two documents. Use CreateExpense only when there is no purchase order. BUSINESS RULES & PRE-CONDITIONS Identify the purchase order with purchaseOrderCode or purchaseOrderId, exactly one of the two (use GetPurchaseOrder or ListPurchaseOrder to find it). The purchase order must be approved; a draft or voided one is refused ("Purchase order not Approved"). issuedDate and dueDate (yyyyMMdd) are required; ask the user if they did not say, and dueDate must not be before issuedDate. The supplier and items cannot be changed here; if they differ, use CreateExpense instead. taxStatus is required and must be the purchase order's own taxStatus (read it with GetPurchaseOrder): unlike the other fields PEAK does not copy it, and a wrong value changes the totals (a 1,070 VAT-inclusive order sent as 0 becomes 1,144.90). status defaults to Draft (the expense can still be edited); pass Approve only when the user asks for an approved expense. You may record one payment made at the same time (paymentDate, paymentAmount, paymentMethodCode or paymentMethodId, optional withHoldingTaxAmount and paymentNote); this needs status Approve. FALLBACK & ERROR HANDLING Nothing is created if an input is missing or invalid. Any resCode other than 200 means the expense was NOT created, so report resDesc as it is. A purchase order that was already converted is refused with resCode 100 and the message "Quotation already created invoice" (PEAK uses the quotation wording for purchase orders too); tell the user the order already has an expense rather than retrying. When a payment was included and the call fails, check with ListExpense whether an expense was created before trying again. EXPECTED OUTCOME Returns the new expense (id, code, status, netAmount, remainAmount, documentLink, paidPayments). Report the expense number, the amount and the status, and that it was created from the purchase order.
| Parameter | Type | Description | |
|---|---|---|---|
| purchaseOrderCode | string | optional | Code of the source purchase order (e.g. 'PO-20261000002'). Provide this or purchaseOrderId, not both |
| purchaseOrderId | string | optional | The Unique Identifier of the source purchase order. Provide this or purchaseOrderCode, not both |
| issuedDate | string | optional | Required. Issue date of the new expense, format yyyyMMdd (e.g. '20261020') |
| dueDate | string | optional | Required. Due date of the new expense, format yyyyMMdd, not before issuedDate |
| taxStatus | integer? | optional | Required. The purchase order's own tax status, from GetPurchaseOrder (0 = ExcludeTax, 1 = IncludeTax, 2 = NonTax) |
| status | string | optional | 'Draft' (default, can still be edited) or 'Approve' |
| code | string | optional | Expense number to use. Auto-generated if blank |
| reference | string | optional | Reference text, at most 32 characters |
| remark | string | optional | Remark on the expense, at most 1000 characters |
| isTaxInvoice | integer? | optional | Whether a tax invoice was received (0 = No, 1 = Yes) |
| tags | array[String] | optional | Tags to attach, at most 10 |
| paymentDate | string | optional | Only when the supplier was paid at the same time: the payment date, format yyyyMMdd. Needs status Approve |
| paymentAmount | number? | optional | Only with a payment: the amount paid, excluding withholding tax |
| paymentMethodCode | string | optional | Only with a payment: code of the payment method (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | Only with a payment: the Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Only with a payment: withholding tax deducted from the supplier, as an amount (e.g. '30') or a percentage (e.g. '3%') |
| paymentNote | string | optional | Only with a payment: note for that payment |
FileVault
0 toolsFinancialReports
2 tools
GetTrialBalance
WHEN TO USE Use for any period-shaped question about the trial balance (งบทดลอง) — ขอดูงบทดลองเดือนที่แล้ว, what is the trial balance for Q2, ยอดยกมา / ยอดยกไป of an account. This is the report that carries amounts; GetAccountCodes returns only the chart of accounts (ผังบัญชี) with no figures, so never answer a balance question from that one. BUSINESS RULES & PRE-CONDITIONS The period is expressed in whole months: fromMonth and toMonth are both required and must be yyyyMM (e.g. 202607). PEAK expands them to full calendar months — fromMonth starts on the 1st, toMonth runs through its last day — so a part-month range cannot be requested; if the user asks for specific days, say the report is month-granular rather than silently rounding. toMonth must not be earlier than fromMonth. Leave isShowSubAccount = false unless the user explicitly asks for บัญชีย่อย: true makes PEAK run the query twice and multiplies the number of rows returned. Read-only — it never changes a document. The endpoint is rate limited to 10 calls per minute per user and refuses concurrent calls, so ask for the whole range in one call instead of looping month by month. FALLBACK & ERROR HANDLING resCode 400 means the input was rejected — a missing or non-yyyyMM month, or toMonth earlier than fromMonth; read resDesc, fix the argument and retry once. resCode 600 means the user's PEAK role is not permitted to view Trial Balance & Financial Statement — say so plainly; do not present it as a business with no data. resCode 429 means the rate or concurrency limit was hit — wait the stated retry-after and never retry in a tight loop. An empty trialBalanceAccount list means there were no entries in that window, not that the chart of accounts is empty — offer to widen the range before concluding anything. Never fabricate, interpolate, or re-derive figures that are not in the response. EXPECTED OUTCOME Returns trialBalanceAccount — one row per account with accountCode / accountName (plus subAccountCode / subAccountName when isSubAccount is true) and three debit/credit pairs: beginningBalance = ยอดยกมา, change = เคลื่อนไหว, endingBalance = ยอดยกไป — plus a summary totalling all three. Self-check before answering: in a correct trial balance the summary debit and credit are equal.
2 required · 1 optional
GetTrialBalance
WHEN TO USE Use for any period-shaped question about the trial balance (งบทดลอง) — ขอดูงบทดลองเดือนที่แล้ว, what is the trial balance for Q2, ยอดยกมา / ยอดยกไป of an account. This is the report that carries amounts; GetAccountCodes returns only the chart of accounts (ผังบัญชี) with no figures, so never answer a balance question from that one. BUSINESS RULES & PRE-CONDITIONS The period is expressed in whole months: fromMonth and toMonth are both required and must be yyyyMM (e.g. 202607). PEAK expands them to full calendar months — fromMonth starts on the 1st, toMonth runs through its last day — so a part-month range cannot be requested; if the user asks for specific days, say the report is month-granular rather than silently rounding. toMonth must not be earlier than fromMonth. Leave isShowSubAccount = false unless the user explicitly asks for บัญชีย่อย: true makes PEAK run the query twice and multiplies the number of rows returned. Read-only — it never changes a document. The endpoint is rate limited to 10 calls per minute per user and refuses concurrent calls, so ask for the whole range in one call instead of looping month by month. FALLBACK & ERROR HANDLING resCode 400 means the input was rejected — a missing or non-yyyyMM month, or toMonth earlier than fromMonth; read resDesc, fix the argument and retry once. resCode 600 means the user's PEAK role is not permitted to view Trial Balance & Financial Statement — say so plainly; do not present it as a business with no data. resCode 429 means the rate or concurrency limit was hit — wait the stated retry-after and never retry in a tight loop. An empty trialBalanceAccount list means there were no entries in that window, not that the chart of accounts is empty — offer to widen the range before concluding anything. Never fabricate, interpolate, or re-derive figures that are not in the response. EXPECTED OUTCOME Returns trialBalanceAccount — one row per account with accountCode / accountName (plus subAccountCode / subAccountName when isSubAccount is true) and three debit/credit pairs: beginningBalance = ยอดยกมา, change = เคลื่อนไหว, endingBalance = ยอดยกไป — plus a summary totalling all three. Self-check before answering: in a correct trial balance the summary debit and credit are equal.
| Parameter | Type | Description | |
|---|---|---|---|
| fromMonth | string | required | First month of the reporting period, format yyyyMM — e.g. 202607. Required. PEAK reads it as the whole calendar month starting on the 1st, and ยอดยกมา is the balance brought forward into it. A missing or malformed value is rejected with resCode 400, not silently accepted. |
| toMonth | string | required | Last month of the reporting period, format yyyyMM — e.g. 202609. Required, and must not be earlier than fromMonth. PEAK includes the entire month through its last day, and ยอดยกไป is the balance at that point. |
| isShowSubAccount | boolean | optional | Whether to break each account down into its sub-accounts (บัญชีย่อย). Defaults to false. Set true only when the user asks for sub-account detail — it makes PEAK run the query twice and multiplies the number of rows returned. |
GetGeneralLedger
WHEN TO USE Use when the user wants the movements behind one account - บัญชีแยกประเภท, the general ledger: ขอดูบัญชีแยกประเภทเงินสด, show me the ledger for 111101, what transactions hit the bank account in August. This is the transaction-level report: it returns every journal line for a single account over a date range, plus that account's ยอดยกมา / เคลื่อนไหว / ยอดยกไป. Do not confuse it with its two neighbours: GetTrialBalance covers every account but carries balances only and no transactions, and GetAccountCodes is the chart of accounts (ผังบัญชี) with no amounts at all. BUSINESS RULES & PRE-CONDITIONS accountCode is required and takes exactly one account code, never a list, so when the user names an account in words (เงินสด, bank, ค่าใช้จ่าย) call GetAccountCodes first to resolve the code - never invent one. Only account categories 1 to 5 and the code 999999 are supported. fromDate and toDate are both required, must be real calendar dates in yyyyMMdd (e.g. 20260701), toDate must not be earlier than fromDate, and the whole range must stay within one year of fromDate - note this is day-granular, unlike GetTrialBalance which takes whole months in yyyyMM. Leave isShowSubAccount = false unless the user explicitly asks for บัญชีย่อย: true makes PEAK discover the sub-accounts and then run the whole ledger query once per sub-account, which is the most likely way to make the report time out. Read-only - it never changes a document. The endpoint allows 10 calls per minute per user and refuses concurrent calls, and that allowance is shared with GetTrialBalance, so ask for the whole range in one call instead of looping account by account or month by month. FALLBACK & ERROR HANDLING resCode 400 means the input was rejected - a missing or non-yyyyMMdd date, a range longer than one year, a missing accountCode, an account code that does not exist (Account was not found), or an account whose category the general ledger does not support; read resDesc, fix the argument - resolving the code through GetAccountCodes if needed - and retry once. resCode 600 means the user's PEAK role is not permitted to view the General Ledger; say so plainly and do not present it as a business with no data. resCode 429 means the rate or concurrency limit was hit - wait the stated retry-after and never retry in a tight loop. resCode 500 can mean the report exceeded PEAK's 90 second budget; suggest a shorter date range or isShowSubAccount = false rather than retrying unchanged. An empty transactions list means the account did not move in that window, not that the account is missing - offer to widen the range before concluding anything. A null beginningBalance is a legitimate value: categories 4 and 5 (revenue and expense) carry no brought-forward balance, so report it as none rather than as zero or as an error. Never fabricate, interpolate, or re-derive figures that are not in the response. EXPECTED OUTCOME Returns generalLedgers - one entry per account, or one per sub-account when isShowSubAccount is true - each carrying account (accountCode / accountName, plus subAccountCode / subAccountName when isSubAccount is true), a summary of beginningBalance = ยอดยกมา (nullable), change = เคลื่อนไหว and endingBalance = ยอดยกไป, the transactions themselves (date in yyyyMMdd, journalNumber, description, debit, credit) and totalTransactions as the row count. Figures are passed through exactly as PEAK returned them. Self-check before answering: the transactions debit and credit totals equal the change pair.
3 required · 1 optional
GetGeneralLedger
WHEN TO USE Use when the user wants the movements behind one account - บัญชีแยกประเภท, the general ledger: ขอดูบัญชีแยกประเภทเงินสด, show me the ledger for 111101, what transactions hit the bank account in August. This is the transaction-level report: it returns every journal line for a single account over a date range, plus that account's ยอดยกมา / เคลื่อนไหว / ยอดยกไป. Do not confuse it with its two neighbours: GetTrialBalance covers every account but carries balances only and no transactions, and GetAccountCodes is the chart of accounts (ผังบัญชี) with no amounts at all. BUSINESS RULES & PRE-CONDITIONS accountCode is required and takes exactly one account code, never a list, so when the user names an account in words (เงินสด, bank, ค่าใช้จ่าย) call GetAccountCodes first to resolve the code - never invent one. Only account categories 1 to 5 and the code 999999 are supported. fromDate and toDate are both required, must be real calendar dates in yyyyMMdd (e.g. 20260701), toDate must not be earlier than fromDate, and the whole range must stay within one year of fromDate - note this is day-granular, unlike GetTrialBalance which takes whole months in yyyyMM. Leave isShowSubAccount = false unless the user explicitly asks for บัญชีย่อย: true makes PEAK discover the sub-accounts and then run the whole ledger query once per sub-account, which is the most likely way to make the report time out. Read-only - it never changes a document. The endpoint allows 10 calls per minute per user and refuses concurrent calls, and that allowance is shared with GetTrialBalance, so ask for the whole range in one call instead of looping account by account or month by month. FALLBACK & ERROR HANDLING resCode 400 means the input was rejected - a missing or non-yyyyMMdd date, a range longer than one year, a missing accountCode, an account code that does not exist (Account was not found), or an account whose category the general ledger does not support; read resDesc, fix the argument - resolving the code through GetAccountCodes if needed - and retry once. resCode 600 means the user's PEAK role is not permitted to view the General Ledger; say so plainly and do not present it as a business with no data. resCode 429 means the rate or concurrency limit was hit - wait the stated retry-after and never retry in a tight loop. resCode 500 can mean the report exceeded PEAK's 90 second budget; suggest a shorter date range or isShowSubAccount = false rather than retrying unchanged. An empty transactions list means the account did not move in that window, not that the account is missing - offer to widen the range before concluding anything. A null beginningBalance is a legitimate value: categories 4 and 5 (revenue and expense) carry no brought-forward balance, so report it as none rather than as zero or as an error. Never fabricate, interpolate, or re-derive figures that are not in the response. EXPECTED OUTCOME Returns generalLedgers - one entry per account, or one per sub-account when isShowSubAccount is true - each carrying account (accountCode / accountName, plus subAccountCode / subAccountName when isSubAccount is true), a summary of beginningBalance = ยอดยกมา (nullable), change = เคลื่อนไหว and endingBalance = ยอดยกไป, the transactions themselves (date in yyyyMMdd, journalNumber, description, debit, credit) and totalTransactions as the row count. Figures are passed through exactly as PEAK returned them. Self-check before answering: the transactions debit and credit totals equal the change pair.
| Parameter | Type | Description | |
|---|---|---|---|
| fromDate | string | required | First day of the reporting period, format yyyyMMdd - e.g. 20260701. Required, and must be a real calendar date. Note this tool is day-granular; GetTrialBalance takes whole months in yyyyMM instead, so do not carry that format over. A missing or malformed value is rejected with resCode 400, not silently accepted. |
| toDate | string | required | Last day of the reporting period, format yyyyMMdd - e.g. 20260930. Required, must not be earlier than fromDate, and the range must stay within one year of fromDate - a longer span is rejected with resCode 400. |
| accountCode | string | required | The single account to report on, e.g. 111101. Required, and exactly one code - this tool cannot take a list. If the user named the account in words, call GetAccountCodes first to resolve the code rather than guessing it. Only categories 1 to 5 and 999999 are supported; an unknown or unsupported code comes back as resCode 400. |
| isShowSubAccount | boolean | optional | Whether to break the account down into its sub-accounts (บัญชีย่อย). Defaults to false. Set true only when the user asks for sub-account detail - PEAK then discovers the sub-accounts and runs the ledger query once per sub-account, which multiplies the work and the rows returned. |
GoodsReceipt
4 tools
CreateGoodsReceipt
WHEN TO USE Use when goods ordered from a vendor have physically ARRIVED and the business wants to record receiving them (ใบรับสินค้า, Goods Receipt, GR) — before, or independently of, recording the vendor's bill. It is not the vendor's bill itself (use CreateInvoiceReceipt), not a paid expense (use CreateExpense), and not an order placed with a vendor (use CreatePurchaseOrder). BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve the vendor via SearchContacts → CreateContact if missing, and pass contactId or contactCode (if both are given only contactId is sent); (2) resolve each line item's productCode, or its accountCode via GetAccountCodes — never invent one. VAT logic (line-item vatType: 1 = None, 2 = ZeroPercent, 3 = SevenPercent). A goods receipt carries no due date, no tax invoice and no payment. status: 'Draft' keeps the document a Draft; any other value creates it as AwaitApproval — this tool cannot create an approved goods receipt, so tell the user it must be approved in PEAK. FALLBACK & ERROR HANDLING PEAK reports most business-rule failures (unknown contact, account or product code, unsupported discount, duplicate number) as a generic resCode 500 without the real reason: re-check each input against what you resolved, and ask the user rather than retrying blindly or changing values on your own. EXPECTED OUTCOME Creates the document as Draft or AwaitApproval and returns its code (e.g. GR-20261000001; the format follows the company's numbering settings), id, status, amounts and line items. status uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=IssuedInvoiceReceipt). issuedDate is yyyyMMdd; preTaxAmount, vatAmount, netAmount and whtAmount are in THB. contactId is the vendor's UUID — the response has no contact name, contact code or document link — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
1 required · 11 optional
CreateGoodsReceipt
WHEN TO USE Use when goods ordered from a vendor have physically ARRIVED and the business wants to record receiving them (ใบรับสินค้า, Goods Receipt, GR) — before, or independently of, recording the vendor's bill. It is not the vendor's bill itself (use CreateInvoiceReceipt), not a paid expense (use CreateExpense), and not an order placed with a vendor (use CreatePurchaseOrder). BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve the vendor via SearchContacts → CreateContact if missing, and pass contactId or contactCode (if both are given only contactId is sent); (2) resolve each line item's productCode, or its accountCode via GetAccountCodes — never invent one. VAT logic (line-item vatType: 1 = None, 2 = ZeroPercent, 3 = SevenPercent). A goods receipt carries no due date, no tax invoice and no payment. status: 'Draft' keeps the document a Draft; any other value creates it as AwaitApproval — this tool cannot create an approved goods receipt, so tell the user it must be approved in PEAK. FALLBACK & ERROR HANDLING PEAK reports most business-rule failures (unknown contact, account or product code, unsupported discount, duplicate number) as a generic resCode 500 without the real reason: re-check each input against what you resolved, and ask the user rather than retrying blindly or changing values on your own. EXPECTED OUTCOME Creates the document as Draft or AwaitApproval and returns its code (e.g. GR-20261000001; the format follows the company's numbering settings), id, status, amounts and line items. status uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=IssuedInvoiceReceipt). issuedDate is yyyyMMdd; preTaxAmount, vatAmount, netAmount and whtAmount are in THB. contactId is the vendor's UUID — the response has no contact name, contact code or document link — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Goods received. array[InvoiceProduct] — line items. sub-fields: productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1=None,2=ZeroPercent,3=SevenPercent), withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the vendor contact. Pass this OR contactId — if both are given only contactId is sent. Use SearchContacts if not known | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier (UUID) of the vendor contact. Takes precedence over contactCode | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' keeps it a Draft; any other value creates it as AwaitApproval. Default 'Draft'. | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Date the goods were received (yyyyMMdd). Default today. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as the purchase order or the vendor's delivery note number. Max 32 characters. | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes. Leave blank to use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax). NonTax forces every line to vatType None. | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount for the document. Percentage discounts are refused when line items mix VAT types. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. PEAK currently records a goods receipt at exchange rate 1 whatever rate is supplied, so amounts are taken as-is — tell the user before creating a foreign-currency goods receipt. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data (0 = status only, 1 = return the created document). Default 1. |
GetGoodsReceipt
WHEN TO USE Use to read ONE goods receipt (ใบรับสินค้า) whose document code you already have — to check whether it is still awaiting approval, already matched to a vendor bill, or to confirm its totals before voiding. To search by date range use ListGoodsReceipt instead. BUSINESS RULES & PRE-CONDITIONS code is required. PEAK rejects lookup by id for goods receipts, and there is no reference lookup. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING An empty goodsReceipts array means either the code is wrong or the document has been voided — voided goods receipts are not returned at all. Confirm the code with the user rather than guessing a correction, and never fabricate document contents. EXPECTED OUTCOME Returns the document's id, code, issuedDate (yyyyMMdd), status, preTaxAmount, vatAmount, netAmount and whtAmount (THB) and line items (products). status here uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=IssuedInvoiceReceipt — already matched to a vendor bill). contactId is the vendor's UUID (match it against SearchContacts); the response has no contact name.
1 param
GetGoodsReceipt
WHEN TO USE Use to read ONE goods receipt (ใบรับสินค้า) whose document code you already have — to check whether it is still awaiting approval, already matched to a vendor bill, or to confirm its totals before voiding. To search by date range use ListGoodsReceipt instead. BUSINESS RULES & PRE-CONDITIONS code is required. PEAK rejects lookup by id for goods receipts, and there is no reference lookup. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING An empty goodsReceipts array means either the code is wrong or the document has been voided — voided goods receipts are not returned at all. Confirm the code with the user rather than guessing a correction, and never fabricate document contents. EXPECTED OUTCOME Returns the document's id, code, issuedDate (yyyyMMdd), status, preTaxAmount, vatAmount, netAmount and whtAmount (THB) and line items (products). status here uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=IssuedInvoiceReceipt — already matched to a vendor bill). contactId is the vendor's UUID (match it against SearchContacts); the response has no contact name.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | required | Document code of ONE goods receipt. Required. |
ListGoodsReceipt
WHEN TO USE Use to search goods receipts (ใบรับสินค้า) by date range — to find a document code or review recent deliveries from vendors. This tool returns a LIST; to read one document by code use GetGoodsReceipt. BUSINESS RULES & PRE-CONDITIONS Filters are fromDate / toDate (yyyyMMdd) only — there is no status, contact or keyword filter. fromDate must not be after toDate. Omitting both searches from 1900-01-01 to today. Paginate with limit (1–100, default 20) and page (starting at 1). Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the date window is wrong — adjust it before concluding a document doesn't exist. Voided goods receipts are never listed. A resCode 500 usually means a date was not in yyyyMMdd format. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching goods receipts with id, code, issuedDate, status and netAmount (THB) only — no preTax/VAT/WHT breakdown and no line items; read one with GetGoodsReceipt for those. status here is the RAW DATABASE scale (-2=Draft, -1=AwaitApproval, 0=Approved, 1=IssuedInvoiceReceipt), which is NOT the scale GetGoodsReceipt returns — never compare the two numbers or pass one where the other is expected.
0 required · 4 optional
ListGoodsReceipt
WHEN TO USE Use to search goods receipts (ใบรับสินค้า) by date range — to find a document code or review recent deliveries from vendors. This tool returns a LIST; to read one document by code use GetGoodsReceipt. BUSINESS RULES & PRE-CONDITIONS Filters are fromDate / toDate (yyyyMMdd) only — there is no status, contact or keyword filter. fromDate must not be after toDate. Omitting both searches from 1900-01-01 to today. Paginate with limit (1–100, default 20) and page (starting at 1). Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the date window is wrong — adjust it before concluding a document doesn't exist. Voided goods receipts are never listed. A resCode 500 usually means a date was not in yyyyMMdd format. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching goods receipts with id, code, issuedDate, status and netAmount (THB) only — no preTax/VAT/WHT breakdown and no line items; read one with GetGoodsReceipt for those. status here is the RAW DATABASE scale (-2=Draft, -1=AwaitApproval, 0=Approved, 1=IssuedInvoiceReceipt), which is NOT the scale GetGoodsReceipt returns — never compare the two numbers or pass one where the other is expected.
| Parameter | Type | Description | |
|---|---|---|---|
| fromDate | string | optional | Displays documents dated on or after this date (Format: yyyyMMdd). Default 19000101. |
| toDate | string | optional | Displays documents dated on or before this date (Format: yyyyMMdd). Default today. |
| limit | integer? | optional | Entries per page, 1–100. Default 20. |
| page | integer? | optional | Page number, starting at 1. |
VoidGoodsReceipt
WHEN TO USE Only when the user explicitly asks to cancel an existing goods receipt (ใบรับสินค้า). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. BUSINESS RULES & PRE-CONDITIONS Identify the document by code (required; PEAK does not accept an id here) — use GetGoodsReceipt or ListGoodsReceipt to look it up. The goods receipt is permanently cancelled and cannot be edited or reused afterwards. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, vendor and amount, and get explicit confirmation before calling. Nothing is changed if code is missing. Any resCode other than 200 means the goods receipt was NOT voided: report resDesc. Voiding a code that is already voided returns a generic resCode 500, not a clear not-found — before retrying a failed void, call GetGoodsReceipt: an empty result means it is already voided, so do not void again. EXPECTED OUTCOME Returns resCode 200. Afterwards the document no longer appears in GetGoodsReceipt or ListGoodsReceipt — that is expected, not a failure.
1 param
VoidGoodsReceipt
WHEN TO USE Only when the user explicitly asks to cancel an existing goods receipt (ใบรับสินค้า). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. BUSINESS RULES & PRE-CONDITIONS Identify the document by code (required; PEAK does not accept an id here) — use GetGoodsReceipt or ListGoodsReceipt to look it up. The goods receipt is permanently cancelled and cannot be edited or reused afterwards. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, vendor and amount, and get explicit confirmation before calling. Nothing is changed if code is missing. Any resCode other than 200 means the goods receipt was NOT voided: report resDesc. Voiding a code that is already voided returns a generic resCode 500, not a clear not-found — before retrying a failed void, call GetGoodsReceipt: an empty result means it is already voided, so do not void again. EXPECTED OUTCOME Returns resCode 200. Afterwards the document no longer appears in GetGoodsReceipt or ListGoodsReceipt — that is expected, not a failure.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | required | The code of the goods receipt to be voided. Required. |
InvoiceReceipt
4 tools
CreateInvoiceReceipt
WHEN TO USE Use when the business has RECEIVED a bill / invoice from a vendor and wants to record it as a payable (บันทึกรับเอกสารแจ้งหนี้, Invoice Receipt, IR). Despite the name this is a PURCHASE-side document: it is not a sales invoice (use CreateInvoice), not a sales receipt for money collected from a customer (use CreateReceipt), and not an expense that is already paid (use CreateExpense). BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve the vendor via SearchContacts → CreateContact if missing, and pass contactId or contactCode (if both are given only contactId is sent); (2) resolve each line item's productCode, or its accountCode via GetAccountCodes — never invent one. VAT logic (line-item vatType: 1 = None, 2 = ZeroPercent, 3 = SevenPercent). dueDate is required by PEAK; when omitted it defaults to issuedDate + 7 days — pass the due date printed on the vendor's bill whenever it is known. Purchase tax invoice: when the vendor's bill is also a tax invoice, pass receivedTaxInvoice with the number and dates exactly as printed and set isTaxInvoice=1; never invent a tax invoice number, and omit receivedTaxInvoice otherwise. status: 'Draft' keeps the document a Draft; any other value creates it as Outstanding (approved, awaiting payment). There is no way to create it Paid — this tool cannot record a payment. FALLBACK & ERROR HANDLING PEAK reports most business-rule failures (unknown contact, account or product code, unsupported discount, tax invoice period out of range, duplicate number) as a generic resCode 500 without the real reason: re-check each input against what you resolved, and ask the user rather than retrying blindly or changing values on your own. periodDate must be the taxInvoiceDate month or up to 6 months after it. EXPECTED OUTCOME Creates the document as Draft or Outstanding and returns its code (e.g. IR-20261000001; the format follows the company's numbering settings), id, status, amounts and line items. status uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=Outstanding, 6=Overdue, 7=Paid, 8=GotReceipt). Dates are yyyyMMdd; preTaxAmount, vatAmount, netAmount and whtAmount are in THB. contactId is the vendor's UUID — the response has no contact name, contact code or document link — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
1 required · 15 optional
CreateInvoiceReceipt
WHEN TO USE Use when the business has RECEIVED a bill / invoice from a vendor and wants to record it as a payable (บันทึกรับเอกสารแจ้งหนี้, Invoice Receipt, IR). Despite the name this is a PURCHASE-side document: it is not a sales invoice (use CreateInvoice), not a sales receipt for money collected from a customer (use CreateReceipt), and not an expense that is already paid (use CreateExpense). BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve the vendor via SearchContacts → CreateContact if missing, and pass contactId or contactCode (if both are given only contactId is sent); (2) resolve each line item's productCode, or its accountCode via GetAccountCodes — never invent one. VAT logic (line-item vatType: 1 = None, 2 = ZeroPercent, 3 = SevenPercent). dueDate is required by PEAK; when omitted it defaults to issuedDate + 7 days — pass the due date printed on the vendor's bill whenever it is known. Purchase tax invoice: when the vendor's bill is also a tax invoice, pass receivedTaxInvoice with the number and dates exactly as printed and set isTaxInvoice=1; never invent a tax invoice number, and omit receivedTaxInvoice otherwise. status: 'Draft' keeps the document a Draft; any other value creates it as Outstanding (approved, awaiting payment). There is no way to create it Paid — this tool cannot record a payment. FALLBACK & ERROR HANDLING PEAK reports most business-rule failures (unknown contact, account or product code, unsupported discount, tax invoice period out of range, duplicate number) as a generic resCode 500 without the real reason: re-check each input against what you resolved, and ask the user rather than retrying blindly or changing values on your own. periodDate must be the taxInvoiceDate month or up to 6 months after it. EXPECTED OUTCOME Creates the document as Draft or Outstanding and returns its code (e.g. IR-20261000001; the format follows the company's numbering settings), id, status, amounts and line items. status uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=Outstanding, 6=Overdue, 7=Paid, 8=GotReceipt). Dates are yyyyMMdd; preTaxAmount, vatAmount, netAmount and whtAmount are in THB. contactId is the vendor's UUID — the response has no contact name, contact code or document link — use the name you already resolved via SearchContacts; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services on the vendor's bill. array[InvoiceProduct] — line items. sub-fields: productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1=None,2=ZeroPercent,3=SevenPercent), withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the vendor contact. Pass this OR contactId — if both are given only contactId is sent. Use SearchContacts if not known | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier (UUID) of the vendor contact. Takes precedence over contactCode | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' keeps it a Draft; any other value creates it as Outstanding. Default 'Draft'. | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Issuance date (yyyyMMdd). Default today. | ||||||||||||||||||||||||||||
| dueDate | string | optional | Payment due date of the vendor's bill (yyyyMMdd). Must not be before issuedDate. Required by PEAK; default issuedDate + 7 days. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as the vendor's bill number or a purchase order. Max 32 characters. | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes. Leave blank to use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax). NonTax forces every line to vatType None. | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount for the document. Percentage discounts are refused when line items mix VAT types. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | The vendor's bill is also a tax invoice (0=No,1=Yes). Set 1 together with receivedTaxInvoice. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. Send together with exchangeRate. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. Required whenever currencyId is sent. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data (0 = status only, 1 = return the created document). Default 1. | ||||||||||||||||||||||||||||
| receivedTaxInvoice | ReceivedTaxInvoiceDetail | optional | Purchase tax invoice received from the vendor (ภาษีซื้อ). Send only when the vendor issued a tax invoice; omit the whole object otherwise. taxInvoiceNumber, taxInvoiceDate and journalDate are required (yyyyMMdd); periodDate is the optional VAT reporting month — it must be the taxInvoiceDate month or up to 6 months after it.ReceivedTaxInvoiceDetail fields
|
GetInvoiceReceipt
WHEN TO USE Use to read ONE invoice receipt (บันทึกรับเอกสารแจ้งหนี้, a vendor bill recorded as a payable) whose document code you already have — to check its status, due date or totals before voiding it. To search by date range use ListInvoiceReceipt instead. BUSINESS RULES & PRE-CONDITIONS code is required (e.g. "IR-20261000001"). PEAK does not support lookup by id or reference for invoice receipts. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING An empty invoiceReceipts array means either the code is wrong or the document has been voided — voided invoice receipts are not returned at all. Confirm the code with the user rather than guessing a correction, and never fabricate document contents. EXPECTED OUTCOME Returns the document's id, code, issuedDate, dueDate (yyyyMMdd), status, preTaxAmount, vatAmount, netAmount and whtAmount (THB), received tax invoice number and line items (products). status here uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=Outstanding, 6=Overdue, 7=Paid, 8=GotReceipt), which is NOT the scale ListInvoiceReceipt returns — never compare the two numbers. contactId is the vendor's UUID (match it against SearchContacts); the response has no contact name.
1 param
GetInvoiceReceipt
WHEN TO USE Use to read ONE invoice receipt (บันทึกรับเอกสารแจ้งหนี้, a vendor bill recorded as a payable) whose document code you already have — to check its status, due date or totals before voiding it. To search by date range use ListInvoiceReceipt instead. BUSINESS RULES & PRE-CONDITIONS code is required (e.g. "IR-20261000001"). PEAK does not support lookup by id or reference for invoice receipts. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING An empty invoiceReceipts array means either the code is wrong or the document has been voided — voided invoice receipts are not returned at all. Confirm the code with the user rather than guessing a correction, and never fabricate document contents. EXPECTED OUTCOME Returns the document's id, code, issuedDate, dueDate (yyyyMMdd), status, preTaxAmount, vatAmount, netAmount and whtAmount (THB), received tax invoice number and line items (products). status here uses the business scale (0=None, 1=Voided, 2=Draft, 3=AwaitApproval, 4=Approved, 5=Outstanding, 6=Overdue, 7=Paid, 8=GotReceipt), which is NOT the scale ListInvoiceReceipt returns — never compare the two numbers. contactId is the vendor's UUID (match it against SearchContacts); the response has no contact name.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | required | Document code of ONE invoice receipt (e.g. 'IR-20261000001'). Required. |
ListInvoiceReceipt
WHEN TO USE Use to search invoice receipts (บันทึกรับเอกสารแจ้งหนี้, vendor bills recorded as payables) by date range — to find a document code or review recent vendor bills. This tool returns a LIST; to read one document by code use GetInvoiceReceipt. BUSINESS RULES & PRE-CONDITIONS Filters are fromDate / toDate (yyyyMMdd) only — there is no status, contact or keyword filter. fromDate must not be after toDate. Omitting both searches from 1900-01-01 to today. Paginate with limit (1–100, default 20) and page (starting at 1). Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the date window is wrong — adjust it before concluding a document doesn't exist. Voided invoice receipts are never listed. A resCode 500 usually means a date was not in yyyyMMdd format. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching invoice receipts with id, code, issuedDate, dueDate, status and netAmount (THB) only — no preTax/VAT/WHT breakdown and no line items; read one with GetInvoiceReceipt for those. status here is the RAW DATABASE scale (-2=Draft, -1=AwaitApproval, 0=Approved, 1=OutstandingOrOverdue, 2=Paid, 3=GotReceipt), which is NOT the scale GetInvoiceReceipt returns — never compare the two numbers or pass one where the other is expected.
0 required · 4 optional
ListInvoiceReceipt
WHEN TO USE Use to search invoice receipts (บันทึกรับเอกสารแจ้งหนี้, vendor bills recorded as payables) by date range — to find a document code or review recent vendor bills. This tool returns a LIST; to read one document by code use GetInvoiceReceipt. BUSINESS RULES & PRE-CONDITIONS Filters are fromDate / toDate (yyyyMMdd) only — there is no status, contact or keyword filter. fromDate must not be after toDate. Omitting both searches from 1900-01-01 to today. Paginate with limit (1–100, default 20) and page (starting at 1). Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the date window is wrong — adjust it before concluding a document doesn't exist. Voided invoice receipts are never listed. A resCode 500 usually means a date was not in yyyyMMdd format. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching invoice receipts with id, code, issuedDate, dueDate, status and netAmount (THB) only — no preTax/VAT/WHT breakdown and no line items; read one with GetInvoiceReceipt for those. status here is the RAW DATABASE scale (-2=Draft, -1=AwaitApproval, 0=Approved, 1=OutstandingOrOverdue, 2=Paid, 3=GotReceipt), which is NOT the scale GetInvoiceReceipt returns — never compare the two numbers or pass one where the other is expected.
| Parameter | Type | Description | |
|---|---|---|---|
| fromDate | string | optional | Displays documents dated on or after this date (Format: yyyyMMdd). Default 19000101. |
| toDate | string | optional | Displays documents dated on or before this date (Format: yyyyMMdd). Default today. |
| limit | integer? | optional | Entries per page, 1–100. Default 20. |
| page | integer? | optional | Page number, starting at 1. |
VoidInvoiceReceipt
WHEN TO USE Only when the user explicitly asks to cancel an existing invoice receipt (บันทึกรับเอกสารแจ้งหนี้). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. BUSINESS RULES & PRE-CONDITIONS Identify the document by code (required; PEAK does not accept an id here) — use GetInvoiceReceipt or ListInvoiceReceipt to look it up. The invoice receipt is permanently cancelled and cannot be edited or reused afterwards. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, vendor and amount, and get explicit confirmation before calling. Nothing is changed if code is missing. Any resCode other than 200 means the invoice receipt was NOT voided: report resDesc. Voiding a code that is already voided returns a generic resCode 500, not a clear not-found — before retrying a failed void, call GetInvoiceReceipt: an empty result means it is already voided, so do not void again. EXPECTED OUTCOME Returns resCode 200. Afterwards the document no longer appears in GetInvoiceReceipt or ListInvoiceReceipt — that is expected, not a failure.
1 param
VoidInvoiceReceipt
WHEN TO USE Only when the user explicitly asks to cancel an existing invoice receipt (บันทึกรับเอกสารแจ้งหนี้). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. BUSINESS RULES & PRE-CONDITIONS Identify the document by code (required; PEAK does not accept an id here) — use GetInvoiceReceipt or ListInvoiceReceipt to look it up. The invoice receipt is permanently cancelled and cannot be edited or reused afterwards. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, vendor and amount, and get explicit confirmation before calling. Nothing is changed if code is missing. Any resCode other than 200 means the invoice receipt was NOT voided: report resDesc. Voiding a code that is already voided returns a generic resCode 500, not a clear not-found — before retrying a failed void, call GetInvoiceReceipt: an empty result means it is already voided, so do not void again. EXPECTED OUTCOME Returns resCode 200. Afterwards the document no longer appears in GetInvoiceReceipt or ListInvoiceReceipt — that is expected, not a failure.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | required | The code of the invoice receipt to be voided (e.g. 'IR-20261000001'). Required. |
Invoice
9 tools
CreateInvoice
WHEN TO USE Use when the input describes a sale to a customer that needs a formal bill invoice ใบแจ้งหนี้ or Tax Invoice— either as a standalone invoice BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) For line items: if `use_product_code = true`, try ListProduct per item and use `productCode` on a match; fall back to `accountCode` per item if no match — never send both on the same line item. VAT logic: if organization is not registered VAT isTaxInvoice = 0 is Tax Invoice + VAT ExcludeTax → `isTaxInvoice=1, taxStatus=0; is Tax Invoice + VAT IncludeTax→ `isTaxInvoice=1, taxStatus=1; is not tax invoice at all → `isTaxInvoice=0, taxStatus=2; Do not use `taxStatus=2` (NonTax) for no-VAT items — some environments compute total as 0. If payment happens at issuance, include paymentMethodCode + paymentAmount in the same call rather than a separate step FALLBACK & ERROR HANDLING `"Should be paid full amount"` → WHT present but paymentAmount wasn't reduced; recompute `paymentAmount = netAmount − withHoldingTaxAmount`. `"Invoice net amount less than payment"` → paymentAmount + WHT exceeds netAmount; re-check the formula. `"Bank Account not found"` → payment method code wrong or points to a Cheque-type account; re-fetch via GetPaymentMethod or use `paymentMethodId`. Product-related error → fall back to accountCode and confirm with the user before retrying. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
1 required · 28 optional
CreateInvoice
WHEN TO USE Use when the input describes a sale to a customer that needs a formal bill invoice ใบแจ้งหนี้ or Tax Invoice— either as a standalone invoice BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) For line items: if `use_product_code = true`, try ListProduct per item and use `productCode` on a match; fall back to `accountCode` per item if no match — never send both on the same line item. VAT logic: if organization is not registered VAT isTaxInvoice = 0 is Tax Invoice + VAT ExcludeTax → `isTaxInvoice=1, taxStatus=0; is Tax Invoice + VAT IncludeTax→ `isTaxInvoice=1, taxStatus=1; is not tax invoice at all → `isTaxInvoice=0, taxStatus=2; Do not use `taxStatus=2` (NonTax) for no-VAT items — some environments compute total as 0. If payment happens at issuance, include paymentMethodCode + paymentAmount in the same call rather than a separate step FALLBACK & ERROR HANDLING `"Should be paid full amount"` → WHT present but paymentAmount wasn't reduced; recompute `paymentAmount = netAmount − withHoldingTaxAmount`. `"Invoice net amount less than payment"` → paymentAmount + WHT exceeds netAmount; re-check the formula. `"Bank Account not found"` → payment method code wrong or points to a Cheque-type account; re-fetch via GetPaymentMethod or use `paymentMethodId`. Product-related error → fall back to accountCode and confirm with the user before retrying. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakInvoices": {
"resCode": "200",
"resDesc": "Success",
"invoices": [{
"id": "guid",
"code": "INV20240001",
"status": "Draft",
"issuedDate": "20240101",
"dueDate": "20240108",
"preTaxAmount": 1000.00,
"vatAmount": 70.00,
"netAmount": 1070.00
}]
}
}
GetInvoice
WHEN TO USE Use to read ONE invoice (ใบแจ้งหนี้) you already have an identifier for — typically to check its remainAmount, verify it is Approved before a Receipt is issued against it, or read its full line items before EditInvoice. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListInvoice instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "IVS202308020"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching invoice with status (Draft/Approve/Voided), document number, netAmount and remainAmount, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetInvoice
WHEN TO USE Use to read ONE invoice (ใบแจ้งหนี้) you already have an identifier for — typically to check its remainAmount, verify it is Approved before a Receipt is issued against it, or read its full line items before EditInvoice. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListInvoice instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "IVS202308020"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching invoice with status (Draft/Approve/Voided), document number, netAmount and remainAmount, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'IVS202308020'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakInvoices": {
"resCode": "200",
"resDesc": "PeakInvoices have Completed",
"totalInvoice": 1,
"invoices": [{
"id": "77dd1ceb-a0f6-44bb-ae9c-525cc8026b34",
"code": "IVS202308020",
"issuedDate": "20230815",
"dueDate": "20230822",
"contactId": "guid",
"contactCode": "C01401",
"status": "Approve",
"isTaxInvoice": 0,
"preTaxAmount": 300,
"vatAmount": 21,
"netAmount": 321,
"whtAmount": 0,
"paymentAmount": 321,
"remainAmount": 0,
"remainWhtAmount": 0,
"documentLink": "https://...",
"remark": "...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "P001", "accountCode": "410101", "description": "...", "quantity": 1, "price": 300, "vatType": 3 }],
"paidPayments": [{ "paymentDate": "20230815", "paymentTotal": 321, "payments": [{ "paymentMethodCode": "CSH260", "amount": 321 }], "journals": [{ "id": "guid", "code": "RV-..." }] }],
"journals": [{ "id": "guid", "code": "SV-..." }]
}]
}
}
ListInvoice
WHEN TO USE Use to search invoices (ใบแจ้งหนี้) by date range, status, or keyword — to find a document code, review outstanding/overdue invoices, or list recent activity. This tool returns a filtered LIST; it does not read one document by exact id/code/reference. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching invoices with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListInvoice
WHEN TO USE Use to search invoices (ใบแจ้งหนี้) by date range, status, or keyword — to find a document code, review outstanding/overdue invoices, or list recent activity. This tool returns a filtered LIST; it does not read one document by exact id/code/reference. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching invoices with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Displays documents starting from the specified date (Format: yyyyMMdd). |
| dateEnd | string | optional | Displays documents ending on the specified date (Format: yyyyMMdd). |
| status | integer? | optional | Document status (0=None,1=Voided,2=Draft,3=AwaitApproval,4=Outstanding,5=Overdue,6=PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakInvoices": {
"resCode": "200",
"resDesc": "PeakInvoices have Completed",
"totalInvoice": 1,
"invoices": [{
"id": "77dd1ceb-a0f6-44bb-ae9c-525cc8026b34",
"code": "IVS202308020",
"issuedDate": "20230815",
"contactId": "guid",
"contactCode": "C01401",
"status": "Approve",
"isTaxInvoice": 0,
"netAmount": 321,
"remainAmount": 0,
"documentLink": "https://..."
}]
}
}
EditInvoice
WHEN TO USE Call when the user wants to change an existing Draft invoice (ใบแจ้งหนี้) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidInvoice; to move it out of Draft use ApproveInvoice. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetInvoice to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. If withholding tax applies, send it at both levels: paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item (there is no document-level withholding-tax field). FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the invoice was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
4 required · 27 optional
EditInvoice
WHEN TO USE Call when the user wants to change an existing Draft invoice (ใบแจ้งหนี้) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidInvoice; to move it out of Draft use ApproveInvoice. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetInvoice to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. If withholding tax applies, send it at both levels: paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item (there is no document-level withholding-tax field). FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the invoice was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | The COMPLETE array of products or services for the document. Any existing line omitted here is permanently deleted — copy the full list from GetInvoice and modify it. array[InvoiceProduct] — sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| issuedDate | string | required | Document issuance date (yyyyMMdd). REQUIRED on edit: copy the existing value from GetInvoice unless you intend to change it, otherwise the document date would be overwritten | ||||||||||||||||||||||||||||
| dueDate | string | required | Document due date (yyyyMMdd), which must be after the document issuance date. REQUIRED on edit: copy the existing value from GetInvoice | ||||||||||||||||||||||||||||
| status | string | required | Status of the document (Draft, Approve, Voided, etc). REQUIRED on edit: copy the existing value from GetInvoice so the edit does not change the document state | ||||||||||||||||||||||||||||
| code | string | optional | The code of the invoice to be edited. Recommended over id: it also preserves the document number | ||||||||||||||||||||||||||||
| id | string | optional | The Unique Identifier of the invoice to be edited. Use only when the code is unknown | ||||||||||||||||||||||||||||
| newCode | string | optional | New document number to write into the edited document. Leave blank to keep the existing document number. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact associated with the document | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact associated with the document (If contactId has been assigned a value, contactCode is not required) | ||||||||||||||||||||||||||||
| reference | string | optional | Reference information of the document | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Specify the tax status of the document to indicate whether the price includes tax or the tax is separate (0 = ExcludeTax, 1 = IncludeTax, 2 = NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | The total discount should not exceed the net total of the document or be greater than 100%. Additionally, it can only be applied when the tax type of each item is the same | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Whether the document can be used as a tax invoice (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Label attached to someone or something for the purpose of identification or to give other information | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax is applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | Tax collected from the increased value of products or services (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Total value of the document after tax and discounts have been applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency transactions | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency transactions | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Include the existing payment details when editing a document that already has a payment recorded. | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | The Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date in the format yyyyMMdd | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Payment account code. | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub account Unique Identifier to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Additional remarks or notes for that specific payment received | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Whether this payment is made by Cheque (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | Withholding tax amount for the payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakInvoices": {
"resCode": "200",
"resDesc": "Completed",
"totalInvoice": 1,
"invoices": [{
"id": "guid",
"code": "IVS202308020",
"issuedDate": "20230815",
"dueDate": "20230822",
"contactId": "guid",
"contactCode": "C01401",
"status": "Draft",
"isTaxInvoice": 0,
"preTaxAmount": 300,
"vatAmount": 21,
"netAmount": 321,
"whtAmount": 0,
"paymentAmount": 0,
"remainAmount": 321,
"remainWhtAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "P001", "accountCode": "410101", "description": "...", "quantity": 1, "price": 300, "vatType": 3 }],
"paidPayments": [],
"journals": [],
"resCode": "200",
"resDesc": "Success"
}]
}
}
ApproveInvoice
WHEN TO USE Call when the user asks to approve or confirm a Draft invoice (ใบแจ้งหนี้) — the step that turns a Draft into a live accounting document. An invoice must be Approved before a Receipt can be issued against it. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetInvoice to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditInvoice first — an approved invoice can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the invoice was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
ApproveInvoice
WHEN TO USE Call when the user asks to approve or confirm a Draft invoice (ใบแจ้งหนี้) — the step that turns a Draft into a live accounting document. An invoice must be Approved before a Receipt can be issued against it. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetInvoice to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditInvoice first — an approved invoice can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the invoice was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the invoice to be approved |
| id | string | optional | The Unique Identifier of the invoice to be approved |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidInvoice
WHEN TO USE Only when the user explicitly asks to cancel an existing invoice (ใบแจ้งหนี้). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditInvoice instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetInvoice to look it up. The invoice is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference (attached credit notes, billing notes or debit notes) — void those referencing documents first. If the invoice has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the invoice was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 3 optional
VoidInvoice
WHEN TO USE Only when the user explicitly asks to cancel an existing invoice (ใบแจ้งหนี้). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditInvoice instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetInvoice to look it up. The invoice is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference (attached credit notes, billing notes or debit notes) — void those referencing documents first. If the invoice has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the invoice was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the invoice to be voided |
| id | string | optional | The Unique Identifier of the invoice to be voided |
| isVoidETaxInvoice | integer | optional | Set to 1 ONLY to void a document that has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt. Default 0 refuses the void in that case, which is the safe behaviour. Voiding an already-filed e-Tax document is a compliance action and cannot be undone (0 = refuse if already sent as e-Tax, 1 = void anyway) |
Response
{ "resCode": "200", "resDesc": "Success" }
RecordInvoicePayment
WHEN TO USE Use when the user says a customer has paid against an existing invoice (ใบแจ้งหนี้), in full or in part (รับชำระ). Do not use it to create a new invoice that is paid at issuance (put the payment fields on CreateInvoice), and not to issue a receipt document (use CreateReceipt). BUSINESS RULES & PRE-CONDITIONS Identify the invoice with code or id, exactly one of the two. Use GetInvoice to look it up. The invoice must be Approved and still awaiting payment. PEAK refuses Draft, voided and fully paid invoices. paymentDate (yyyyMMdd) is required: ask the user when the money arrived if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. paymentAmount plus any withHoldingTaxAmount must not exceed what is still owed (remainAmount on GetInvoice). withHoldingTaxAmount is the tax the customer withheld, either an amount ("30") or a percentage ("3%"). FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the invoice number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or "Invoice net amount less than payment" means the amount is more than what is still owed. "Transaction must be Waiting Payment Status." means the invoice is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. Report the invoice number, the amount received and what is still outstanding. Keep paidPayments.journals[].code (e.g. RV-202610004): VoidInvoicePayment needs it to cancel this payment.
0 required · 8 optional
RecordInvoicePayment
WHEN TO USE Use when the user says a customer has paid against an existing invoice (ใบแจ้งหนี้), in full or in part (รับชำระ). Do not use it to create a new invoice that is paid at issuance (put the payment fields on CreateInvoice), and not to issue a receipt document (use CreateReceipt). BUSINESS RULES & PRE-CONDITIONS Identify the invoice with code or id, exactly one of the two. Use GetInvoice to look it up. The invoice must be Approved and still awaiting payment. PEAK refuses Draft, voided and fully paid invoices. paymentDate (yyyyMMdd) is required: ask the user when the money arrived if they did not say, and never assume today. Send one payment line per call: paymentAmount plus paymentMethodCode or paymentMethodId (not both). Resolve the method with GetPaymentMethod. paymentAmount plus any withHoldingTaxAmount must not exceed what is still owed (remainAmount on GetInvoice). withHoldingTaxAmount is the tax the customer withheld, either an amount ("30") or a percentage ("3%"). FALLBACK & ERROR HANDLING This posts a journal entry. Show the user the invoice number, amount, date and payment method, and get confirmation before calling. Nothing is recorded if a required input is missing or invalid. Any resCode other than 200 means the payment was NOT recorded, so report resDesc. "Over paid payment" or "Invoice net amount less than payment" means the amount is more than what is still owed. "Transaction must be Waiting Payment Status." means the invoice is not approved or is already paid. EXPECTED OUTCOME Returns the recorded payment (paymentDate, paymentTotal, payments, journals), paymentAmount, remainPaymentAmount and remainWhtAmount. Report the invoice number, the amount received and what is still outstanding. Keep paidPayments.journals[].code (e.g. RV-202610004): VoidInvoicePayment needs it to cancel this payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the invoice that was paid (e.g. 'IV-20261000002'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the invoice that was paid. Provide this or code, not both |
| paymentDate | string | optional | Required. The date the money was received, format yyyyMMdd (e.g. '20261014') |
| paymentAmount | number? | optional | Required. The amount received in this payment, excluding withholding tax |
| paymentMethodCode | string | optional | Code of the payment method the money came in through (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | The Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Withholding tax the customer deducted, as an amount (e.g. '30') or a percentage (e.g. '3%'). Omit when none was withheld |
| note | string | optional | Optional note for this payment |
VoidInvoicePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการรับชำระ) a payment already recorded on an invoice, for example one entered by mistake. This does not void the invoice itself (use VoidInvoice for that). BUSINESS RULES & PRE-CONDITIONS Identify the invoice with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. RV-202610004). RecordInvoicePayment returns it, and GetInvoice lists it under paidPayments[].journals[].code. When the invoice has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the invoice first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the invoice, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetInvoice and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The invoice's outstanding amount goes up by that amount, and GetInvoice no longer lists the payment.
0 required · 3 optional
VoidInvoicePayment
WHEN TO USE Only when the user explicitly asks to cancel (ยกเลิกการรับชำระ) a payment already recorded on an invoice, for example one entered by mistake. This does not void the invoice itself (use VoidInvoice for that). BUSINESS RULES & PRE-CONDITIONS Identify the invoice with code or id, exactly one of the two. Identify the payment with paymentJournalCode: the code of that payment's journal (e.g. RV-202610004). RecordInvoicePayment returns it, and GetInvoice lists it under paidPayments[].journals[].code. When the invoice has several payments, show them (date, amount, journal code) and let the user choose. The tool reads the invoice first and voids only the payment that carries that journal code. Never pass a paymentGroupId instead: it is only the row's current position and shifts after every void. PEAK refuses to void a payment that already has a receipt issued against it, or one with withholding-tax (PND) filings. FALLBACK & ERROR HANDLING This reverses an accounting entry. Get explicit confirmation of the payment's date and amount before calling. If the journal code is not on the invoice, the payment was already voided or belongs to another document. Nothing is changed in that case: call GetInvoice and re-check rather than guessing. Any resCode other than 200 means the payment was NOT voided, so report resDesc. EXPECTED OUTCOME Returns resCode and resDesc with the voided payment's journal code, date and amount. The invoice's outstanding amount goes up by that amount, and GetInvoice no longer lists the payment.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the invoice the payment belongs to (e.g. 'IV-20261000002'). Provide this or id, not both |
| id | string | optional | The Unique Identifier of the invoice the payment belongs to. Provide this or code, not both |
| paymentJournalCode | string | optional | Required. Journal code of the payment to cancel (e.g. 'RV-202610004'), from RecordInvoicePayment or GetInvoice paidPayments[].journals[].code |
Response
{
"resCode": "200",
"resDesc": "Completed",
"transactionCode": "C001",
"paymentJournalCode": "C001",
"paymentDate": "2026-01-01",
"paymentTotal": 0
}
CreateInvoiceFromQuotation
WHEN TO USE Use when the customer has accepted a quotation (ใบเสนอราคา) and the user wants to turn it into an invoice (แปลงเป็นใบแจ้งหนี้ / สร้างใบแจ้งหนี้ต่อจากใบเสนอราคา). Prefer this over CreateInvoice whenever a quotation exists: PEAK copies the contact, product lines, prices, discounts, VAT and withholding tax from the quotation and links the two documents. Use CreateInvoice only when there is no quotation. BUSINESS RULES & PRE-CONDITIONS Identify the quotation with quotationCode or quotationId, exactly one of the two (use GetQuotation or ListQuotation to find it). issuedDate and dueDate (yyyyMMdd) are required; ask the user if they did not say, and dueDate must not be before issuedDate. The contact and items cannot be changed here; if the user wants different items, use CreateInvoice instead. The quotation must be approved: a draft or voided quotation is refused ("Quotation not Approved"). A quotation still awaiting the customer's response, or expired, is automatically marked as accepted by this call, even when the invoice is created as a draft. status defaults to Draft (the invoice can still be edited); pass Approve only when the user asks for an approved invoice. You may record one payment received at the same time (paymentDate, paymentAmount, paymentMethodCode or paymentMethodId, optional withHoldingTaxAmount and paymentNote); this needs status Approve, and the amount must not exceed the invoice's net total. FALLBACK & ERROR HANDLING Nothing is created if an input is missing or invalid. Any resCode other than 200 means the invoice was NOT created, so report resDesc as it is. If the quotation was already converted, PEAK refuses it; tell the user and show the existing invoice rather than retrying. When a payment was included and the call fails, check with GetQuotation / ListInvoice whether an invoice was created before trying again. EXPECTED OUTCOME Returns the new invoice (id, code, status, netAmount, remainAmount, documentLink, paidPayments). Report the invoice number, the amount and the status, and that it was created from the quotation.
0 required · 16 optional
CreateInvoiceFromQuotation
WHEN TO USE Use when the customer has accepted a quotation (ใบเสนอราคา) and the user wants to turn it into an invoice (แปลงเป็นใบแจ้งหนี้ / สร้างใบแจ้งหนี้ต่อจากใบเสนอราคา). Prefer this over CreateInvoice whenever a quotation exists: PEAK copies the contact, product lines, prices, discounts, VAT and withholding tax from the quotation and links the two documents. Use CreateInvoice only when there is no quotation. BUSINESS RULES & PRE-CONDITIONS Identify the quotation with quotationCode or quotationId, exactly one of the two (use GetQuotation or ListQuotation to find it). issuedDate and dueDate (yyyyMMdd) are required; ask the user if they did not say, and dueDate must not be before issuedDate. The contact and items cannot be changed here; if the user wants different items, use CreateInvoice instead. The quotation must be approved: a draft or voided quotation is refused ("Quotation not Approved"). A quotation still awaiting the customer's response, or expired, is automatically marked as accepted by this call, even when the invoice is created as a draft. status defaults to Draft (the invoice can still be edited); pass Approve only when the user asks for an approved invoice. You may record one payment received at the same time (paymentDate, paymentAmount, paymentMethodCode or paymentMethodId, optional withHoldingTaxAmount and paymentNote); this needs status Approve, and the amount must not exceed the invoice's net total. FALLBACK & ERROR HANDLING Nothing is created if an input is missing or invalid. Any resCode other than 200 means the invoice was NOT created, so report resDesc as it is. If the quotation was already converted, PEAK refuses it; tell the user and show the existing invoice rather than retrying. When a payment was included and the call fails, check with GetQuotation / ListInvoice whether an invoice was created before trying again. EXPECTED OUTCOME Returns the new invoice (id, code, status, netAmount, remainAmount, documentLink, paidPayments). Report the invoice number, the amount and the status, and that it was created from the quotation.
| Parameter | Type | Description | |
|---|---|---|---|
| quotationCode | string | optional | Code of the source quotation (e.g. 'QT-20261000003'). Provide this or quotationId, not both |
| quotationId | string | optional | The Unique Identifier of the source quotation. Provide this or quotationCode, not both |
| issuedDate | string | optional | Required. Issue date of the new invoice, format yyyyMMdd (e.g. '20261019') |
| dueDate | string | optional | Required. Due date of the new invoice, format yyyyMMdd, not before issuedDate |
| status | string | optional | 'Draft' (default, can still be edited) or 'Approve' |
| code | string | optional | Invoice number to use. Auto-generated if blank |
| reference | string | optional | Reference text, at most 32 characters. Defaults to the quotation number |
| remark | string | optional | Remark on the invoice, at most 1000 characters |
| isTaxInvoice | integer? | optional | Usable as a tax invoice (0 = No, 1 = Yes) |
| tags | array[String] | optional | Tags to attach, at most 10 |
| paymentDate | string | optional | Only when a payment was received at the same time: the date the money arrived, format yyyyMMdd. Needs status Approve |
| paymentAmount | number? | optional | Only with a payment: the amount received, excluding withholding tax; must not exceed the invoice's net total |
| paymentMethodCode | string | optional | Only with a payment: code of the payment method (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | Only with a payment: the Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Only with a payment: withholding tax the customer deducted, as an amount (e.g. '30') or a percentage (e.g. '3%') |
| paymentNote | string | optional | Only with a payment: note for that payment |
PaymentMethod
2 tools
GetPaymentMethod
WHEN TO USE Call whenever the source input specifies how payment was made (cash, bank transfer, named bank account) and the document being created will include `paymentMethodCode`/`paymentAmount`. Call `code` filter if you already have a candidate code from business-profile.md; call with no filter to list all if you need the user to choose. BUSINESS RULES & PRE-CONDITIONS If business-profile.md already lists this business's common payment methods (code + name + bank), match against that list first instead of listing all payment methods in the account, which can number in the hundreds. FALLBACK & ERROR HANDLING No exact match → return the list and ask the user to pick, don't guess by partial name similarity. If a downstream document-creation call later errors with "Bank Account not found," it usually means the code refers to a Cheque-type account — retry using `paymentMethodId` instead of `paymentMethodCode`, or ask the user to confirm the account type in PEAK. EXPECTED OUTCOME Returns `id`, `code`, `name`, `type` (1=Cash, 2=BankAccount, 3=CreditCard, 4=EWallet), `bankName`, `accountNumber`. Use `code` in the document's `paymentMethodCode` field.
0 required · 5 optional
GetPaymentMethod
WHEN TO USE Call whenever the source input specifies how payment was made (cash, bank transfer, named bank account) and the document being created will include `paymentMethodCode`/`paymentAmount`. Call `code` filter if you already have a candidate code from business-profile.md; call with no filter to list all if you need the user to choose. BUSINESS RULES & PRE-CONDITIONS If business-profile.md already lists this business's common payment methods (code + name + bank), match against that list first instead of listing all payment methods in the account, which can number in the hundreds. FALLBACK & ERROR HANDLING No exact match → return the list and ask the user to pick, don't guess by partial name similarity. If a downstream document-creation call later errors with "Bank Account not found," it usually means the code refers to a Cheque-type account — retry using `paymentMethodId` instead of `paymentMethodCode`, or ask the user to confirm the account type in PEAK. EXPECTED OUTCOME Returns `id`, `code`, `name`, `type` (1=Cash, 2=BankAccount, 3=CreditCard, 4=EWallet), `bankName`, `accountNumber`. Use `code` in the document's `paymentMethodCode` field.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Code displayed in PEAK. Auto-generated if blank |
| id | string | optional | Unique Identifier generated by PEAK |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakPaymentMethods": {
"paymentMethods": [
{
"id": "c7fb1bae-ff40-4856-9214-b4e30719f233",
"code": "BSV015",
"name": "TEST GS BANK",
"type": 2,
"memo": "test quick add",
"carringBalanceValue": 5000,
"bankId": 18,
"bankName": "ธนาคารออมสิน",
"accountType": 2,
"accountNumber": "888-999-450",
"isHaveCheque": 1,
"resCode": "200",
"resDesc": "Success"
}
],
"totalPaymentMethod": 973,
"resDesc": "PeakPaymentMethods have Completed",
"resCode": "200"
}
}
CreatePaymentMethod
WHEN TO USE Only when `GetPaymentMethod` confirms the business's stated payment channel (a specific bank account, cash method, etc.) genuinely doesn't exist yet in PEAK — typically only during first-time setup (`/skill.PEAK Start`), rarely mid-workflow. BUSINESS RULES & PRE-CONDITIONS `type` determines which other fields become effectively required: type=2 (BankAccount) needs `bankId` + `accountNumber`; type=4 (EWallet) needs `eWalletId` + `accountCode`; type=0 (Others) needs `bankName`. Don't submit a bank account without a `bankId` — PEAK will reject or mis-file it. FALLBACK & ERROR HANDLING If the user only gave a partial description of the account (e.g. "our Krungsri account" without the number), ask for the missing number rather than submitting an incomplete bank account. EXPECTED OUTCOME Returns the new `code` — usable immediately in Expense/Invoice/Receipt `paymentMethodCode`.
2 required · 11 optional
CreatePaymentMethod
WHEN TO USE Only when `GetPaymentMethod` confirms the business's stated payment channel (a specific bank account, cash method, etc.) genuinely doesn't exist yet in PEAK — typically only during first-time setup (`/skill.PEAK Start`), rarely mid-workflow. BUSINESS RULES & PRE-CONDITIONS `type` determines which other fields become effectively required: type=2 (BankAccount) needs `bankId` + `accountNumber`; type=4 (EWallet) needs `eWalletId` + `accountCode`; type=0 (Others) needs `bankName`. Don't submit a bank account without a `bankId` — PEAK will reject or mis-file it. FALLBACK & ERROR HANDLING If the user only gave a partial description of the account (e.g. "our Krungsri account" without the number), ask for the missing number rather than submitting an incomplete bank account. EXPECTED OUTCOME Returns the new `code` — usable immediately in Expense/Invoice/Receipt `paymentMethodCode`.
| Parameter | Type | Description | |
|---|---|---|---|
| name | string | required | Payment method name default use merchant name |
| type | integer | required | Type (0=Others,1=Cash,2=BankAccount,3=CreditCard,4=eWallet) |
| id | string | optional | Unique Identifier generated by PEAK |
| code | string | optional | Code displayed in PEAK. Auto-generated if blank |
| memo | string | optional | Additional notes |
| carringBalanceValue | integer? | optional | Carrying balance value |
| bankId | integer? | optional | Financial institution code (if type=2, bankId required) |
| eWalletId | integer? | optional | E-Wallet identifier (if type=4, accountCode required) |
| bankName | string | optional | Bank name not in system (if bankID=0, bankName required) |
| accountType | integer? | optional | Bank account type (1=Current,2=Savings,3=FixedDeposit) |
| accountNumber | string | optional | Bank account number |
| isHaveCheque | integer? | optional | Can issue cheques (0=No,1=Yes) |
| accountCode | string | optional | Account to record E-Wallet transactions Leave blank to automatically use the default value. (if type=4, required) |
Response
{
"PeakPaymentMethods": {
"paymentMethods": [
{
"id": "9c6a2aab-0d03-4e65-92fe-fdad517daa69",
"code": "BSV290",
"name": "Payment method's name",
"type": 2,
"carringBalanceValue": 125632,
"bankId": 10,
"bankName": "ธนาคารทิสโก้ จำกัด (มหาชน)",
"accountType": 2,
"accountNumber": "3011199912123",
"isHaveCheque": 1,
"resCode": "200",
"resDesc": "Success"
}
],
"resDesc": "PeakPaymentMethods have Completed",
"resCode": "200"
}
}
Product
4 tools
ListProduct
WHEN TO USE Call once per distinct line-item name whenever the business profile has `use_product_code = true` AND the document being created is NOT an Expense. Never call for Expense documents — Expense always uses `accountCode`, no exceptions. BUSINESS RULES & PRE-CONDITIONS Never assume a line-item description in the source input matches a `productCode` in PEAK — always search first, even if the name looks obviously identical. Search by `searchText` keyword per item, not once for the whole document. Returns products (สินค้า) only — services (บริการ) live in a separate catalog; search them with ListService. To read one product you already have a code or id for, use GetProduct. FALLBACK & ERROR HANDLING Zero matches → do not block the document; fall back to `accountCode` for that line item and mark it ⚠️ in the confirmation preview so the user can correct it. Multiple matches → show the list, let the user choose; do not auto-pick the first result. EXPECTED OUTCOME Returns `productId`, `productCode`, `name`, `price`, `vatType`, `unit` for each match — `productCode` goes directly into the line item; `accountCode` is not needed alongside it. totalProduct is PEAK's count of the whole catalog (products and services together), not the number of matches or of products — never report it as either.
0 required · 4 optional
ListProduct
WHEN TO USE Call once per distinct line-item name whenever the business profile has `use_product_code = true` AND the document being created is NOT an Expense. Never call for Expense documents — Expense always uses `accountCode`, no exceptions. BUSINESS RULES & PRE-CONDITIONS Never assume a line-item description in the source input matches a `productCode` in PEAK — always search first, even if the name looks obviously identical. Search by `searchText` keyword per item, not once for the whole document. Returns products (สินค้า) only — services (บริการ) live in a separate catalog; search them with ListService. To read one product you already have a code or id for, use GetProduct. FALLBACK & ERROR HANDLING Zero matches → do not block the document; fall back to `accountCode` for that line item and mark it ⚠️ in the confirmation preview so the user can correct it. Multiple matches → show the list, let the user choose; do not auto-pick the first result. EXPECTED OUTCOME Returns `productId`, `productCode`, `name`, `price`, `vatType`, `unit` for each match — `productCode` goes directly into the line item; `accountCode` is not needed alongside it. totalProduct is PEAK's count of the whole catalog (products and services together), not the number of matches or of products — never report it as either.
| Parameter | Type | Description | |
|---|---|---|---|
| year | string | optional | Filter by year (e.g. '2024'). |
| searchText | string | optional | Search keyword - product name, product code, SKU |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakProducts": {
"resCode": "200",
"resDesc": "Success",
"totalProduct": 1,
"products": [{
"id": "guid",
"code": "P001",
"name": "Product Name",
"type": 1,
"sellValue": 100.00,
"sellVatType": 3,
"sellAccount": "410101",
"purchaseValue": 80.00,
"purchaseVatType": 3,
"purchaseAccount": "510101"
}]
}
}
CreateProduct
WHEN TO USE Only after ListProduct confirms zero matches for this item, and only when the business actually uses product codes (use_product_code = true). This tool always creates a Product (สินค้า); for a non-stocked service (บริการ) — consulting, maintenance, subscriptions, fees — use CreateService instead. BUSINESS RULES & PRE-CONDITIONS name is the only required field, but set sellAccount (for sale-side items) or purchaseAccount (for purchase-side items) so future documents auto-map correctly — otherwise every future invoice using this product will need manual account selection. Match sellVatType/purchaseVatType to how the business actually prices (7% is the Thai default; use 1=None only for genuinely VAT-exempt items) FALLBACK & ERROR HANDLING If price is unknown from the source document, do not fabricate a value — leave sellValue/purchaseValue unset and flag to the user rather than guessing EXPECTED OUTCOME Returns productId — reference this in the current document's line item as productCode, not accountCode.
1 required · 15 optional
CreateProduct
WHEN TO USE Only after ListProduct confirms zero matches for this item, and only when the business actually uses product codes (use_product_code = true). This tool always creates a Product (สินค้า); for a non-stocked service (บริการ) — consulting, maintenance, subscriptions, fees — use CreateService instead. BUSINESS RULES & PRE-CONDITIONS name is the only required field, but set sellAccount (for sale-side items) or purchaseAccount (for purchase-side items) so future documents auto-map correctly — otherwise every future invoice using this product will need manual account selection. Match sellVatType/purchaseVatType to how the business actually prices (7% is the Thai default; use 1=None only for genuinely VAT-exempt items) FALLBACK & ERROR HANDLING If price is unknown from the source document, do not fabricate a value — leave sellValue/purchaseValue unset and flag to the user rather than guessing EXPECTED OUTCOME Returns productId — reference this in the current document's line item as productCode, not accountCode.
| Parameter | Type | Description | |
|---|---|---|---|
| name | string | required | Product name. |
| code | string | optional | Code displayed in PEAK. Auto-generated if blank |
| description | string | optional | Additional description of the product. |
| sellValue | number | optional | Selling price per unit. |
| sellVatType | integer | optional | Selling tax rate (VAT Type). Default is 3. (1 = None, 2 = ZeroPercent, 3 = SevenPercent) |
| sellAccount | string | optional | If revenue document, PEAK records the transaction in this account, Leave blank to automatically use the default value. |
| purchaseValue | number? | optional | Purchase price per unit. |
| purchaseVatType | integer? | optional | Selling tax rate (VAT Type). Default is 3. (1 = None, 3 = SevenPercent) |
| purchaseAccount | string | optional | If expense document , PEAK records the transaction in this account, Leave blank to automatically use the default value. |
| carryingBalanceValue | number? | optional | Carrying balance value. |
| carryingBalanceAmount | number? | optional | Carrying balance amount. |
| unitId | string | optional | Unit ID. |
| unitCode | string | optional | Unit code. |
| unitNameTh | string | optional | Unit name in Thai. |
| unitNameEn | string | optional | Unit name in English. |
| id | string | optional | Unique Identifier generated by PEAK |
Response
{
"PeakProducts": {
"resCode": "200",
"resDesc": "Success",
"totalProduct": 1,
"products": [{
"id": "guid",
"code": "P001",
"name": "Product Name",
"type": 1
}]
}
}
GetProduct
WHEN TO USE Use to read ONE product (สินค้า) you already have a code or id for — typically to check its prices, VAT types, accounts or unit before putting it on a line item. This tool addresses a product directly; to search by keyword use ListProduct instead. For services (บริการ) use GetService — PEAK keeps them in a separate catalog. BUSINESS RULES & PRE-CONDITIONS Supply code (recommended) or id; one of the two is required. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong or belongs to a service, not that the product must be created: confirm the code with the user or try GetService. Never invent a code or fabricate product details. EXPECTED OUTCOME Returns the matching product (type 1) with id, code, name, sellValue, sellVatType, sellAccount, purchaseValue, purchaseVatType, purchaseAccount and unit.
0 required · 2 optional
GetProduct
WHEN TO USE Use to read ONE product (สินค้า) you already have a code or id for — typically to check its prices, VAT types, accounts or unit before putting it on a line item. This tool addresses a product directly; to search by keyword use ListProduct instead. For services (บริการ) use GetService — PEAK keeps them in a separate catalog. BUSINESS RULES & PRE-CONDITIONS Supply code (recommended) or id; one of the two is required. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong or belongs to a service, not that the product must be created: confirm the code with the user or try GetService. Never invent a code or fabricate product details. EXPECTED OUTCOME Returns the matching product (type 1) with id, code, name, sellValue, sellVatType, sellAccount, purchaseValue, purchaseVatType, purchaseAccount and unit.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Product code to fetch ONE specific product (e.g. 'P00001'). Recommended. |
| id | string | optional | The Unique Identifier of ONE specific product. Use when the code is unknown. |
Response
{
"PeakProducts": {
"resCode": "200",
"resDesc": "Success",
"products": [{
"id": "guid",
"code": "P00001",
"name": "Product Name",
"type": 1,
"sellValue": 100.00,
"sellVatType": 3,
"sellAccount": "410101",
"purchaseValue": 80.00,
"purchaseVatType": 3,
"purchaseAccount": "510101",
"resCode": "200",
"resDesc": "Success"
}]
}
}
EditProduct
WHEN TO USE Use to change an existing product (สินค้า) in the PEAK catalog — its price, name, code, VAT type, accounts, unit or description — when the user says the item's details have changed. This tool edits a Product only; for a service (บริการ) use EditService. To register a new item use CreateProduct instead. BUSINESS RULES & PRE-CONDITIONS Identify the product by code (recommended) or id; resolve it with GetProduct or ListProduct first and never guess a code. Send only the fields that change — every field left blank keeps its current value in PEAK, including the unit. newCode renames the product's code; leave it blank to keep the code. sellValue and purchaseValue cannot be negative. VAT type is 1 = None, 2 = ZeroPercent, 3 = SevenPercent. This writes master data the whole organization reuses — show the user the current and new values and get explicit confirmation before calling. FALLBACK & ERROR HANDLING If the product is not found, nothing is changed: confirm the code with the user or try EditService in case the item is a service. Never invent an account code — resolve it with GetAccountCodes. If PEAK rejects the edit, report its message verbatim; the product was NOT changed. EXPECTED OUTCOME Returns PEAK's result for the edited product. Call GetProduct afterwards if the user wants to see the saved values.
0 required · 13 optional
EditProduct
WHEN TO USE Use to change an existing product (สินค้า) in the PEAK catalog — its price, name, code, VAT type, accounts, unit or description — when the user says the item's details have changed. This tool edits a Product only; for a service (บริการ) use EditService. To register a new item use CreateProduct instead. BUSINESS RULES & PRE-CONDITIONS Identify the product by code (recommended) or id; resolve it with GetProduct or ListProduct first and never guess a code. Send only the fields that change — every field left blank keeps its current value in PEAK, including the unit. newCode renames the product's code; leave it blank to keep the code. sellValue and purchaseValue cannot be negative. VAT type is 1 = None, 2 = ZeroPercent, 3 = SevenPercent. This writes master data the whole organization reuses — show the user the current and new values and get explicit confirmation before calling. FALLBACK & ERROR HANDLING If the product is not found, nothing is changed: confirm the code with the user or try EditService in case the item is a service. Never invent an account code — resolve it with GetAccountCodes. If PEAK rejects the edit, report its message verbatim; the product was NOT changed. EXPECTED OUTCOME Returns PEAK's result for the edited product. Call GetProduct afterwards if the user wants to see the saved values.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Code of the product to edit (e.g. 'P00001'). Recommended. Supply this or id. |
| id | string | optional | The Unique Identifier of the product to edit. Use when the code is unknown. |
| name | string | optional | New product name. Leave blank to keep the current name. |
| newCode | string | optional | New code to save for this product. Leave blank to keep the current code. |
| description | string | optional | New description. Leave blank to keep the current description. |
| sellValue | number? | optional | New selling price per unit. Must not be negative. Leave blank to keep the current price. |
| sellVatType | integer? | optional | New selling VAT type (1 = None, 2 = ZeroPercent, 3 = SevenPercent). Leave blank to keep the current one. |
| sellAccount | string | optional | New account code for revenue documents. Leave blank to keep the current account. |
| purchaseValue | number? | optional | New purchase price per unit. Must not be negative. Leave blank to keep the current price. |
| purchaseVatType | integer? | optional | New purchase VAT type (1 = None, 2 = ZeroPercent, 3 = SevenPercent). Leave blank to keep the current one. |
| purchaseAccount | string | optional | New account code for expense documents. Leave blank to keep the current account. |
| unitCode | string | optional | Code of the new unit (e.g. 'PU0001'). Leave unitCode and unitId blank to keep the current unit. |
| unitId | string | optional | Unique Identifier of the new unit. Use when the unit code is unknown. |
PurchaseOrder
6 tools
CreatePurchaseOrder
WHEN TO USE Use when the input is a request/order to a vendor, not yet a paid bill. Workflow: PO → convert to Expense → Expense Payment. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) resolve each line item's `accountCode` via business-profile.md mapping or GetAccountCodes unless the business explicitly tracks stock-in via productCode. ; (3) if withholding tax applies, prepare all 3 WHT fields together (see WHT formula below) — never send only one. FALLBACK & ERROR HANDLING product-not-found → accountCode fallback + user confirmation. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
1 required · 28 optional
CreatePurchaseOrder
WHEN TO USE Use when the input is a request/order to a vendor, not yet a paid bill. Workflow: PO → convert to Expense → Expense Payment. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) resolve each line item's `accountCode` via business-profile.md mapping or GetAccountCodes unless the business explicitly tracks stock-in via productCode. ; (3) if withholding tax applies, prepare all 3 WHT fields together (see WHT formula below) — never send only one. FALLBACK & ERROR HANDLING product-not-found → accountCode fallback + user confirmation. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakPurchaseOrders": {
"resCode": "200",
"resDesc": "PeakPurchaseOrders have Completed",
"purchaseOrders": [{
"id": "b6dbb6d7-b38e-4e2b-ac44-f321f38b4a3a",
"code": "PO-2023010004",
"issuedDate": "20230817",
"dueDate": "20230818",
"contactId": "917c3e8f-b315-4968-b8cc-08e2220d8682",
"contactCode": "C01401",
"status": "Approve",
"isTaxInvoice": 0,
"preTaxAmount": 200,
"vatAmount": 0,
"netAmount": 200,
"whtAmount": 0,
"taxStatus": 0,
"products": [{ "id": "guid", "accountCode": "114102", "description": "Design by Peak", "quantity": 1, "price": 200, "vatType": 1 }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetPurchaseOrder
WHEN TO USE Use to read ONE purchase order (ใบสั่งซื้อ) you already have an identifier for, with its full line items — do this before calling EditPurchaseOrder, ApprovePurchaseOrder or VoidPurchaseOrder. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListPurchaseOrder instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. 'PO2023080002'), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Do not fall back to a keyword search on your own; a keyword search can return a different document. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching purchase order with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetPurchaseOrder
WHEN TO USE Use to read ONE purchase order (ใบสั่งซื้อ) you already have an identifier for, with its full line items — do this before calling EditPurchaseOrder, ApprovePurchaseOrder or VoidPurchaseOrder. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListPurchaseOrder instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. 'PO2023080002'), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Do not fall back to a keyword search on your own; a keyword search can return a different document. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching purchase order with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'PO2023080002'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakPurchaseOrders": {
"purchaseOrders": [
{
"id": "guid",
"code": "PO2023080002",
"issuedDate": "20230809",
"contactId": "bced4f76-8dbf-4518-ab75-c92437471f08",
"contactCode": "572608351",
"netAmount": 107,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalPurchaseOrder": 1,
"resDesc": "Success",
"resCode": "200"
}
}
ListPurchaseOrder
WHEN TO USE Use to search purchase orders (ใบสั่งซื้อ) by date range, status, or keyword — to find a document code, review open orders, or list activity. This tool returns a filtered LIST; to read ONE document by exact id/code/reference use GetPurchaseOrder instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching purchase orders with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListPurchaseOrder
WHEN TO USE Use to search purchase orders (ใบสั่งซื้อ) by date range, status, or keyword — to find a document code, review open orders, or list activity. This tool returns a filtered LIST; to read ONE document by exact id/code/reference use GetPurchaseOrder instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching purchase orders with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Displays documents starting from the specified date (Format: yyyyMMdd). |
| dateEnd | string | optional | Displays documents ending on the specified date (Format: yyyyMMdd). |
| status | integer? | optional | Document status (0=None,1=Voided,2=Draft,3=AwaitApproval,4=Outstanding,5=Overdue,6=PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakPurchaseOrders": {
"purchaseOrders": [
{
"id": "guid",
"code": "PO2023080002",
"issuedDate": "20230809",
"contactId": "bced4f76-8dbf-4518-ab75-c92437471f08",
"contactCode": "572608351",
"netAmount": 107,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalPurchaseOrder": 1,
"resDesc": "Success",
"resCode": "200"
}
}
EditPurchaseOrder
WHEN TO USE Call when the user wants to change an existing Draft purchase order (ใบสั่งซื้อ) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidPurchaseOrder; to move it out of Draft use ApprovePurchaseOrder. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetPurchaseOrder to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. This document type has no document-level withholding-tax field — send withholding tax only as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item. FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the purchase order was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
3 required · 28 optional
EditPurchaseOrder
WHEN TO USE Call when the user wants to change an existing Draft purchase order (ใบสั่งซื้อ) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidPurchaseOrder; to move it out of Draft use ApprovePurchaseOrder. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetPurchaseOrder to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. This document type has no document-level withholding-tax field — send withholding tax only as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item. FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the purchase order was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | The COMPLETE array of products or services for the document. Any existing line omitted here is permanently deleted — copy the full list from GetPurchaseOrder and modify it. array[InvoiceProduct] — sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| issuedDate | string | required | Document issuance date (yyyyMMdd). REQUIRED on edit: copy the existing value from GetPurchaseOrder unless you intend to change it, otherwise the document date would be overwritten | ||||||||||||||||||||||||||||
| contactId | string | required | Unique Identifier of the contact associated with the document. REQUIRED on edit: copy the existing value from GetPurchaseOrder (contactCode alone is not accepted by PEAK on edit) | ||||||||||||||||||||||||||||
| code | string | optional | The code of the purchase order to be edited. Recommended over id: it also preserves the document number | ||||||||||||||||||||||||||||
| id | string | optional | The Unique Identifier of the purchase order to be edited. Use only when the code is unknown | ||||||||||||||||||||||||||||
| newCode | string | optional | New document number to write into the edited document. Leave blank to keep the existing document number. | ||||||||||||||||||||||||||||
| dueDate | string | optional | Document due date, which must be after the document issuance date | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact associated with the document (If contactId has been assigned a value, contactCode is not required) | ||||||||||||||||||||||||||||
| reference | string | optional | Reference information of the document | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Specify the tax status of the document to indicate whether the price includes tax or the tax is separate (0 = ExcludeTax, 1 = IncludeTax, 2 = NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | The total discount should not exceed the net total of the document or be greater than 100%. Additionally, it can only be applied when the tax type of each item is the same | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Whether the document can be used as a tax invoice (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Label attached to someone or something for the purpose of identification or to give other information | ||||||||||||||||||||||||||||
| status | string | optional | Status of the document, which can have multiple states such as Draft, Approve, Voided, etc | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax is applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | Tax collected from the increased value of products or services (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Total value of the document after tax and discounts have been applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency transactions | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency transactions | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Include the existing payment details when editing a document that already has a payment recorded. | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | The Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date in the format yyyyMMdd | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Payment account code. | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub account Unique Identifier to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Additional remarks or notes for that specific payment received | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Whether this payment is made by Cheque (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | Withholding tax amount for the payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakPurchaseOrders": {
"resCode": "200",
"resDesc": "Completed",
"totalPurchaseOrder": 1,
"purchaseOrders": [{
"id": "guid",
"code": "PO2023080002",
"issuedDate": "20230809",
"dueDate": "20230816",
"contactId": "guid",
"contactCode": "C01401",
"status": "Draft",
"isTaxInvoice": 0,
"preTaxAmount": 200,
"vatAmount": 0,
"netAmount": 200,
"whtAmount": 0,
"paymentAmount": 0,
"remainAmount": 200,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "accountCode": "114102", "description": "...", "quantity": 1, "price": 200, "vatType": 1 }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
ApprovePurchaseOrder
WHEN TO USE Call when the user asks to approve or confirm a Draft purchase order (ใบสั่งซื้อ) — the step that turns a Draft into a live accounting document. The documented workflow is PO → convert to Expense → Expense Payment. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetPurchaseOrder to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditPurchaseOrder first — an approved purchase order can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the purchase order was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
ApprovePurchaseOrder
WHEN TO USE Call when the user asks to approve or confirm a Draft purchase order (ใบสั่งซื้อ) — the step that turns a Draft into a live accounting document. The documented workflow is PO → convert to Expense → Expense Payment. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetPurchaseOrder to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditPurchaseOrder first — an approved purchase order can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the purchase order was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the purchase order to be approved |
| id | string | optional | The Unique Identifier of the purchase order to be approved |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidPurchaseOrder
WHEN TO USE Only when the user explicitly asks to cancel an existing purchase order (ใบสั่งซื้อ). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditPurchaseOrder instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetPurchaseOrder to look it up. The purchase order is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference: if an Expense has been created from this purchase order, void that Expense first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the purchase order was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
VoidPurchaseOrder
WHEN TO USE Only when the user explicitly asks to cancel an existing purchase order (ใบสั่งซื้อ). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditPurchaseOrder instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetPurchaseOrder to look it up. The purchase order is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference: if an Expense has been created from this purchase order, void that Expense first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the purchase order was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the purchase order to be voided |
| id | string | optional | The Unique Identifier of the purchase order to be voided |
Response
{ "resCode": "200", "resDesc": "Success" }
Quotation
6 tools
CreateQuotation
WHEN TO USE Use when the input is a price proposal, not yet a binding bill — customer hasn't committed to purchase. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) For line items: if `use_product_code = true`, try ListProduct per item and use `productCode` on a match; fall back to `accountCode` per item if no match — never send both on the same line item. FALLBACK & ERROR HANDLING product-not-found → accountCode fallback + user confirmation. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
1 required · 28 optional
CreateQuotation
WHEN TO USE Use when the input is a price proposal, not yet a binding bill — customer hasn't committed to purchase. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve `contactId`/`contactCode` via SearchContacts → CreateContact if missing; (2) For line items: if `use_product_code = true`, try ListProduct per item and use `productCode` on a match; fall back to `accountCode` per item if no match — never send both on the same line item. FALLBACK & ERROR HANDLING product-not-found → accountCode fallback + user confirmation. EXPECTED OUTCOME Create the document in "Draft" or "Approved" status, and display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakQuotations": {
"resCode": "200",
"resDesc": "PeakQuotations have Completed",
"quotations": [{
"id": "b6dbb6d7-b38e-4e2b-ac44-f321f38b4a3a",
"code": "QOU-230817000000012",
"issuedDate": "20230817",
"dueDate": "20230818",
"contactId": "917c3e8f-b315-4968-b8cc-08e2220d8682",
"contactCode": "C01401",
"status": "Approve",
"isTaxInvoice": 0,
"preTaxAmount": 200,
"vatAmount": 0,
"netAmount": 200,
"whtAmount": 0,
"taxStatus": 0,
"products": [{ "id": "guid", "accountCode": "114102", "description": "Design by Peak", "quantity": 1, "price": 200, "vatType": 1 }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetQuotation
WHEN TO USE Use to read ONE sales quotation (ใบเสนอราคา) you already have an identifier for — typically to check its status (Draft/Approved/Void) before it is converted to an Invoice, or read its full line items before EditQuotation. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListQuotation instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "QO202412005"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching quotation with status (Draft/Approve/Voided), document number, netAmount and remainAmount, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetQuotation
WHEN TO USE Use to read ONE sales quotation (ใบเสนอราคา) you already have an identifier for — typically to check its status (Draft/Approved/Void) before it is converted to an Invoice, or read its full line items before EditQuotation. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListQuotation instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. "QO202412005"), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching quotation with status (Draft/Approve/Voided), document number, netAmount and remainAmount, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'QO202412005'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakQuotations": {
"resCode": "200",
"resDesc": "PeakQuotations have Completed",
"totalQuotation": 1,
"quotations": [{
"id": "c4311f2f-e2eb-474c-b32a-4db1ce49d974",
"code": "QOU-230118000000000",
"issuedDate": "20230118",
"dueDate": "20230125",
"contactId": "5106bf55-8939-409f-a2d5-ef84f9c4bc9d",
"contactCode": "C00006",
"reference": "...",
"status": "Draft",
"isTaxInvoice": 0,
"isVoid": 0,
"preTaxAmount": 220,
"vatAmount": 7.7,
"netAmount": 227.7,
"whtAmount": 0,
"paymentAmount": 0,
"remainAmount": 227.7,
"remainWhtAmount": 0,
"documentLink": "https://...",
"remark": "...",
"taxStatus": 0,
"discountTotal": "0",
"tags": [],
"products": [{ "id": "guid", "productCode": "P00002", "accountCode": "410101", "description": "...", "quantity": 1, "price": 110, "vatType": 1 }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
ListQuotation
WHEN TO USE Use to search sales quotations (ใบเสนอราคา) by date range, status, or keyword — to find a document code, check which are still Draft/Approved, or list recent activity. This tool returns a filtered LIST; it does not read one document by exact id/code/reference. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching quotations with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListQuotation
WHEN TO USE Use to search sales quotations (ใบเสนอราคา) by date range, status, or keyword — to find a document code, check which are still Draft/Approved, or list recent activity. This tool returns a filtered LIST; it does not read one document by exact id/code/reference. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching quotations with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Displays documents starting from the specified date (Format: yyyyMMdd). |
| dateEnd | string | optional | Displays documents ending on the specified date (Format: yyyyMMdd). |
| status | integer? | optional | Document status (0=None,1=Voided,2=Draft,3=AwaitApproval,4=Outstanding,5=Overdue,6=PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakQuotations": {
"resCode": "200",
"resDesc": "PeakQuotations have Completed",
"totalQuotation": 1,
"quotations": [{
"id": "c4311f2f-e2eb-474c-b32a-4db1ce49d974",
"code": "QOU-230118000000000",
"issuedDate": "20230118",
"contactId": "5106bf55-8939-409f-a2d5-ef84f9c4bc9d",
"contactCode": "C00006",
"status": "Draft",
"netAmount": 227.7,
"documentLink": "https://..."
}]
}
}
EditQuotation
WHEN TO USE Call when the user wants to change an existing Draft sales quotation (ใบเสนอราคา) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidQuotation; to move it out of Draft use ApproveQuotation. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetQuotation to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only Draft quotations can be edited; approved or voided documents are rejected by PEAK. This document type has no document-level withholding-tax field — send withholding tax only as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item. FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the sales quotation was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
3 required · 28 optional
EditQuotation
WHEN TO USE Call when the user wants to change an existing Draft sales quotation (ใบเสนอราคา) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidQuotation; to move it out of Draft use ApproveQuotation. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetQuotation to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only Draft quotations can be edited; approved or voided documents are rejected by PEAK. This document type has no document-level withholding-tax field — send withholding tax only as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item. FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the sales quotation was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | The COMPLETE array of products or services for the document. Any existing line omitted here is permanently deleted — copy the full list from GetQuotation and modify it. array[InvoiceProduct] — sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| issuedDate | string | required | Document issuance date (yyyyMMdd). REQUIRED on edit: copy the existing value from GetQuotation unless you intend to change it, otherwise the document date would be overwritten | ||||||||||||||||||||||||||||
| contactId | string | required | Unique Identifier of the contact associated with the document. REQUIRED on edit: copy the existing value from GetQuotation (contactCode alone is not accepted by PEAK on edit) | ||||||||||||||||||||||||||||
| code | string | optional | The code of the quotation to be edited (e.g. 'QOU-230118000000000'). Recommended over id: it also preserves the document number | ||||||||||||||||||||||||||||
| id | string | optional | The Unique Identifier of the quotation to be edited. Use only when the code is unknown | ||||||||||||||||||||||||||||
| newCode | string | optional | New document number to write into the edited document. Leave blank to keep the existing document number. | ||||||||||||||||||||||||||||
| dueDate | string | optional | Document due date, which must be after the document issuance date | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact associated with the document (If contactId has been assigned a value, contactCode is not required) | ||||||||||||||||||||||||||||
| reference | string | optional | Reference information of the document | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Specify the tax status of the document to indicate whether the price includes tax or the tax is separate (0 = ExcludeTax, 1 = IncludeTax, 2 = NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | The total discount should not exceed the net total of the document or be greater than 100%. Additionally, it can only be applied when the tax type of each item is the same | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Whether the document can be used as a tax invoice (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Label attached to someone or something for the purpose of identification or to give other information | ||||||||||||||||||||||||||||
| status | string | optional | Status of the document, which can have multiple states such as Draft, Approve, Voided, etc | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax is applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | Tax collected from the increased value of products or services (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Total value of the document after tax and discounts have been applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency transactions | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency transactions | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Include the existing payment details when editing a document that already has a payment recorded. | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | The Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date in the format yyyyMMdd | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Payment account code. | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub account Unique Identifier to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Additional remarks or notes for that specific payment received | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Whether this payment is made by Cheque (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | Withholding tax amount for the payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakQuotations": {
"resCode": "200",
"resDesc": "PeakQuotations have Completed",
"quotations": [{
"id": "b6dbb6d7-b38e-4e2b-ac44-f321f38b4a3a",
"code": "QOU-230817000000012",
"status": "Draft",
"netAmount": 200,
"resCode": "200",
"resDesc": "Success"
}]
}
}
ApproveQuotation
WHEN TO USE Call when the user asks to approve or confirm a Draft sales quotation (ใบเสนอราคา) — the step that turns a Draft into a live accounting document. Use this when a quotation was created as a Draft and is now ready to send to the customer. A quotation must be Approved before it can be converted into an Invoice. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetQuotation to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditQuotation first — an approved sales quotation can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the sales quotation was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
ApproveQuotation
WHEN TO USE Call when the user asks to approve or confirm a Draft sales quotation (ใบเสนอราคา) — the step that turns a Draft into a live accounting document. Use this when a quotation was created as a Draft and is now ready to send to the customer. A quotation must be Approved before it can be converted into an Invoice. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetQuotation to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditQuotation first — an approved sales quotation can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the sales quotation was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the quotation to be approved (e.g. 'QOU-230118000000000') |
| id | string | optional | The Unique Identifier of the quotation to be approved |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidQuotation
WHEN TO USE Only when the user explicitly asks to cancel an existing sales quotation (ใบเสนอราคา). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditQuotation instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code (e.g. 'QOU-230118000000000') or id; one of the two is required — use GetQuotation to look it up. The sales quotation is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference: if the quotation has already been converted to an Invoice, void that Invoice first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the sales quotation was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
VoidQuotation
WHEN TO USE Only when the user explicitly asks to cancel an existing sales quotation (ใบเสนอราคา). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditQuotation instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code (e.g. 'QOU-230118000000000') or id; one of the two is required — use GetQuotation to look it up. The sales quotation is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference: if the quotation has already been converted to an Invoice, void that Invoice first. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the sales quotation was NOT voided: report resDesc. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the quotation to be voided (e.g. 'QOU-230118000000000') |
| id | string | optional | The Unique Identifier of the quotation to be voided |
Response
{ "resCode": "200", "resDesc": "Success" }
Receipt
9 tools
GetReceipt
WHEN TO USE Use to read ONE receipt (ใบเสร็จรับเงิน) you already have an identifier for, with its full line items — do this before calling EditReceipt, ApproveReceipt or VoidReceipt. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListReceipt instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. 'RT202608008'), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Do not fall back to a keyword search on your own; a keyword search can return a different document. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching receipt with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
GetReceipt
WHEN TO USE Use to read ONE receipt (ใบเสร็จรับเงิน) you already have an identifier for, with its full line items — do this before calling EditReceipt, ApproveReceipt or VoidReceipt. This tool addresses a document directly by id, code, or reference; to search by date range, status, or keyword use ListReceipt instead. BUSINESS RULES & PRE-CONDITIONS Supply at least one of id, code (e.g. 'RT202608008'), or reference. There is no date filter on this tool. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong, not that the document is absent from PEAK: confirm the code with the user rather than assuming a typo and guessing a correction. Do not fall back to a keyword search on your own; a keyword search can return a different document. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns the matching receipt with status (Draft/Approve/Voided), document number, netAmount, remainAmount and Document Link, including its products array. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Document code to fetch ONE specific document (e.g. 'RTZ202308008'). Recommended — it also identifies the document number |
| id | string | optional | The Unique Identifier of ONE specific document. Use when the code is unknown |
| reference | string | optional | Reference number of ONE specific document |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakReceipts": {
"receipts": [
{
"id": "guid",
"code": "RTZ202308008",
"issuedDate": "20230807",
"contactId": "5b37fe57-aa7d-49ed-ba8b-a01bf2aeee37",
"contactCode": "C02974",
"isTaxInvoice": 0,
"netAmount": 278.2,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalReceipt": 3,
"resDesc": "PeakReceipts have Completed",
"resCode": "200"
}
}
ListReceipt
WHEN TO USE Use to search receipts (ใบเสร็จรับเงิน) by date range, status, or keyword — to find a document code, review recent payments received, or list activity. This tool returns a filtered LIST; to read ONE document by exact id/code/reference use GetReceipt instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching receipts with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
0 required · 6 optional
ListReceipt
WHEN TO USE Use to search receipts (ใบเสร็จรับเงิน) by date range, status, or keyword — to find a document code, review recent payments received, or list activity. This tool returns a filtered LIST; to read ONE document by exact id/code/reference use GetReceipt instead. BUSINESS RULES & PRE-CONDITIONS All filters are optional: dateStart / dateEnd (yyyyMMdd), status, and searchText (contact name or document number). Use limit + page to paginate — each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING Zero results usually means the filter window is wrong, not that the document doesn't exist — widen the date range or drop the status filter before concluding it isn't there. Never invent a code or fabricate document contents. EXPECTED OUTCOME Returns matching receipts with status (Draft/Approve/Voided), document number, netAmount and remainAmount. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |
|---|---|---|---|
| dateStart | string | optional | Filter by document start date (Format: yyyyMMdd). |
| dateEnd | string | optional | Filter by document end date (Format: yyyyMMdd). |
| status | integer? | optional | Filter by document status (0 = None, 1 = Voided, 2 = Draft, 3 = AwaitApproval, 4 = Outstanding, 5 = Overdue, 6 = PaidOrAwaitReceipt) |
| searchText | string | optional | Search keyword - contact name, document number |
| limit | integer? | optional | Maximum number of entries. |
| page | integer? | optional | Page number (each page shows 10 entries). |
Response
{
"PeakReceipts": {
"receipts": [
{
"id": "guid",
"code": "RTZ202308008",
"issuedDate": "20230807",
"contactId": "5b37fe57-aa7d-49ed-ba8b-a01bf2aeee37",
"contactCode": "C02974",
"isTaxInvoice": 0,
"netAmount": 278.2,
"remainAmount": 0,
"documentLink": "https://...",
"resCode": "200",
"resDesc": "Success"
}
],
"totalReceipt": 3,
"resDesc": "PeakReceipts have Completed",
"resCode": "200"
}
}
CreateReceipt
WHEN TO USE Use when the input confirms money was actually received from a customer. A receipt records payment, so do not create one for a document the customer has not actually paid. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve contactId/contactCode via SearchContacts, and CreateContact if the contact is missing; (2) for line items, if the business uses product codes try ListProduct per item and use productCode on a match, falling back to accountCode per item — never send both on the same line item. paymentMethodCode and paymentAmount are effectively required: a receipt without payment data is meaningless. VAT logic: if the organization is not VAT-registered, isTaxInvoice=0; tax invoice + VAT ExcludeTax gives isTaxInvoice=1, taxStatus=0; tax invoice + VAT IncludeTax gives isTaxInvoice=1, taxStatus=1; not a tax invoice at all gives isTaxInvoice=0, taxStatus=2. Do not use taxStatus=2 (NonTax) for no-VAT items — some environments compute the total as 0. Withholding tax on a receipt has NO document-level field: send it as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item, and reduce paymentAmount to match. FALLBACK & ERROR HANDLING This creates a live accounting document — show the user a preview and get confirmation before calling. "Should be paid full amount" means withholding tax is present but paymentAmount was not reduced; recompute paymentAmount = netAmount minus the withholding tax. "Invoice net amount less than payment" means paymentAmount plus withholding tax exceeds netAmount; re-check the formula. "Bank Account not found" means the payment method code is wrong or points to a Cheque-type account; re-fetch via GetPaymentMethod or use paymentMethodId. A product-related error means falling back to accountCode — confirm with the user before retrying. EXPECTED OUTCOME Creates the document in "Draft" or "Approved" status. Display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
1 required · 28 optional
CreateReceipt
WHEN TO USE Use when the input confirms money was actually received from a customer. A receipt records payment, so do not create one for a document the customer has not actually paid. BUSINESS RULES & PRE-CONDITIONS Before calling: (1) resolve contactId/contactCode via SearchContacts, and CreateContact if the contact is missing; (2) for line items, if the business uses product codes try ListProduct per item and use productCode on a match, falling back to accountCode per item — never send both on the same line item. paymentMethodCode and paymentAmount are effectively required: a receipt without payment data is meaningless. VAT logic: if the organization is not VAT-registered, isTaxInvoice=0; tax invoice + VAT ExcludeTax gives isTaxInvoice=1, taxStatus=0; tax invoice + VAT IncludeTax gives isTaxInvoice=1, taxStatus=1; not a tax invoice at all gives isTaxInvoice=0, taxStatus=2. Do not use taxStatus=2 (NonTax) for no-VAT items — some environments compute the total as 0. Withholding tax on a receipt has NO document-level field: send it as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item, and reduce paymentAmount to match. FALLBACK & ERROR HANDLING This creates a live accounting document — show the user a preview and get confirmation before calling. "Should be paid full amount" means withholding tax is present but paymentAmount was not reduced; recompute paymentAmount = netAmount minus the withholding tax. "Invoice net amount less than payment" means paymentAmount plus withholding tax exceeds netAmount; re-check the formula. "Bank Account not found" means the payment method code is wrong or points to a Cheque-type account; re-fetch via GetPaymentMethod or use paymentMethodId. A product-related error means falling back to accountCode — confirm with the user before retrying. EXPECTED OUTCOME Creates the document in "Draft" or "Approved" status. Display the Document Number, Contact Name, Document Amount, and Document Link. The response carries contactId and contactCode but not the contact name — use the name you already resolved via SearchContacts, or look it up; never print a name as if it came from this response.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | Products/services. array[InvoiceProduct] — line items. sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact (if contactId set, not required), SearchContacts if don't known | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact | ||||||||||||||||||||||||||||
| status | string | optional | Document status: 'Draft' or 'Approve'. Default 'Draft'. | ||||||||||||||||||||||||||||
| code | string | optional | Code displayed in PEAK. Auto-generated if blank | ||||||||||||||||||||||||||||
| issuedDate | string | optional | Issuance date (yyyyMMdd). | ||||||||||||||||||||||||||||
| dueDate | string | optional | Due date (yyyyMMdd). Must be after issuedDate. | ||||||||||||||||||||||||||||
| reference | string | optional | Document reference information, such as purchase order | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes, Leave blank to automatically use the default value. | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Tax status (0=ExcludeTax,1=IncludeTax,2=NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | Total discount. Same tax type only. | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Usable as tax invoice (0=No,1=Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Labels/tags attached to the document. | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax. Auto-calculated if null. | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | VAT amount. Auto-calculated if null. | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Net amount after tax/discounts. Auto-calculated if null. | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date (yyyyMMdd). Default = issuedDate | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub-account ID for recording | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub-account code for recording | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Notes for that payment | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Payment by cheque (0=No,1=Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | WithHoldingTax amount for the payment. | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency. | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency. | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code to reduce response data. |
Response
{
"PeakReceipts": {
"resCode": "200",
"resDesc": "PeakReceipts have Completed",
"receipts": [{
"id": "77dd1ceb-a0f6-44bb-ae9c-525cc8026b34",
"code": "RTZ202308020",
"issuedDate": "20230815",
"dueDate": "20230822",
"contactId": "guid",
"contactCode": "C01401",
"status": "Approve",
"isTaxInvoice": 0,
"preTaxAmount": 300,
"vatAmount": 21,
"netAmount": 321,
"whtAmount": 0,
"paymentAmount": 321,
"remainAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "P001", "accountCode": "410101", "description": "...", "quantity": 1, "price": 300, "vatType": 3 }],
"paidPayments": [{ "paymentDate": "20230815", "paymentTotal": 321, "payments": [{ "paymentMethodCode": "CSH260", "amount": 321 }], "journals": [{ "id": "guid", "code": "RV-..." }] }],
"journals": [{ "id": "guid", "code": "SV-..." }],
"resCode": "200",
"resDesc": "Success"
}]
}
}
EditReceipt
WHEN TO USE Call when the user wants to change an existing Draft receipt (ใบเสร็จรับเงิน) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidReceipt; to move it out of Draft use ApproveReceipt. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetReceipt to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. This document type has no document-level withholding-tax field — send withholding tax only as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item. FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the receipt was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
4 required · 27 optional
EditReceipt
WHEN TO USE Call when the user wants to change an existing Draft receipt (ใบเสร็จรับเงิน) — amounts, line items, dates, contact, or payment details. To cancel the document instead use VoidReceipt; to move it out of Draft use ApproveReceipt. BUSINESS RULES & PRE-CONDITIONS This REPLACES the document contents — send the COMPLETE document, never a delta; any product line missing from the products array is permanently deleted. Before calling: (1) call GetReceipt to read the current document; (2) send every field back with your changes applied, including all existing product lines and any payment already recorded; (3) identify the target with code (recommended — it also preserves the document number) or id. Do not rely on omitted fields being preserved by PEAK. Only editable (Draft) documents are accepted; PEAK rejects the edit otherwise. This document type has no document-level withholding-tax field — send withholding tax only as paidPaymentsWithHoldingTaxAmount (payment) and withHoldingTaxAmount on each affected line item. FALLBACK & ERROR HANDLING This overwrites a live document — show the user what will change, before and after, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. The PEAK response is returned as-is, so check resCode yourself: anything other than 200 means the receipt was NOT edited. If PEAK rejects the edit because the document is no longer a Draft, do not retry — tell the user it must be voided and reissued instead. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| products | array[InvoiceProduct] | required | The COMPLETE array of products or services for the document. Any existing line omitted here is permanently deleted — copy the full list from GetReceipt and modify it. array[InvoiceProduct] — sub-fields: id, productId, productCode, description, accountCode, accountSubId, accountSubCode, quantity, price, discount, vatType (1 = None, 2 = 0%, 3 = 7%, default 3), isDescription?, withHoldingTaxAmountarray[InvoiceProduct] fields
|
||||||||||||||||||||||||||||
| issuedDate | string | required | Document issuance date (yyyyMMdd). REQUIRED on edit: copy the existing value from GetReceipt unless you intend to change it, otherwise the document date would be overwritten | ||||||||||||||||||||||||||||
| dueDate | string | required | Document due date (yyyyMMdd), which must be after the document issuance date. REQUIRED on edit: copy the existing value from GetReceipt | ||||||||||||||||||||||||||||
| status | string | required | Status of the document (Draft, Approve, Voided, etc). REQUIRED on edit: copy the existing value from GetReceipt so the edit does not change the document state | ||||||||||||||||||||||||||||
| code | string | optional | The code of the receipt to be edited. Recommended over id: it also preserves the document number | ||||||||||||||||||||||||||||
| id | string | optional | The Unique Identifier of the receipt to be edited. Use only when the code is unknown | ||||||||||||||||||||||||||||
| newCode | string | optional | New document number to write into the edited document. Leave blank to keep the existing document number. | ||||||||||||||||||||||||||||
| contactId | string | optional | Unique Identifier of the contact associated with the document | ||||||||||||||||||||||||||||
| contactCode | string | optional | Code of the contact associated with the document (If contactId has been assigned a value, contactCode is not required) | ||||||||||||||||||||||||||||
| reference | string | optional | Reference information of the document | ||||||||||||||||||||||||||||
| remark | string | optional | Additional remarks or notes | ||||||||||||||||||||||||||||
| taxStatus | integer? | optional | Specify the tax status of the document to indicate whether the price includes tax or the tax is separate (0 = ExcludeTax, 1 = IncludeTax, 2 = NonTax) | ||||||||||||||||||||||||||||
| discountTotal | string | optional | The total discount should not exceed the net total of the document or be greater than 100%. Additionally, it can only be applied when the tax type of each item is the same | ||||||||||||||||||||||||||||
| isTaxInvoice | integer? | optional | Whether the document can be used as a tax invoice (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| tags | array[String] | optional | Label attached to someone or something for the purpose of identification or to give other information | ||||||||||||||||||||||||||||
| preTaxAmount | number? | optional | Amount before tax is applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| vatAmount | number? | optional | Tax collected from the increased value of products or services (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| netAmount | number? | optional | Total value of the document after tax and discounts have been applied (If value is null, PEAK will calculate it automatically) | ||||||||||||||||||||||||||||
| currencyId | integer? | optional | Currency ID for foreign currency transactions | ||||||||||||||||||||||||||||
| exchangeRate | number? | optional | Exchange rate for foreign currency transactions | ||||||||||||||||||||||||||||
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001') (if paymentMethodId set, not required) GetPaymentMethod if don't known. Include the existing payment details when editing a document that already has a payment recorded. | ||||||||||||||||||||||||||||
| paymentMethodId | string | optional | The Unique Identifier of the payment method | ||||||||||||||||||||||||||||
| paymentAmount | number? | optional | Payment amount. = netAmount − withHoldingTaxAmount when WHT present. | ||||||||||||||||||||||||||||
| paymentDate | string | optional | Payment date in the format yyyyMMdd | ||||||||||||||||||||||||||||
| paymentAccountCode | string | optional | Payment account code. | ||||||||||||||||||||||||||||
| paymentAccountSubId | string | optional | Sub account Unique Identifier to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentAccountSubCode | string | optional | Sub account code to be used for recording financial transactions | ||||||||||||||||||||||||||||
| paymentNote | string | optional | Additional remarks or notes for that specific payment received | ||||||||||||||||||||||||||||
| isCheque | integer? | optional | Whether this payment is made by Cheque (0 = No, 1 = Yes) | ||||||||||||||||||||||||||||
| paidPaymentsWithHoldingTaxAmount | string | optional | Withholding tax amount for the payment | ||||||||||||||||||||||||||||
| getResult | integer? | optional | Numeric code used to reduce the amount of response data received |
Response
{
"PeakReceipts": {
"resCode": "200",
"resDesc": "Completed",
"totalReceipt": 1,
"receipts": [{
"id": "guid",
"code": "RTZ202308020",
"issuedDate": "20230815",
"dueDate": "20230822",
"contactId": "guid",
"contactCode": "C01401",
"status": "Draft",
"isTaxInvoice": 0,
"preTaxAmount": 300,
"vatAmount": 21,
"netAmount": 321,
"whtAmount": 0,
"paymentAmount": 321,
"remainAmount": 0,
"remainWhtAmount": 0,
"documentLink": "https://...",
"taxStatus": 0,
"products": [{ "id": "guid", "productCode": "P001", "accountCode": "410101", "description": "...", "quantity": 1, "price": 300, "vatType": 3 }],
"paidPayments": [{ "paymentDate": "20230815", "paymentTotal": 321, "payments": [{ "paymentMethodCode": "CSH260", "amount": 321 }] }],
"journals": [],
"resCode": "200",
"resDesc": "Success"
}]
}
}
ApproveReceipt
WHEN TO USE Call when the user asks to approve or confirm a Draft receipt (ใบเสร็จรับเงิน) — the step that turns a Draft into a live accounting document. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetReceipt to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditReceipt first — an approved receipt can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the receipt was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 2 optional
ApproveReceipt
WHEN TO USE Call when the user asks to approve or confirm a Draft receipt (ใบเสร็จรับเงิน) — the step that turns a Draft into a live accounting document. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetReceipt to look it up. Only Draft documents can be approved. Approving posts the document, so make any corrections with EditReceipt first — an approved receipt can no longer be edited. FALLBACK & ERROR HANDLING This changes a live document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the receipt was NOT approved: report resDesc to the user rather than retrying with the other identifier. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the receipt to be approved |
| id | string | optional | The Unique Identifier of the receipt to be approved |
Response
{ "resCode": "200", "resDesc": "Success" }
VoidReceipt
WHEN TO USE Only when the user explicitly asks to cancel an existing receipt (ใบเสร็จรับเงิน). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditReceipt instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetReceipt to look it up. The receipt is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference (attached credit notes, billing notes or debit notes) — void those referencing documents first. If the receipt has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the receipt was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
0 required · 3 optional
VoidReceipt
WHEN TO USE Only when the user explicitly asks to cancel an existing receipt (ใบเสร็จรับเงิน). This cannot be undone — never void a document to tidy up or to redo it on your own initiative. If the user only wants to change the contents, use EditReceipt instead; a Draft can be edited without voiding. BUSINESS RULES & PRE-CONDITIONS Identify the document with code or id; one of the two is required — use GetReceipt to look it up. The receipt is permanently marked Voided and cannot be edited or reused afterwards. PEAK refuses to void a document that other documents reference (attached credit notes, billing notes or debit notes) — void those referencing documents first. If the receipt has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt, PEAK refuses the void unless isVoidETaxInvoice is set to 1. FALLBACK & ERROR HANDLING This permanently cancels a live accounting document — show the user the document number, contact and amount, and get explicit confirmation before calling. Nothing is changed if neither code nor id is supplied. Any resCode other than 200 means the receipt was NOT voided: report resDesc. Never set isVoidETaxInvoice to 1 as a retry — voiding a document already filed with the Revenue Department is a compliance action the user must explicitly confirm first. EXPECTED OUTCOME Returns status (Draft/Approve/Voided) and display the Document Number, Contact Name, netAmount, remainAmount and Document Link.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | The code of the receipt to be voided |
| id | string | optional | The Unique Identifier of the receipt to be voided |
| isVoidETaxInvoice | integer | optional | Set to 1 ONLY to void a document that has already been submitted to the Revenue Department as an e-Tax Invoice / e-Receipt. Default 0 refuses the void in that case, which is the safe behaviour. Voiding an already-filed e-Tax document is a compliance action and cannot be undone (0 = refuse if already sent as e-Tax, 1 = void anyway) |
Response
{ "resCode": "200", "resDesc": "Success" }
CreateReceiptFromQuotation
WHEN TO USE Use when a customer pays the full amount of a quotation (ใบเสนอราคา) straight away, without an invoice, and the user wants a receipt for it (ออกใบเสร็จจากใบเสนอราคา). PEAK copies the contact, product lines, prices, discounts, VAT and withholding tax from the quotation and links the two documents. If an invoice was already issued for the quotation, use CreateReceiptFromInvoice instead; if there is no quotation, use CreateReceipt. BUSINESS RULES & PRE-CONDITIONS Identify the quotation with quotationCode or quotationId, exactly one of the two (use GetQuotation or ListQuotation to find it). issuedDate (yyyyMMdd) is required; ask the user if they did not say. A receipt always records the money received, so the payment is required: paymentDate (yyyyMMdd), paymentAmount, and paymentMethodCode or paymentMethodId (not both, use GetPaymentMethod), plus optional withHoldingTaxAmount and paymentNote. paymentAmount plus any withholding tax must equal the quotation's net total exactly: PEAK does not take part payments here. The quotation must be approved; PEAK refuses a draft or voided quotation here with a bare resCode 500. A quotation still awaiting the customer's response is automatically marked as accepted; an expired quotation is not. status defaults to Draft; pass Approve only when the user asks for an approved receipt. FALLBACK & ERROR HANDLING This records money received. Show the user the quotation, amount, date and payment method, and get confirmation before calling. Nothing is created if an input is missing or invalid. Any resCode other than 200 means the receipt was NOT created, so report resDesc as it is. "Receipt net amount must equal to payment" means the amount does not match the quotation total. A quotation that was already converted is refused with "Quotation already created invoice"; tell the user rather than retrying. EXPECTED OUTCOME Returns the new receipt (id, code, status, netAmount, documentLink, paidPayments). The payment's journal code appears only once the receipt is approved. Report the receipt number, the amount and the status, and that it was created from the quotation.
0 required · 15 optional
CreateReceiptFromQuotation
WHEN TO USE Use when a customer pays the full amount of a quotation (ใบเสนอราคา) straight away, without an invoice, and the user wants a receipt for it (ออกใบเสร็จจากใบเสนอราคา). PEAK copies the contact, product lines, prices, discounts, VAT and withholding tax from the quotation and links the two documents. If an invoice was already issued for the quotation, use CreateReceiptFromInvoice instead; if there is no quotation, use CreateReceipt. BUSINESS RULES & PRE-CONDITIONS Identify the quotation with quotationCode or quotationId, exactly one of the two (use GetQuotation or ListQuotation to find it). issuedDate (yyyyMMdd) is required; ask the user if they did not say. A receipt always records the money received, so the payment is required: paymentDate (yyyyMMdd), paymentAmount, and paymentMethodCode or paymentMethodId (not both, use GetPaymentMethod), plus optional withHoldingTaxAmount and paymentNote. paymentAmount plus any withholding tax must equal the quotation's net total exactly: PEAK does not take part payments here. The quotation must be approved; PEAK refuses a draft or voided quotation here with a bare resCode 500. A quotation still awaiting the customer's response is automatically marked as accepted; an expired quotation is not. status defaults to Draft; pass Approve only when the user asks for an approved receipt. FALLBACK & ERROR HANDLING This records money received. Show the user the quotation, amount, date and payment method, and get confirmation before calling. Nothing is created if an input is missing or invalid. Any resCode other than 200 means the receipt was NOT created, so report resDesc as it is. "Receipt net amount must equal to payment" means the amount does not match the quotation total. A quotation that was already converted is refused with "Quotation already created invoice"; tell the user rather than retrying. EXPECTED OUTCOME Returns the new receipt (id, code, status, netAmount, documentLink, paidPayments). The payment's journal code appears only once the receipt is approved. Report the receipt number, the amount and the status, and that it was created from the quotation.
| Parameter | Type | Description | |
|---|---|---|---|
| quotationCode | string | optional | Code of the source quotation (e.g. 'QT-20261000003'). Provide this or quotationId, not both |
| quotationId | string | optional | The Unique Identifier of the source quotation. Provide this or quotationCode, not both |
| issuedDate | string | optional | Required. Issue date of the new receipt, format yyyyMMdd (e.g. '20261020') |
| paymentDate | string | optional | Required. The date the money was received, format yyyyMMdd |
| paymentAmount | number? | optional | Required. The amount received, excluding withholding tax. Together with withHoldingTaxAmount it must equal the quotation's net total |
| paymentMethodCode | string | optional | Code of the payment method (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | The Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Withholding tax the customer deducted, as an amount (e.g. '30') or a percentage (e.g. '3%'). Omit when none was withheld |
| paymentNote | string | optional | Optional note for the payment |
| status | string | optional | 'Draft' (default) or 'Approve' |
| code | string | optional | Receipt number to use. Auto-generated if blank |
| reference | string | optional | Reference text, at most 32 characters |
| remark | string | optional | Remark on the receipt, at most 1000 characters |
| isTaxInvoice | integer? | optional | Usable as a tax invoice (0 = No, 1 = Yes) |
| tags | array[String] | optional | Tags to attach, at most 10 |
CreateReceiptFromInvoice
WHEN TO USE Use when a customer has paid an invoice (ใบแจ้งหนี้) and the user wants a receipt that references it (ออกใบเสร็จจากใบแจ้งหนี้). PEAK copies the contact, product lines, VAT and withholding tax from the invoice. Use CreateReceipt only when there is no invoice. BUSINESS RULES & PRE-CONDITIONS Identify the invoice with invoiceCode or invoiceId, exactly one of the two (use GetInvoice or ListInvoice). issuedDate (yyyyMMdd) is required; ask the user if they did not say. Then give exactly ONE of: (a) paymentJournalCode, when the payment is already recorded on the invoice (e.g. with RecordInvoicePayment): the code of that payment's journal (e.g. RV-202610004), read from a fresh GetInvoice paidPayments[].journals[].code. The tool reads the invoice and issues the receipt for the payment that carries that code; no new payment is recorded. Never pass a paymentGroupId: it is only the payment's current position and shifts after every void. (b) A new payment: paymentDate (yyyyMMdd), paymentAmount, and paymentMethodCode or paymentMethodId (not both, use GetPaymentMethod), plus optional withHoldingTaxAmount and paymentNote. The invoice must be approved and still awaiting payment, and the amount must not exceed what is still owed (remainAmount on GetInvoice). A partial amount gives a partial receipt and the invoice stays outstanding. IMPORTANT: with a new payment, PEAK records the payment on the invoice first and immediately, even when the receipt is created as a draft. status defaults to Draft; pass Approve only when the user asks for an approved receipt. FALLBACK & ERROR HANDLING Show the user the invoice, amount, date and payment (or the existing payment's date, amount and journal code), and get confirmation before calling. Nothing is created if an input is missing or invalid, or if the journal code is not on the invoice. Any resCode other than 200 means the receipt was NOT created, so report resDesc as it is. "Transaction must be Waiting Payment Status" means the invoice is a draft, voided or already fully paid: if its payment is already recorded, use option (a). If a call with a new payment fails, check GetInvoice before retrying: the payment may already be on the invoice, and then use option (a) with its journal code. EXPECTED OUTCOME Returns the new receipt (id, code, status, netAmount, documentLink, paidPayments) for that one payment; a part payment adds a line "ชำระเงินบางส่วน ยอด X / Y บาท". Report the receipt number, the amount and the status. Once the invoice is fully paid, GetInvoice shows remainAmount 0. A payment that already has a receipt is refused ("Can not be paid.").
0 required · 15 optional
CreateReceiptFromInvoice
WHEN TO USE Use when a customer has paid an invoice (ใบแจ้งหนี้) and the user wants a receipt that references it (ออกใบเสร็จจากใบแจ้งหนี้). PEAK copies the contact, product lines, VAT and withholding tax from the invoice. Use CreateReceipt only when there is no invoice. BUSINESS RULES & PRE-CONDITIONS Identify the invoice with invoiceCode or invoiceId, exactly one of the two (use GetInvoice or ListInvoice). issuedDate (yyyyMMdd) is required; ask the user if they did not say. Then give exactly ONE of: (a) paymentJournalCode, when the payment is already recorded on the invoice (e.g. with RecordInvoicePayment): the code of that payment's journal (e.g. RV-202610004), read from a fresh GetInvoice paidPayments[].journals[].code. The tool reads the invoice and issues the receipt for the payment that carries that code; no new payment is recorded. Never pass a paymentGroupId: it is only the payment's current position and shifts after every void. (b) A new payment: paymentDate (yyyyMMdd), paymentAmount, and paymentMethodCode or paymentMethodId (not both, use GetPaymentMethod), plus optional withHoldingTaxAmount and paymentNote. The invoice must be approved and still awaiting payment, and the amount must not exceed what is still owed (remainAmount on GetInvoice). A partial amount gives a partial receipt and the invoice stays outstanding. IMPORTANT: with a new payment, PEAK records the payment on the invoice first and immediately, even when the receipt is created as a draft. status defaults to Draft; pass Approve only when the user asks for an approved receipt. FALLBACK & ERROR HANDLING Show the user the invoice, amount, date and payment (or the existing payment's date, amount and journal code), and get confirmation before calling. Nothing is created if an input is missing or invalid, or if the journal code is not on the invoice. Any resCode other than 200 means the receipt was NOT created, so report resDesc as it is. "Transaction must be Waiting Payment Status" means the invoice is a draft, voided or already fully paid: if its payment is already recorded, use option (a). If a call with a new payment fails, check GetInvoice before retrying: the payment may already be on the invoice, and then use option (a) with its journal code. EXPECTED OUTCOME Returns the new receipt (id, code, status, netAmount, documentLink, paidPayments) for that one payment; a part payment adds a line "ชำระเงินบางส่วน ยอด X / Y บาท". Report the receipt number, the amount and the status. Once the invoice is fully paid, GetInvoice shows remainAmount 0. A payment that already has a receipt is refused ("Can not be paid.").
| Parameter | Type | Description | |
|---|---|---|---|
| invoiceCode | string | optional | Code of the invoice that was paid (e.g. 'IV-20261000002'). Provide this or invoiceId, not both |
| invoiceId | string | optional | The Unique Identifier of the invoice that was paid. Provide this or invoiceCode, not both |
| issuedDate | string | optional | Required. Issue date of the new receipt, format yyyyMMdd (e.g. '20261021') |
| paymentJournalCode | string | optional | Option (a): journal code of a payment already recorded on the invoice (e.g. 'RV-202610004'), from GetInvoice paidPayments[].journals[].code. Do not combine with the payment fields |
| paymentDate | string | optional | Option (b): the date the money was received, format yyyyMMdd |
| paymentAmount | number? | optional | Option (b): the amount received, excluding withholding tax; must not exceed what is still owed |
| paymentMethodCode | string | optional | Option (b): code of the payment method (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | Option (b): the Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Option (b): withholding tax the customer deducted, as an amount (e.g. '30') or a percentage (e.g. '3%') |
| paymentNote | string | optional | Option (b): note for the payment |
| status | string | optional | 'Draft' (default) or 'Approve' |
| code | string | optional | Receipt number to use. Auto-generated if blank |
| remark | string | optional | Remark on the receipt, at most 1000 characters |
| isTaxInvoice | integer? | optional | Usable as a tax invoice (0 = No, 1 = Yes) |
| tags | array[String] | optional | Tags to attach, at most 10 |
CreateReceiptFromBillingNote
WHEN TO USE Use when a customer has paid a billing note (ใบวางบิล) and the user wants one receipt that references it (ออกใบเสร็จจากใบวางบิล). PEAK copies the contact, the invoices on the billing note and their totals. To issue a receipt for a single invoice use CreateReceiptFromInvoice. BUSINESS RULES & PRE-CONDITIONS Identify the billing note with billingNoteCode or billingNoteId, exactly one of the two (use GetBillingNote or ListBillingNote). issuedDate (yyyyMMdd) is required; ask the user if they did not say. Then give exactly ONE of: (a) paymentJournalCode, when the payment is already recorded on the billing note (e.g. with RecordBillingNotePayment): the code of that payment's journal (e.g. RV-202610005), read from a fresh GetBillingNote paidPayments[].journals[].code. The tool reads the billing note and issues the receipt for the payment that carries that code; no new payment is recorded. Never pass a paymentGroupId: it is only the payment's current position and shifts after every void. (b) A new payment: paymentDate (yyyyMMdd), paymentAmount, and paymentMethodCode or paymentMethodId (not both, use GetPaymentMethod), plus optional withHoldingTaxAmount and paymentNote. The billing note must be approved and still awaiting payment, and paymentAmount plus withholding tax must equal the whole remaining amount: PEAK takes no part payments on a billing note. IMPORTANT: with a new payment, PEAK records the payment on the billing note first and immediately, even when the receipt is created as a draft. status defaults to Draft; pass Approve only when the user asks for an approved receipt. FALLBACK & ERROR HANDLING Show the user the billing note, amount, date and payment (or the existing payment's date, amount and journal code), and get confirmation before calling. Nothing is created if an input is missing or invalid, or if the journal code is not on the billing note. Any resCode other than 200 means the receipt was NOT created, so report resDesc as it is. "Transaction must be Waiting Payment Status" means the billing note is a draft, voided or already paid: if its payment is already recorded, use option (a). If a call with a new payment fails, check GetBillingNote before retrying: the payment may already be recorded, and then use option (a) with its journal code. EXPECTED OUTCOME Returns the new receipt (id, code, status, netAmount, documentLink, paidPayments). Report the receipt number, the amount and the status, and which billing note it settles.
0 required · 15 optional
CreateReceiptFromBillingNote
WHEN TO USE Use when a customer has paid a billing note (ใบวางบิล) and the user wants one receipt that references it (ออกใบเสร็จจากใบวางบิล). PEAK copies the contact, the invoices on the billing note and their totals. To issue a receipt for a single invoice use CreateReceiptFromInvoice. BUSINESS RULES & PRE-CONDITIONS Identify the billing note with billingNoteCode or billingNoteId, exactly one of the two (use GetBillingNote or ListBillingNote). issuedDate (yyyyMMdd) is required; ask the user if they did not say. Then give exactly ONE of: (a) paymentJournalCode, when the payment is already recorded on the billing note (e.g. with RecordBillingNotePayment): the code of that payment's journal (e.g. RV-202610005), read from a fresh GetBillingNote paidPayments[].journals[].code. The tool reads the billing note and issues the receipt for the payment that carries that code; no new payment is recorded. Never pass a paymentGroupId: it is only the payment's current position and shifts after every void. (b) A new payment: paymentDate (yyyyMMdd), paymentAmount, and paymentMethodCode or paymentMethodId (not both, use GetPaymentMethod), plus optional withHoldingTaxAmount and paymentNote. The billing note must be approved and still awaiting payment, and paymentAmount plus withholding tax must equal the whole remaining amount: PEAK takes no part payments on a billing note. IMPORTANT: with a new payment, PEAK records the payment on the billing note first and immediately, even when the receipt is created as a draft. status defaults to Draft; pass Approve only when the user asks for an approved receipt. FALLBACK & ERROR HANDLING Show the user the billing note, amount, date and payment (or the existing payment's date, amount and journal code), and get confirmation before calling. Nothing is created if an input is missing or invalid, or if the journal code is not on the billing note. Any resCode other than 200 means the receipt was NOT created, so report resDesc as it is. "Transaction must be Waiting Payment Status" means the billing note is a draft, voided or already paid: if its payment is already recorded, use option (a). If a call with a new payment fails, check GetBillingNote before retrying: the payment may already be recorded, and then use option (a) with its journal code. EXPECTED OUTCOME Returns the new receipt (id, code, status, netAmount, documentLink, paidPayments). Report the receipt number, the amount and the status, and which billing note it settles.
| Parameter | Type | Description | |
|---|---|---|---|
| billingNoteCode | string | optional | Code of the billing note that was paid (e.g. 'BN-20261000003'). Provide this or billingNoteId, not both |
| billingNoteId | string | optional | The Unique Identifier of the billing note that was paid. Provide this or billingNoteCode, not both |
| issuedDate | string | optional | Required. Issue date of the new receipt, format yyyyMMdd (e.g. '20261021') |
| paymentJournalCode | string | optional | Option (a): journal code of a payment already recorded on the billing note (e.g. 'RV-202610005'), from GetBillingNote paidPayments[].journals[].code. Do not combine with the payment fields |
| paymentDate | string | optional | Option (b): the date the money was received, format yyyyMMdd |
| paymentAmount | number? | optional | Option (b): the amount received, excluding withholding tax. Together with withHoldingTaxAmount it must equal the remaining amount |
| paymentMethodCode | string | optional | Option (b): code of the payment method (e.g. 'CSH001'). Provide this or paymentMethodId, not both. Use GetPaymentMethod if unknown |
| paymentMethodId | string | optional | Option (b): the Unique Identifier of the payment method. Provide this or paymentMethodCode, not both |
| withHoldingTaxAmount | string | optional | Option (b): withholding tax the customer deducted, as an amount (e.g. '30') or a percentage (e.g. '3%') |
| paymentNote | string | optional | Option (b): note for the payment |
| status | string | optional | 'Draft' (default) or 'Approve' |
| code | string | optional | Receipt number to use. Auto-generated if blank |
| remark | string | optional | Remark on the receipt, at most 1000 characters |
| isTaxInvoice | integer? | optional | Usable as a tax invoice (0 = No, 1 = Yes) |
| tags | array[String] | optional | Tags to attach, at most 10 |
Service
4 tools
CreateService
WHEN TO USE Use to register a new service (บริการ) in the PEAK service catalog — consulting, maintenance, subscriptions, fees: anything billed but not stocked. This tool always creates a Service; for a stocked item (สินค้า) use CreateProduct instead. Call ListService first and only create an entry when the search confirms it does not already exist — ListProduct does not return services. BUSINESS RULES & PRE-CONDITIONS name is required. The purchase and sell sides are independent: purchaseValue / purchaseVatType / purchaseAccount record cost, sellValue / sellVatType / sellAccount record revenue. Set sellAccount so future invoices map to the right GL account, or leave it blank to take the PEAK default. VAT type on both sides is 1 = None, 2 = ZeroPercent, 3 = SevenPercent. FALLBACK & ERROR HANDLING This writes master data the whole organization will reuse — show the user the entry and get explicit confirmation before calling. If a price is unknown leave it blank rather than fabricating a value; the user can set it in PEAK later. Never invent an account code — resolve it with GetAccountCodes or leave it blank for the default. EXPECTED OUTCOME Returns the new service with its id and code (type 2 = Service). Use the id or code as the line-item reference when creating an Invoice, Quotation, or Purchase Order.
1 required · 15 optional
CreateService
WHEN TO USE Use to register a new service (บริการ) in the PEAK service catalog — consulting, maintenance, subscriptions, fees: anything billed but not stocked. This tool always creates a Service; for a stocked item (สินค้า) use CreateProduct instead. Call ListService first and only create an entry when the search confirms it does not already exist — ListProduct does not return services. BUSINESS RULES & PRE-CONDITIONS name is required. The purchase and sell sides are independent: purchaseValue / purchaseVatType / purchaseAccount record cost, sellValue / sellVatType / sellAccount record revenue. Set sellAccount so future invoices map to the right GL account, or leave it blank to take the PEAK default. VAT type on both sides is 1 = None, 2 = ZeroPercent, 3 = SevenPercent. FALLBACK & ERROR HANDLING This writes master data the whole organization will reuse — show the user the entry and get explicit confirmation before calling. If a price is unknown leave it blank rather than fabricating a value; the user can set it in PEAK later. Never invent an account code — resolve it with GetAccountCodes or leave it blank for the default. EXPECTED OUTCOME Returns the new service with its id and code (type 2 = Service). Use the id or code as the line-item reference when creating an Invoice, Quotation, or Purchase Order.
| Parameter | Type | Description | |
|---|---|---|---|
| name | string | required | Service name (required). |
| id | string | optional | The Unique Identifier generated by PEAK to identify data |
| code | string | optional | The code displayed in the PEAK |
| purchaseValue | number? | optional | Purchase price per unit |
| purchaseVatType | integer? | optional | Purchase tax rate (1 = None, 2 = ZeroPercent, 3 = SevenPercent) |
| purchaseAccount | string | optional | Account used to record purchase transactions |
| sellValue | number? | optional | Selling price per unit |
| sellVatType | integer? | optional | Selling tax rate (1 = None, 2 = ZeroPercent, 3 = SevenPercent) |
| sellAccount | string | optional | If revenue document, PEAK records the transaction in this account, Leave blank to automatically use the default value. |
| description | string | optional | Additional description of the service |
| carryingBalanceValue | number? | optional | Carrying balance value |
| carryingBalanceAmount | number? | optional | Carrying balance amount |
| unitId | string | optional | Unit ID |
| unitCode | string | optional | Unit code |
| unitNameTh | string | optional | Unit name in Thai |
| unitNameEn | string | optional | Unit name in English |
Response
{
"PeakServices": {
"resCode": "200",
"resDesc": "PeakServices have Completed",
"services": [{
"id": "09b31e2e-33e0-488c-89a4-a48b8b131475",
"name": "Create Service Example 1",
"code": "P00001",
"type": 2,
"purchaseValue": 10,
"purchaseVatType": 3,
"purchaseAccount": "114102",
"sellValue": 100,
"sellVatType": 3,
"sellAccount": "410101",
"description": "Design by PEAK",
"carryingBalanceValue": 20,
"carryingBalanceAmount": 15,
"remainingBalanceAmount": 20,
"resCode": "200",
"resDesc": "Success"
}]
}
}
ListService
WHEN TO USE Use to look up entries in the PEAK service catalog (บริการ) by keyword — before creating any document that includes service line items, so the correct service id and code go on the line, and before CreateService so an existing service is not duplicated. PEAK keeps services and products (สินค้า) in separate catalogs: ListProduct never returns services and this tool never returns products. To read one service you already have a code or id for, use GetService. BUSINESS RULES & PRE-CONDITIONS searchText matches the service name or related data; year filters by year (e.g. '2024'); limit and page paginate, and each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match does not mean the service must be created: confirm the spelling with the user, try ListProduct in case the item is a product, and fall back to an accountCode line item rather than creating catalog entries on your own initiative. EXPECTED OUTCOME Returns a paginated list of services (type 2) with id, name, code, sellValue, sellVatType, purchaseValue, purchaseVatType, and unit. totalService is PEAK's count of the whole catalog (products and services together), not the number of matches or of services — never report it as either.
0 required · 4 optional
ListService
WHEN TO USE Use to look up entries in the PEAK service catalog (บริการ) by keyword — before creating any document that includes service line items, so the correct service id and code go on the line, and before CreateService so an existing service is not duplicated. PEAK keeps services and products (สินค้า) in separate catalogs: ListProduct never returns services and this tool never returns products. To read one service you already have a code or id for, use GetService. BUSINESS RULES & PRE-CONDITIONS searchText matches the service name or related data; year filters by year (e.g. '2024'); limit and page paginate, and each page returns 10 entries. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match does not mean the service must be created: confirm the spelling with the user, try ListProduct in case the item is a product, and fall back to an accountCode line item rather than creating catalog entries on your own initiative. EXPECTED OUTCOME Returns a paginated list of services (type 2) with id, name, code, sellValue, sellVatType, purchaseValue, purchaseVatType, and unit. totalService is PEAK's count of the whole catalog (products and services together), not the number of matches or of services — never report it as either.
| Parameter | Type | Description | |
|---|---|---|---|
| year | string | optional | Filter by year (e.g. '2024'). |
| searchText | string | optional | Search keyword for service name or related data. |
| limit | integer? | optional | Maximum number of entries to retrieve. |
| page | integer? | optional | Page number for displaying data, where each page will show 10 entries. |
Response
{
"PeakServices": {
"resCode": "200",
"resDesc": "PeakServices have Completed",
"totalService": 2650,
"services": [{
"id": "b0d31e48-a519-49b5-9750-29e9671299d3",
"name": "Service Example 1",
"code": "P00001",
"type": 2,
"resCode": "200",
"resDesc": "Success"
}]
}
}
GetService
WHEN TO USE Use to read ONE service (บริการ) you already have a code or id for — typically to check its prices, VAT types, accounts or unit before putting it on a line item. This tool addresses a service directly; to search by keyword use ListService instead. For products (สินค้า) use GetProduct — PEAK keeps them in a separate catalog. BUSINESS RULES & PRE-CONDITIONS Supply code (recommended) or id; one of the two is required. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong or belongs to a product, not that the service must be created: confirm the code with the user or try GetProduct. Never invent a code or fabricate service details. EXPECTED OUTCOME Returns the matching service (type 2) with id, code, name, sellValue, sellVatType, sellAccount, purchaseValue, purchaseVatType, purchaseAccount and unit.
0 required · 2 optional
GetService
WHEN TO USE Use to read ONE service (บริการ) you already have a code or id for — typically to check its prices, VAT types, accounts or unit before putting it on a line item. This tool addresses a service directly; to search by keyword use ListService instead. For products (สินค้า) use GetProduct — PEAK keeps them in a separate catalog. BUSINESS RULES & PRE-CONDITIONS Supply code (recommended) or id; one of the two is required. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING No match means the identifier is wrong or belongs to a product, not that the service must be created: confirm the code with the user or try GetProduct. Never invent a code or fabricate service details. EXPECTED OUTCOME Returns the matching service (type 2) with id, code, name, sellValue, sellVatType, sellAccount, purchaseValue, purchaseVatType, purchaseAccount and unit.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Service code to fetch ONE specific service, as shown in PEAK or returned by ListService. Recommended. |
| id | string | optional | The Unique Identifier of ONE specific service. Use when the code is unknown. |
Response
{
"PeakServices": {
"resCode": "200",
"resDesc": "Success",
"services": [{
"id": "guid",
"code": "P00001",
"name": "Service Name",
"type": 2,
"sellValue": 1000.00,
"sellVatType": 3,
"sellAccount": "410201",
"purchaseValue": 0,
"purchaseVatType": 3,
"purchaseAccount": "510101",
"resCode": "200",
"resDesc": "Success"
}]
}
}
EditService
WHEN TO USE Use to change an existing service (บริการ) in the PEAK service catalog — its price, name, code, VAT type, accounts, unit or description — when the user says the service's details have changed. This tool edits a Service only; for a product (สินค้า) use EditProduct. To register a new service use CreateService instead. BUSINESS RULES & PRE-CONDITIONS Identify the service by code (recommended) or id; resolve it with GetService or ListService first and never guess a code. Send only the fields that change — every field left blank keeps its current value in PEAK, including the unit. newCode renames the service's code; leave it blank to keep the code. sellValue and purchaseValue cannot be negative. VAT type is 1 = None, 2 = ZeroPercent, 3 = SevenPercent. This writes master data the whole organization reuses — show the user the current and new values and get explicit confirmation before calling. FALLBACK & ERROR HANDLING If the service is not found, nothing is changed: confirm the code with the user or try EditProduct in case the item is a product. Never invent an account code — resolve it with GetAccountCodes. If PEAK rejects the edit, report its message verbatim; the service was NOT changed. EXPECTED OUTCOME Returns PEAK's result for the edited service. Call GetService afterwards if the user wants to see the saved values.
0 required · 13 optional
EditService
WHEN TO USE Use to change an existing service (บริการ) in the PEAK service catalog — its price, name, code, VAT type, accounts, unit or description — when the user says the service's details have changed. This tool edits a Service only; for a product (สินค้า) use EditProduct. To register a new service use CreateService instead. BUSINESS RULES & PRE-CONDITIONS Identify the service by code (recommended) or id; resolve it with GetService or ListService first and never guess a code. Send only the fields that change — every field left blank keeps its current value in PEAK, including the unit. newCode renames the service's code; leave it blank to keep the code. sellValue and purchaseValue cannot be negative. VAT type is 1 = None, 2 = ZeroPercent, 3 = SevenPercent. This writes master data the whole organization reuses — show the user the current and new values and get explicit confirmation before calling. FALLBACK & ERROR HANDLING If the service is not found, nothing is changed: confirm the code with the user or try EditProduct in case the item is a product. Never invent an account code — resolve it with GetAccountCodes. If PEAK rejects the edit, report its message verbatim; the service was NOT changed. EXPECTED OUTCOME Returns PEAK's result for the edited service. Call GetService afterwards if the user wants to see the saved values.
| Parameter | Type | Description | |
|---|---|---|---|
| code | string | optional | Code of the service to edit, as shown in PEAK or returned by ListService. Recommended. Supply this or id. |
| id | string | optional | The Unique Identifier of the service to edit. Use when the code is unknown. |
| name | string | optional | New service name. Leave blank to keep the current name. |
| newCode | string | optional | New code to save for this service. Leave blank to keep the current code. |
| description | string | optional | New description. Leave blank to keep the current description. |
| sellValue | number? | optional | New selling price per unit. Must not be negative. Leave blank to keep the current price. |
| sellVatType | integer? | optional | New selling VAT type (1 = None, 2 = ZeroPercent, 3 = SevenPercent). Leave blank to keep the current one. |
| sellAccount | string | optional | New account code for revenue documents. Leave blank to keep the current account. |
| purchaseValue | number? | optional | New purchase price per unit. Must not be negative. Leave blank to keep the current price. |
| purchaseVatType | integer? | optional | New purchase VAT type (1 = None, 2 = ZeroPercent, 3 = SevenPercent). Leave blank to keep the current one. |
| purchaseAccount | string | optional | New account code for expense documents. Leave blank to keep the current account. |
| unitCode | string | optional | Code of the new service unit (e.g. 'SU0001'). Leave unitCode and unitId blank to keep the current unit. |
| unitId | string | optional | Unique Identifier of the new unit. Use when the unit code is unknown. |
Statement
4 tools
CreateStatement
WHEN TO USE Use to record bank-statement entries (รายการเดินบัญชีธนาคาร / statement ธนาคาร) — the lines a bank shows for money moving in and out of ONE of the business's bank accounts, kept in PEAK for bank reconciliation. Do not use it for a customer statement of account, for financial statements (use GetTrialBalance or GetGeneralLedger) or to record a sale, purchase or payment document (use CreateInvoice, CreateExpense, CreateReceipt). BUSINESS RULES & PRE-CONDITIONS Identify the bank account with paymentMethodCode or paymentMethodId — it must be a bank-account payment method; resolve it with GetPaymentMethod and never guess a code. Send 1 to 10 entries per call, all for that same account; split a longer bank statement into several calls and tell the user. Each entry needs a date (yyyyMMdd) and a non-zero amount: positive = money received into the account, negative = money paid out. The user needs the finance-information create permission in PEAK. FALLBACK & ERROR HANDLING resCode 391 means the bank account was not found — confirm the account with the user and retry; never invent a code. Any resCode other than 200 means NO entry was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the entries and returns each one with its id, amount, date and remark. Keep the ids — GetStatement and VoidStatement address an entry by its statementId only; there is no document code.
1 required · 2 optional
CreateStatement
WHEN TO USE Use to record bank-statement entries (รายการเดินบัญชีธนาคาร / statement ธนาคาร) — the lines a bank shows for money moving in and out of ONE of the business's bank accounts, kept in PEAK for bank reconciliation. Do not use it for a customer statement of account, for financial statements (use GetTrialBalance or GetGeneralLedger) or to record a sale, purchase or payment document (use CreateInvoice, CreateExpense, CreateReceipt). BUSINESS RULES & PRE-CONDITIONS Identify the bank account with paymentMethodCode or paymentMethodId — it must be a bank-account payment method; resolve it with GetPaymentMethod and never guess a code. Send 1 to 10 entries per call, all for that same account; split a longer bank statement into several calls and tell the user. Each entry needs a date (yyyyMMdd) and a non-zero amount: positive = money received into the account, negative = money paid out. The user needs the finance-information create permission in PEAK. FALLBACK & ERROR HANDLING resCode 391 means the bank account was not found — confirm the account with the user and retry; never invent a code. Any resCode other than 200 means NO entry was created: report resDesc rather than claiming success. EXPECTED OUTCOME Creates the entries and returns each one with its id, amount, date and remark. Keep the ids — GetStatement and VoidStatement address an entry by its statementId only; there is no document code.
| Parameter | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| statements | array[StatementEntry] | required | Bank-statement entries to create, 1 to 10 per call, all under the same bank account. array[StatementEntry] - sub-fields: amount (non-zero number as a string; positive = money in, negative = money out), date (yyyyMMdd), remarkarray[StatementEntry] fields
|
||||||||
| paymentMethodCode | string | optional | Code of the bank-account payment method the entries belong to (e.g. 'BSV001') (if paymentMethodId set, not required). GetPaymentMethod if don't known | ||||||||
| paymentMethodId | string | optional | Unique Identifier of the bank-account payment method the entries belong to |
GetStatement
WHEN TO USE Use to read ONE bank-statement entry (รายการเดินบัญชีธนาคาร) you already have the statementId for — to check its amount, date, remark, whether it has been reconciled, or before voiding it. To search entries by bank account and date range use ListStatement instead. BUSINESS RULES & PRE-CONDITIONS statementId (a UUID) is required; statement entries have no document code, so get the id from CreateStatement or ListStatement. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING resCode 626 means no entry has that id — confirm it with the user or find it with ListStatement rather than guessing. Never invent an id or fabricate entry contents. EXPECTED OUTCOME Returns the entry — id, amount (positive = money in, negative = money out), date, remark, isReconciled (1 = already matched in bank reconciliation) and isDeleted (1 = voided — GetStatement still returns voided entries, so this is the place to confirm a void). The response does not say which bank account the entry belongs to.
1 param
GetStatement
WHEN TO USE Use to read ONE bank-statement entry (รายการเดินบัญชีธนาคาร) you already have the statementId for — to check its amount, date, remark, whether it has been reconciled, or before voiding it. To search entries by bank account and date range use ListStatement instead. BUSINESS RULES & PRE-CONDITIONS statementId (a UUID) is required; statement entries have no document code, so get the id from CreateStatement or ListStatement. Read-only — nothing in PEAK is changed. FALLBACK & ERROR HANDLING resCode 626 means no entry has that id — confirm it with the user or find it with ListStatement rather than guessing. Never invent an id or fabricate entry contents. EXPECTED OUTCOME Returns the entry — id, amount (positive = money in, negative = money out), date, remark, isReconciled (1 = already matched in bank reconciliation) and isDeleted (1 = voided — GetStatement still returns voided entries, so this is the place to confirm a void). The response does not say which bank account the entry belongs to.
| Parameter | Type | Description | |
|---|---|---|---|
| statementId | string | required | REQUIRED. The Unique Identifier (UUID) of the statement entry, as returned by CreateStatement or ListStatement |
ListStatement
WHEN TO USE Use to search the bank-statement entries (รายการเดินบัญชีธนาคาร) of ONE bank account over a date range — to find an entry's statementId, review money in and out, or check what has been reconciled. To read one entry you already have the id for, use GetStatement instead. BUSINESS RULES & PRE-CONDITIONS Identify the bank account with paymentMethodCode or paymentMethodId (GetPaymentMethod if unknown). fromDate and toDate (yyyyMMdd) are REQUIRED and fromDate must not be after toDate. Results are PAGINATED: limit is 1 to 100 entries per page (default 10) and page starts at 1; totalStatement in the response is the total across all pages, so request the next page while more remain. Read-only; it never changes an entry. FALLBACK & ERROR HANDLING resCode 391 means the bank account was not found — confirm it with the user. Zero results usually means the date window or account is wrong — widen the range before concluding an entry is not there. Voided entries are NOT listed; to check whether a specific entry was voided, call GetStatement with its id. EXPECTED OUTCOME Returns the active (non-voided) statements — each with id, amount, date, remark and isReconciled (1 = already matched) — and totalStatement.
2 required · 4 optional
ListStatement
WHEN TO USE Use to search the bank-statement entries (รายการเดินบัญชีธนาคาร) of ONE bank account over a date range — to find an entry's statementId, review money in and out, or check what has been reconciled. To read one entry you already have the id for, use GetStatement instead. BUSINESS RULES & PRE-CONDITIONS Identify the bank account with paymentMethodCode or paymentMethodId (GetPaymentMethod if unknown). fromDate and toDate (yyyyMMdd) are REQUIRED and fromDate must not be after toDate. Results are PAGINATED: limit is 1 to 100 entries per page (default 10) and page starts at 1; totalStatement in the response is the total across all pages, so request the next page while more remain. Read-only; it never changes an entry. FALLBACK & ERROR HANDLING resCode 391 means the bank account was not found — confirm it with the user. Zero results usually means the date window or account is wrong — widen the range before concluding an entry is not there. Voided entries are NOT listed; to check whether a specific entry was voided, call GetStatement with its id. EXPECTED OUTCOME Returns the active (non-voided) statements — each with id, amount, date, remark and isReconciled (1 = already matched) — and totalStatement.
| Parameter | Type | Description | |
|---|---|---|---|
| fromDate | string | required | REQUIRED. Displays entries starting from the specified date (Format: yyyyMMdd). |
| toDate | string | required | REQUIRED. Displays entries up to the specified date (Format: yyyyMMdd). Must not be before fromDate. |
| paymentMethodCode | string | optional | Code of the bank-account payment method to list (e.g. 'BSV001') (if paymentMethodId set, not required). GetPaymentMethod if don't known |
| paymentMethodId | string | optional | Unique Identifier of the bank-account payment method to list |
| limit | integer? | optional | Entries per page, 1 to 100. Default 10 |
| page | integer? | optional | Page number, starting from 1. Default 1 |
VoidStatement
WHEN TO USE Only when the user explicitly asks to cancel an existing bank-statement entry (รายการเดินบัญชีธนาคาร). This cannot be undone — never void an entry to tidy up or to redo it on your own initiative. To correct an entry, void it and create a replacement with CreateStatement. BUSINESS RULES & PRE-CONDITIONS statementId (a UUID) is required; entries have no document code — use ListStatement or GetStatement to find the id. An entry that has already been reconciled or already voided cannot be voided. The user needs the finance-information delete permission in PEAK. FALLBACK & ERROR HANDLING This permanently cancels the entry — show the user its date, amount and remark and get explicit confirmation before calling. Any resCode other than 200 means the entry was NOT voided: report resDesc. resCode 626 = no entry with that id, 627 = already reconciled (undo the reconciliation in PEAK first), 628 = already voided — say so plainly instead of retrying. EXPECTED OUTCOME Returns a flat resCode / resDesc pair. On success the entry disappears from ListStatement, and GetStatement returns it with isDeleted = 1.
1 param
VoidStatement
WHEN TO USE Only when the user explicitly asks to cancel an existing bank-statement entry (รายการเดินบัญชีธนาคาร). This cannot be undone — never void an entry to tidy up or to redo it on your own initiative. To correct an entry, void it and create a replacement with CreateStatement. BUSINESS RULES & PRE-CONDITIONS statementId (a UUID) is required; entries have no document code — use ListStatement or GetStatement to find the id. An entry that has already been reconciled or already voided cannot be voided. The user needs the finance-information delete permission in PEAK. FALLBACK & ERROR HANDLING This permanently cancels the entry — show the user its date, amount and remark and get explicit confirmation before calling. Any resCode other than 200 means the entry was NOT voided: report resDesc. resCode 626 = no entry with that id, 627 = already reconciled (undo the reconciliation in PEAK first), 628 = already voided — say so plainly instead of retrying. EXPECTED OUTCOME Returns a flat resCode / resDesc pair. On success the entry disappears from ListStatement, and GetStatement returns it with isDeleted = 1.
| Parameter | Type | Description | |
|---|---|---|---|
| statementId | string | required | REQUIRED. The Unique Identifier (UUID) of the statement entry to void |
Tag
2 tools
InsertTag
WHEN TO USE Call after a document exists, when the user asks to label, group, or categorise documents — by period, project, department, branch, or any custom label. If the business has structured classification groups configured, prefer CreateTransactionClassification; tags are the free-form alternative. BUSINESS RULES & PRE-CONDITIONS Requires the transactionId and transactionTypeId of an existing document, so create or fetch the document first. Tags are free text and matched literally — reuse the exact spelling the business already uses, or 'Q1-2025' and 'Q1 2025' become two different tags. One array entry per document; several documents can be tagged in a single call. FALLBACK & ERROR HANDLING This writes to live documents — always show the user which tags go on which documents and get confirmation before calling. Each entry returns its own resCode, so a partial failure is possible: report exactly which documents failed instead of treating the call as all-or-nothing. EXPECTED OUTCOME Returns one result per document with transactionTypeId and resCode. Tagging is additive — tags already on the document are preserved.
1 param
InsertTag
WHEN TO USE Call after a document exists, when the user asks to label, group, or categorise documents — by period, project, department, branch, or any custom label. If the business has structured classification groups configured, prefer CreateTransactionClassification; tags are the free-form alternative. BUSINESS RULES & PRE-CONDITIONS Requires the transactionId and transactionTypeId of an existing document, so create or fetch the document first. Tags are free text and matched literally — reuse the exact spelling the business already uses, or 'Q1-2025' and 'Q1 2025' become two different tags. One array entry per document; several documents can be tagged in a single call. FALLBACK & ERROR HANDLING This writes to live documents — always show the user which tags go on which documents and get confirmation before calling. Each entry returns its own resCode, so a partial failure is possible: report exactly which documents failed instead of treating the call as all-or-nothing. EXPECTED OUTCOME Returns one result per document with transactionTypeId and resCode. Tagging is additive — tags already on the document are preserved.
| Parameter | Type | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| peakTags | array[PeakTagItem] | required | An array of PeakTagItem objects. Each object identifies one document and the tags to insert. Example: [{"transactionId":"123","transactionTypeId":106,"tags":["expense","Q1"]}]array[PeakTagItem] fields
|
Response
{
"PeakTags": [
{
"transactionTypeId": 106,
"resCode": "200",
"resDesc": "Success"
}
]
}
RemoveTag
WHEN TO USE Only when the user explicitly asks to remove a label from specific documents. Never call it to 'tidy up' or correct tags on your own initiative. BUSINESS RULES & PRE-CONDITIONS Requires transactionId, transactionTypeId, and the exact tag strings to remove — matching is literal, so confirm the document's current tags before calling. Removing a tag changes only the labelling, never the document's accounting data. FALLBACK & ERROR HANDLING This writes to live documents — always show which tags will be removed from which documents and get confirmation first. A tag that isn't present is not an error; don't retry with spelling variants. Each entry returns its own resCode, so report partial failures per document. EXPECTED OUTCOME Returns one result per document with transactionTypeId and resCode. Only the named tags are removed; every other tag on the document remains.
1 param
RemoveTag
WHEN TO USE Only when the user explicitly asks to remove a label from specific documents. Never call it to 'tidy up' or correct tags on your own initiative. BUSINESS RULES & PRE-CONDITIONS Requires transactionId, transactionTypeId, and the exact tag strings to remove — matching is literal, so confirm the document's current tags before calling. Removing a tag changes only the labelling, never the document's accounting data. FALLBACK & ERROR HANDLING This writes to live documents — always show which tags will be removed from which documents and get confirmation first. A tag that isn't present is not an error; don't retry with spelling variants. Each entry returns its own resCode, so report partial failures per document. EXPECTED OUTCOME Returns one result per document with transactionTypeId and resCode. Only the named tags are removed; every other tag on the document remains.
| Parameter | Type | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| peakTags | array[PeakTagItem] | required | An array of PeakTagItem objects. Each object identifies one document and the tags to remove. Example: [{"transactionId":"123","transactionTypeId":106,"tags":["expense","Q1"]}]array[PeakTagItem] fields
|
Response
{
"PeakTags": [
{
"transactionTypeId": 106,
"resCode": "200",
"resDesc": "Success"
}
]
}
Enum Reference
All integer enum values used across tools
ContactEnum values for contact parameters
Contact
Enum values for contact parameters
| Parameter | Value | Name |
|---|---|---|
| type | 0 | None |
| 1 | LimitedLiabilityPartnership | |
| 2 | CompanyLimited | |
| 3 | PublicCompanyLimited | |
| 4 | Shop | |
| 5 | OrdinaryPerson | |
| 6 | BodyOfPersons | |
| 7 | Others | |
| 8 | OrdinaryPartnership | |
| 9 | Foundation | |
| 10 | Association | |
| 11 | JointVenture | |
| status | 0 | All |
| 1 | Active | |
| 2 | Inactive | |
| prefixNameType required when type=5 | 0 | None |
| 1 | Sir | |
| 2 | Mr | |
| 3 | Mrs | |
| 4 | Ms | |
| 5 | Other |
Product / ServiceEnum values for product and service parameters
Product / Service
Enum values for product and service parameters
| Parameter | Value | Name |
|---|---|---|
| type | 0 | None |
| 1 | Product | |
| 2 | Service | |
| sellVatType purchaseVatType | 1 | None |
| 2 | ZeroPercent | |
| 3 | SevenPercent |
Document (shared)Enum values shared across Invoice, Expense, Receipt, Quotation, PurchaseOrder, BillingNote, CreditNote
Document (shared)
Enum values shared across Invoice, Expense, Receipt, Quotation, PurchaseOrder, BillingNote, CreditNote
| Parameter | Value | Name |
|---|---|---|
| taxStatus | 0 | ExcludeTax |
| 1 | IncludeTax | |
| 2 | NonTax | |
| isTaxInvoice | 0 | No |
| 1 | Yes | |
| isCheque returnPaymentIsCheque | 0 | No |
| 1 | Yes | |
| status filter in Get methods | 0 | None |
| 1 | Voided | |
| 2 | Draft | |
| 3 | AwaitApproval | |
| 4 | Outstanding | |
| 5 | Overdue | |
| 6 | PaidOrAwaitReceipt |
Transaction TypetransactionType — used in CreditNote and Classification tools; referenceTransactionType — returned by GetDailyJournal
Transaction Type
transactionType — used in CreditNote and Classification tools; referenceTransactionType — returned by GetDailyJournal
| Parameter | Value | Name |
|---|---|---|
| transactionType referenceTransactionType | 101 | Quotation |
| 102 | Invoice | |
| 103 | Receipt | |
| 104 | Tax invoice | |
| 105 | Credit note | |
| 106 | Billing note | |
| 107 | Debit note | |
| 121 | Deposit | |
| 201 | Purchase order | |
| 202 | Expense | |
| 205 | Credit note expense | |
| 206 | Billing note expense | |
| 207 | Debit note expense | |
| 221 | Deposit expense | |
| 222 | Goods receipt | |
| 223 | Invoice receipt |
Credit NoteEnum values specific to credit note parameters
Credit Note
Enum values specific to credit note parameters
| Parameter | Value | Name |
|---|---|---|
| reasonType | 0 | None |
| 1 | PromotionAndMarketing | |
| 2 | OfficeUse | |
| 3 | ProductionUse | |
| 4 | ServiceUse | |
| 5 | Donation | |
| 6 | DamageOrLoss | |
| 7 | Others | |
| creditNoteStyleType | 0 | General |
| 1 | ThaiPopular | |
| goodsReturn | 0 | No |
| 1 | Yes |
Payment MethodEnum values for payment method parameters
Payment Method
Enum values for payment method parameters
| Parameter | Value | Name |
|---|---|---|
| type | 0 | Others (bankName required) |
| 1 | Cash | |
| 2 | BankAccount (bankId required) | |
| 3 | CreditCard | |
| 4 | EWallet (accountCode & eWalletId required) | |
| accountType | 1 | Current |
| 2 | Savings | |
| 3 | FixedDeposit | |
| isHaveCheque | 0 | No |
| 1 | Yes |