Add new expense
This interface is used to add a new expense record to a worker.
Add new expense
POST /add-ee-expense
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
customer_id
number
The unique Marco identifier for your company
email
string
Account email of the user
expense_date
date
Expense date
expense_name
string
Expense name or type
expense_status
string
Expense status Valid value: Submitted/Approved/Rejected/Processing/Processed
expense_currency
string
Expense currency
expense_amount
number
Expense amount
expense_notes
string
Expense notes or details
origin
string
Origin - For travel-related expenses
destination
string
Destination - For travel-related expenses
travel_start_date
date
Travel start date - For travel-related expenses
travel_end_date
date
Travel end date - For travel-related expenses
tax_free_payment_amount
number
The tax-free portion of th expense amount
tax_free_payment_currency
string
The tax-free portion's currency
taxable_payment_amount
number
The taxable portion of th expense amount
taxable_payment_currency
string
The taxable portion's currency
files
List of file resource
Related files
files_path
string
If the file cannot be uploaded, the file link will also work. Please use "," to separate multiple file links.
Parameter Example
{
"customer_id": 1,
"email": "[email protected]",
"expense_date": "2024-10-09",
"expense_name": "Airplane",
"expense_status": "Submitted",
"expense_currency": "CNY",
"expense_amount": "4585",
"expense_notes": "Testing API",
"origin": "China",
"destination": "Singapore",
"travel_start_date": "2024-10-07",
"travel_end_date": "2024-10-06",
"tax_free_payment_amount":"4000",
"tax_free_payment_currency":"CNY",
"taxable_payment_amount":"585",
"taxable_payment_currency":"CNY",
"files":[]
}Request Example
var form = new FormData();
form.append("customer_id", "1");
form.append("email", "[email protected]");
form.append("expense_date", "2024-10-11");
form.append("expense_name", "Hotel3");
form.append("expense_status", "Submitted");
form.append("expense_currency", "CNY");
form.append("expense_amount", "600");
form.append("expense_notes", "");
form.append("files[0]", fileInput.files[0], "/C:/Users/ZhounanZhang/OneDrive - Marco Global Payroll Pte Ltd/Desktop/New Microsoft Word Document.docx");
form.append("files[1]", fileInput.files[0], "/C:/Users/ZhounanZhang/OneDrive - Marco Global Payroll Pte Ltd/Desktop/PH-2.csv");
var token = YOUR_TOKEN
var settings = {
"url": "https://api.marcopayroll.com/api:eZ5RDmx2/api/add-ee-expense",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": token
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});import requests
url = "https://api.marcopayroll.com/api:eZ5RDmx2/api/add-ee-expense"
token = YOUR_TOKEN
payload = {'customer_id': '1',
'email': '[email protected]',
'expense_date': '2024-10-11',
'expense_name': 'Hotel3',
'expense_status': 'Submitted',
'expense_currency': 'CNY',
'expense_amount': '600',
'expense_notes': ''}
files=[
('files[0]',('New Microsoft Word Document.docx',open('/C:/Users/ZhounanZhang/OneDrive - Marco Global Payroll Pte Ltd/Desktop/New Microsoft Word Document.docx','rb'),'application/vnd.openxmlformats-officedocument.wordprocessingml.document')),
('files[1]',('PH-2.csv',open('/C:/Users/ZhounanZhang/OneDrive - Marco Global Payroll Pte Ltd/Desktop/PH-2.csv','rb'),'text/csv'))
]
headers = {
'Authorization': token
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Response
{
"id": 5250,
"customer_id": 1,
"user": 2232,
"expense_date": "2024-10-09",
"expense_currency": "CNY",
"expense_amount": 4585,
"title": "Airplane",
"doc_list": [],
"notes": "Testing API",
"travel_start_date": "2024-10-07",
"travel_end_date": "2024-10-06",
"origin": "China",
"destination": null,
"status": "Submitted",
"approver": 0,
"decision_time": null,
"decision": "",
"reject_notes": "",
"tax_free_payment_amount": 4000,
"tax_free_payment_currency": "CNY",
"tax_free_payment_entity": 0,
"taxable_payment_amount": 585,
"taxable_payment_currency": "CNY",
"taxable_payment_entity": 0,
"processing_notes": null,
"tax_record_list": [],
"user": 2232,
"platform_email": "[email protected]"
}//User is not exist
{
"traceId": "33dd7d70-1a8f-4f3b-9543-760fabe3a614",
"code": "ERROR_FATAL",
"message": "User is not exist.",
"payload": ""
}
//Token is incorrect
{
"traceId": "d2e8d2c7-2b29-4580-9106-4e2c9383b3fc",
"code": "ERROR_FATAL",
"message": "Please confirm the permissions of the token holder.",
"payload": ""
}Last updated