POST
Expenses.Add
Create an expense the same way as the Biz1 dashboard New Expense modal (Expences::add_expenses → expenses_new). Required: category_id, amount, document_type, month. Optional expense_name and customer_id match EXPENSE NAME / CHOOSE CUSTOMER. month is sent as YYYY-MM and stored as mmyy (2026-07 → 0726), same as the dashboard.
Permissions
- User must be logged in with a valid bearer token.
- The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
- Returned or changed records are limited by the user permissions, team access, folder access, and account settings.
Action
- Creates a Expenses record or sends the requested data after validation.
Push Service
Pushes event expenses.created to users who should see this change.
Automation
No automation is run for this function.
Special Instructions
- On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
- Matches dashboard form fields: expense_name, customer_id, category_id, sub_category_id, project_id, month, amount, vat_includes, payment_date, check_number, document_type, invoice_number, supplier_id, document_date, notes, image/file_path.
- EXPENSE NAME → expense_name (aliases: name, expenses_name). Stored as expenses_name.
- CHOOSE CUSTOMER → customer_id (aliases: cust_id, contactus_id). Default 0.
- SELECT CATEGORY → category_id from ExpensesCategories.List. SELECT SUB CATEGORY → sub_category_id.
- month: send YYYY-MM like the dashboard month picker; server stores mmyy (e.g. 0726). Already-stored mmyy is also accepted.
- document_type values: delivery_invoice, invoice, receipt_tax_invoice, receipt. receipt / receipt_tax_invoice set paid_status=1 (dashboard rule).
- If payment_date / document_date are omitted, both default to today (Y-m-d), same as dashboard.
- vat_includes alias: expences_text_includes (dashboard checkbox name).
Required Parameters
| Name | Type | Sample | Explanation |
|---|---|---|---|
category_idpost | int | 224 | SELECT CATEGORY id from ExpensesCategories.List. Alias: category. |
amountpost | number | 224.00 | Expense amount. |
document_typepost | string | delivery_invoice | delivery_invoice | invoice | receipt_tax_invoice | receipt. |
monthpost | string | 2026-07 | SELECT MONTH as YYYY-MM (dashboard type=month). Stored as mmyy. Alias: create_date. |
Optional Parameters
| Name | Type | Sample | What it gives |
|---|---|---|---|
expense_namepost | string | Office rent | EXPENSE NAME. Aliases: name, expenses_name. |
customer_idpost | int | 123 | CHOOSE CUSTOMER contactus id. Aliases: cust_id, contactus_id. Default 0. |
sub_category_idpost | int | 45 | SELECT SUB CATEGORY. Alias: sub_category. Default 0. |
project_idpost | int | 700 | PROJECT id. Default 0. |
vat_includespost | int | 1 | VAT included checkbox. Alias: expences_text_includes. Default 0. |
payment_datepost | date | 2026-07-17 | PAYMENT DATE Y-m-d. Defaults to today when omitted. Send date filters and date values as UTC Y-m-d H:i:s when the route accepts date/time; date-only table columns store the Y-m-d date part. |
check_numberpost | string | CHK-100 | CHECK NUMBER. |
invoice_numberpost | string | INV-25 | INVOICE NUMBER. |
document_datepost | date | 2026-07-17 | DOCUMENT DATE Y-m-d. Defaults to today when omitted. Send date filters and date values as UTC Y-m-d H:i:s when the route accepts date/time; date-only table columns store the Y-m-d date part. |
supplier_idpost | int | 80 | SUPPLIERS id from Suppliers.List. Default 0. |
notespost | string | Office supplies | NOTE. Alias: note. |
file_pathpost | url | https://example.com/receipt.jpg | IMAGE URL stored in image. Alias maps file_path → image. |
Authentication
Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).
Authorization: Bearer YOUR TOKEN
Sample Request
{
"url": "\/app\/Expenses.Add",
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR TOKEN"
},
"body": {
"category_id": "224",
"amount": "224.00",
"document_type": "delivery_invoice",
"month": "2026-07",
"expense_name": "Office rent",
"customer_id": "123",
"sub_category_id": "0",
"vat_includes": "1",
"notes": "July office rent"
},
"url_user": "https:\/\/{user}.bull36.com\/app\/Expenses.Add",
"url_domain": "https:\/\/{domain}\/app\/Expenses.Add"
}Endpoint
POST /app/Expenses.Add
POST https://{user}.bull36.com/app/Expenses.Add
POST https://{domain}/app/Expenses.AddSample Output
{
"success": 1,
"message": "Record added successfully.",
"id": "900",
"automation_event": null,
"socket_event": "expenses.created"
}JavaScript Example
const token = 'YOUR TOKEN';
const body = new URLSearchParams({
category_id: '224',
amount: '224.00',
document_type: 'delivery_invoice',
month: '2026-07',
expense_name: 'Office rent',
customer_id: '123',
vat_includes: '1'
});
const res = await fetch('/app/Expenses.Add', {
method: 'POST',
headers: { Authorization: 'Bearer ' + token },
body
});
console.log(await res.json());Error Example
{
"success": 0,
"message": "Missing required parameter: category_id, amount, document_type, month"
}