Expenses Endpoint

Expenses are the record of direct expenditures of your business.

To understand the object structure, see:

get
Get an expense

https://api.pymlo.com/v1/businesses/<businessid>/expense/expenses/<id>
Get data of a single expense data with ID.
Request
Response
Request
Path Parameters
businessid
required
string
Business profile ID.
id
required
string
ID of the target expense to retrieve.
Headers
Authentication
required
string
Authentication token.
Response
200: OK
Data successfully retrieved.
{
"date_created": 1566981919419,
"date_updated": 1566981919419,
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"date": "2019-07-30",
"receipt_no": "RCTXXXOOO",
"description": "Staff year-end party.",
"sub_total": 1600.00000,
"tax": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "VAT-7",
"name": "Value Added Tax (7%)",
"description": null,
"latest_rate": 0.07000,
"_id": "989bcfad-b710-493e-aca6-22f9554ca07e"
},
"tax_amount": 112.0000000000,
"total": 1712.0000000000,
"total_in_booking_currency": 1712.00,
"currency_code": "THB",
"currency_rate": 1,
"expense_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "5210",
"name": "Meals and Entertainment",
"type": "EXPENSE_OPERATING",
"_id": "a86d6497-e66a-422a-a6d2-b26d53c01248"
},
"payment_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "1103",
"name": "Savings account in OCBC Bank",
"type": "ASSET_CURRENT",
"_id": "e2cf8550-9ea8-4371-a33d-8ace5867cc66"
},
"vendor": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": null,
"name": "Kasoft Wealth Management Public",
"email": null,
"contact_name": null,
"note": null,
"_id": "48f4a46a-e44f-4eab-823d-9a3a55d870a8"
},
"_id": "6c565a41-c53d-49f3-91cf-1f8634618a91",
"_links": {
"self": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses/6c565a41-c53d-49f3-91cf-1f8634618a91"
}
}
}
404: Not Found
Could not find data with the matching IDs.
{
"apierror": {
"status": "NOT_FOUND",
"timestamp": "28-08-2019 03:56:23",
"message": "Cannot find requested data or incorrect company/business profile",
"debug_message": null,
"sub_errors": null
}
}

get
Get a list of expenses

https://api.pymlo.com/v1/businesses/<businessid>/expense/expenses
Get paginated data of multiple expenses.
Request
Response
Request
Path Parameters
businessid
required
string
Business profile ID.
Headers
Authentication
required
string
Authentication token.
Query Parameters
dateAfter
optional
string
Filter expenses with dates equal or after the given date. Required date format: YYYY-MM-DD.
dateBefore
optional
string
Filter expenses with dates equal or before the given date. Required date format: YYYY-MM-DD.
currency
optional
string
Filter expenses in the currency of the given code. (ISO 4217 codes like USD and EUR)
vendor
optional
string
Filter expenses with vendors whose codes and names contain the given string.
receiptNo
optional
string
Filter expenses with receipt numbers containing the given string.
paymentAccount
optional
string
Filter expenses with payment accounts of which codes and titles contain the given string.
expenseAccount
optional
string
Filter expenses with expense accounts of which codes and titles contain the given string.
Response
200: OK
List of data successfully retrieved.
{
"_embedded": {
"expenseDTOList": [
{
"date_created": 1529415467193,
"date_updated": null,
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"date": "2018-09-01",
"receipt_no": "vFpwaQR",
"description": "La mictes, ni.",
"sub_total": 1746.00000,
"tax": null,
"tax_amount": 0.00000,
"total": 1746.00000,
"total_in_booking_currency": 30135.52,
"currency_code": "BBD",
"currency_rate": 17.259750,
"expense_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "5206",
"name": "Computer - Internet",
"type": "EXPENSE_OPERATING",
"_id": "4bc40938-3899-443f-8d38-815532ba65e0"
},
"payment_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "1101",
"name": "Cash on hand",
"type": "ASSET_CURRENT",
"_id": "810964a1-f5f1-49bb-a56c-b61c0d627b0f"
},
"vendor": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "L-HSP-001-12",
"name": "Best Partner Co. Ltd.",
"email": null,
"contact_name": null,
"note": null,
"_id": "b9fd79a4-cace-4b87-be6b-454b385ff829"
},
"_id": "38fdd634-5f6d-4d9d-ad9c-53de6d4c56f1",
"_links": {
"self": {
"href": "http://localhost:8081/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses/38fdd634-5f6d-4d9d-ad9c-53de6d4c56f1"
}
}
},
...
]
},
"_links": {
"first": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses?page=0&size=20&sort=date,id,desc"
},
"self": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses?page=0&size=20&sort=date,id,desc"
},
"next": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses?page=1&size=20&sort=date,id,desc"
},
"last": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses?page=1&size=20&sort=date,id,desc"
}
},
"page": {
"size": 20,
"total_elements": 25,
"total_pages": 2,
"number": 0
}
}
204: No Content
No data found with the given query.

