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.
  • 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

  • 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

NameTypeSampleExplanation
category_id
post
int224SELECT CATEGORY id from ExpensesCategories.List. Alias: category.
amount
post
number224.00Expense amount.
document_type
post
stringdelivery_invoicedelivery_invoice | invoice | receipt_tax_invoice | receipt.
month
post
string2026-07SELECT MONTH as YYYY-MM (dashboard type=month). Stored as mmyy. Alias: create_date.

Optional Parameters

NameTypeSampleWhat it gives
expense_name
post
stringOffice rentEXPENSE NAME. Aliases: name, expenses_name.
customer_id
post
int123CHOOSE CUSTOMER contactus id. Aliases: cust_id, contactus_id. Default 0.
sub_category_id
post
int45SELECT SUB CATEGORY. Alias: sub_category. Default 0.
project_id
post
int700PROJECT id. Default 0.
vat_includes
post
int1VAT included checkbox. Alias: expences_text_includes. Default 0.
payment_date
post
date2026-07-17PAYMENT 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_number
post
stringCHK-100CHECK NUMBER.
invoice_number
post
stringINV-25INVOICE NUMBER.
document_date
post
date2026-07-17DOCUMENT 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_id
post
int80SUPPLIERS id from Suppliers.List. Default 0.
notes
post
stringOffice suppliesNOTE. Alias: note.
file_path
post
urlhttps://example.com/receipt.jpgIMAGE URL stored in image. Alias maps file_path → image.

Authentication

Send the bearer token returned by Login in the request header.

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.Add

Sample 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"
}