# Expenses
The expenses endpoint url is:
https://skhokho.io/api/v1.0/expenses
# Expense GET Request
Expenses GET request will fetch a list of expenses associated with the company of the user who is currently authenticated. The structure of the list will be:
[
{
"id": 312,
"title": "Expense 1",
"price": "211.00",
"quantity": 3,
"total": "633.00",
"recurringMonthly": true,
"recurringDate": 29,
"status": "APPROVED",
"paid": false,
"vendor": {
"id": 73,
"companyName": "Jelly",
"companyEmail": "jelly@gmail.com",
"companyPhone": "099333733",
"companyTaxNumber": null,
"addressLine1": "1775 Kings Dr",
"city": "Kimberley",
"state": "Northern Cape",
"country": "South Africa",
"postalCode": "5323",
"uniqueId": "xxxxxxxxx"
},
"account": {
"id": 125,
"title": "Idle Time",
"description": "General account associated employee idle time, when not currently busy with any task or project",
"category": "ADMINISTRATIVE EXPENSES",
"openingBalance": null,
"active": true,
"allowBooking": true,
"uniqueId": "xxxxxxxxx"
},
"uniqueId": "xxxxxxxxx"
},
. . . . . // Other Results
]
When you request expense records, you also get the vendor record and accounts record associated with that expense. Note that the vendor and accounts records can be null.
# Expenses POST Request
When you want to create a new expense record, you can send a POST request to the expenses end-point.
When creating an expense, you will also need to specify the vendor and account associated with that expense. The account object is compulsory, while the vendor object is optional.
There are two options for adding an account or vendor to the expense:
- Specify a name of an existing account and/or vendor
- Supply enough information to create a new account and/or vendor record
# Expense Payload Example with existing Account and Vendor Record:
{
"title": "A new expense",
"price": "3245.00",
"quantity": 2,
"recurringMonthly": false,
"recurringDate": null,
"status": "CREATED",
"paid": false,
"vendor": {
"companyName": "Jelly"
},
"account": {
"title": "Study Leave"
}
}
Field | Required/Optional | Json Key | Data Type | Format |
---|---|---|---|---|
Tile of Expense | Required | title | string | |
Cost of Expense | Required | price | string | 345.12 |
Quantity of Expense | Required | quantity | integer | |
Recurring Expense | Optional | recurringMonthly | boolean | true/false |
Recurring Date | Optional | recurringDate | integer | 21 |
Status | Required | type | string/**fixed_options | |
Paid Expense | Optional | paid | boolean | true/false |
Vendor | Optional | vendor | json object | See Vendor API |
Account | Required | account | json object | See Account API |
** Expense type fixed options
[
'CREATED',
'APPROVED',
'REJECTED'
]
# Expense Payload Example with New Vendor and Account Record:
{
"title": "A new expense",
"price": "3245.00",
"quantity": 2,
"recurringMonthly": false,
"recurringDate": null,
"status": "CREATED",
"paid": false,
"vendor": {
"companyName": "Skhokho Business",
"companyEmail": "skhokho@gmail.com",
"companyPhone": "067666886",
"companyTaxNumber": "536563252",
"addressLine1": "35 Church Street",
"city": "Fourways",
"state": "Gauteng",
"country": "South Africa",
"postalCode": "2191",
},
"account": {
"title": "Paternity Leave",
"description": "Time associated with paternity leave days.",
"category": "ADMINISTRATIVE EXPENSES",
"openingBalance": null,
"active": true,
"allowBooking": true
}
}
TIP
See Vendor/Account API to get the full data structure of the Vendor/Account Object. Some of the fields are Fixed Options fields with set options to choose from like a drop-down menu.
← Vendors