post
Create a new expense

https://api.pymlo.com/v1/businesses/<businessid>/expense/expenses
Create a new expense. Data to persist should be sent as the request body.
Request
Response
Request
Path Parameters
businessid
required
string
Business profile ID.
Headers
Authentication
required
string
Authentication token.
Body Parameters
date
required
string
The expense date in YYYY-MM-DD format.
description
optional
string
The description elaborating this expense.
currency_code
required
string
The currency code of this invoice. (ISO 4217 codes like USD and EUR)
currency_rate
optional
number
The expense currency to your bookkeeping currency rate. Will be filled with current rate if missing.
sub_total
required
number
The sub-total amount of this expense, with tax excluded.
expense_account
required
object
The expense account of this expense record. See AccountReference.
payment_account
required
object
The payment account of this expense record. See AccountReference.
vendor
required
object
The vendor of Partner type that this expense is made to. See PartnerReference.
tax
optional
object
The tax of Tax type of this expense, if applicable. See TaxReference.
Response
200: OK
Data is created as in the response body.
{
"date_created": 1566981919419,
"date_updated": 1566981919419,
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"date": "2019-07-30",
"receipt_no": "RCTXXXOOO",
"description": "Staff year-end party.",
"sub_total": 1600.00000,
"tax": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "VAT-7",
"name": "Value Added Tax (7%)",
"description": null,
"latest_rate": 0.07000,
"_id": "989bcfad-b710-493e-aca6-22f9554ca07e"
},
"tax_amount": 112.0000000000,
"total": 1712.0000000000,
"total_in_booking_currency": 1712.00,
"currency_code": "THB",
"currency_rate": 1,
"expense_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "5210",
"name": "Meals and Entertainment",
"type": "EXPENSE_OPERATING",
"_id": "a86d6497-e66a-422a-a6d2-b26d53c01248"
},
"payment_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "1103",
"name": "Savings account in OCBC Bank",
"type": "ASSET_CURRENT",
"_id": "e2cf8550-9ea8-4371-a33d-8ace5867cc66"
},
"vendor": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": null,
"name": "Kasoft Wealth Management Public",
"email": null,
"contact_name": null,
"note": null,
"_id": "48f4a46a-e44f-4eab-823d-9a3a55d870a8"
},
"_id": "6c565a41-c53d-49f3-91cf-1f8634618a91",
"_links": {
"self": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses/6c565a41-c53d-49f3-91cf-1f8634618a91"
}
}
}
Sample request body
{
"date": "2019-07-30",
"receipt_no": "RCTXXXOOO",
"description": "Staff year-end party.",
"sub_total": 1600.00000,
"tax": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "989bcfad-b710-493e-aca6-22f9554ca07e"
},
"currency_code": "THB",
"currency_rate": 1.00000,
"expense_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "a86d6497-e66a-422a-a6d2-b26d53c01248"
},
"payment_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "e2cf8550-9ea8-4371-a33d-8ace5867cc66"
},
"vendor": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "48f4a46a-e44f-4eab-823d-9a3a55d870a8"
}
}

Inclusive taxes are not supported in the Expenses feature... yet!

put
Update the expense

https://api.pymlo.com/v1/businesses/<businessid>/expense/expenses/<id>
Update the expense with the given ID. Data to persist should be sent as the request body.
Request
Response
Request
Path Parameters
id
required
string
ID of the target expense to update.
businessid
required
string
Business profile ID.
Headers
Authentication
required
string
Authentication token.
Body Parameters
_id
required
string
ID of the target expense to update. Must be identical to that as the path parameter.
date
required
string
The expense date in YYYY-MM-DD format.
description
optional
string
The description elaborating this expense.
currency_code
required
string
The currency code of this invoice. (ISO 4217 codes like USD and EUR)
currency_rate
optional
number
The expense currency to your bookkeeping currency rate. Will be filled with current rate if missing.
sub_total
required
number
The sub-total amount of this expense, with tax excluded.
expense_account
required
object
The expense account of this expense record. See AccountReference.
payment_account
required
object
The payment account of this expense record. See AccountReference.
vendor
required
object
The vendor of Partner type that this expense is made to. See PartnerReference.
tax
optional
object
The tax of Tax type of this expense, if applicable. See TaxReference.
Response
200: OK
Data is updated as in the response body.
{
"date_created": 1566981919419,
"date_updated": 1566992365382,
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"date": "2019-07-30",
"receipt_no": "RCTXXXOOO-1",
"description": "Staff year-end party. (With more tacos!)",
"sub_total": 2500.00000,
"tax": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "VAT-7",
"name": "Value Added Tax (7%)",
"description": null,
"latest_rate": 0.07000,
"_id": "989bcfad-b710-493e-aca6-22f9554ca07e"
},
"tax_amount": 175.0000000000,
"total": 2675.0000000000,
"total_in_booking_currency": 2675.00,
"currency_code": "THB",
"currency_rate": 1,
"expense_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "5210",
"name": "Meals and Entertainment",
"type": "EXPENSE_OPERATING",
"_id": "a86d6497-e66a-422a-a6d2-b26d53c01248"
},
"payment_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": "1103",
"name": "Savings account in OCBC Bank",
"type": "ASSET_CURRENT",
"_id": "e2cf8550-9ea8-4371-a33d-8ace5867cc66"
},
"vendor": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"code": null,
"name": "Kasoft Wealth Management Public",
"email": null,
"contact_name": null,
"note": null,
"_id": "48f4a46a-e44f-4eab-823d-9a3a55d870a8"
},
"_id": "6c565a41-c53d-49f3-91cf-1f8634618a91",
"_links": {
"self": {
"href": "https://api.pymlo.com/v1/businesses/a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1/expense/expenses/6c565a41-c53d-49f3-91cf-1f8634618a91"
}
}
}
Sample request body
{
"date": "2019-07-30",
"receipt_no": "RCTXXXOOO-1",
"description": "Staff year-end party. (With more tacos!)",
"sub_total": 2500.00000,
"tax": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "989bcfad-b710-493e-aca6-22f9554ca07e"
},
"currency_code": "THB",
"expense_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "a86d6497-e66a-422a-a6d2-b26d53c01248"
},
"payment_account": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "e2cf8550-9ea8-4371-a33d-8ace5867cc66"
},
"vendor": {
"company_id": "a8ddc6fd-9f34-43c9-a3e2-ecac869cc5f1",
"_id": "48f4a46a-e44f-4eab-823d-9a3a55d870a8"
},
"_id": "6c565a41-c53d-49f3-91cf-1f8634618a91"
}

Inclusive taxes are not supported in the Expenses feature... yet!

delete
Delete the expense

https://api.pymlo.com/v1/businesses/<businessid>/expense/expenses/<id>
Delete the expense with the given ID.
Request
Response
Request
Path Parameters
businessid
required
string
Business profile ID.
id
required
string
ID of the target expense to delete.
Headers
Authentication
required
string
Authentication token.
Response
204: No Content
Data is deleted.