API Reference

Expenses

Endpoints

GET /v1/expenses/
GET /v1/expenses/:id/
POST /v1/expenses/
PATCH /v1/expenses/:id/
DELETE /v1/expenses/:id/

Expense object

AttributesTypeDescription
idstringThe id of the object.
accountstringThe id of the account.
paid_through_accountstringThe id of the account used for the payment.
contactstringThe id of the contact.
amountnumberThe expense amount.
currencystringThe currency used in the expense.
tax_ratestringThe id of the tax rate.
amount_tax_typestringEither TAX_INCLUSIVE or TAX_EXCLUSIVE.
descriptionstringThe description attached to it.
datestringThe date of the expense.
referencestringA reference attached to the expense.

Example

{
	"account": "acc_ecKYVzRBqRqWhguoWqWqYT",
	"amount_tax_type": "TAX_INCLUSIVE",
	"amount": 12.0,
	"contact": null,
	"currency": "SAR",
	"date": "2022-07-19",
	"description": "A long description",
	"id": "exp_6E8yfeBkLUM2yi3m7F4aie",
	"paid_through_account": "acc_Xjwoy4VSKtVm6gEYcC9ZKR",
	"reference": "A reference to be reused",
	"tax_rate": "tax_BbdyVvf3kv6uj78nK5772t"
}

Get expense

Endpoint

GET /v1/expenses/:id/

Response sample

{
	"account": "acc_ecKYVzRBqRqWhguoWqWqYT",
	"amount_tax_type": "TAX_INCLUSIVE",
	"amount": 12.0,
	"contact": null,
	"currency": "SAR",
	"date": "2022-07-19",
	"description": "A long description",
	"id": "exp_6E8yfeBkLUM2yi3m7F4aie",
	"paid_through_account": "acc_Xjwoy4VSKtVm6gEYcC9ZKR",
	"reference": "A reference to be reused",
	"tax_rate": "tax_BbdyVvf3kv6uj78nK5772t"
}

List expenses

Endpoint

GET /v1/expenses/

Filters

Query paramTypeDescription
accountstringThe identifier of a account
paid_through_accountstringThe identifier of a paid_through_account
contactstringThe identifier of a contact

Request

curl --location \
    --request GET 'https://api.wafeq.com/v1/expenses/?paid_through_account=undefined' \
    --header 'Authorization: Api-Key <api_key>' \
    --header 'Content-Type: application/json'

Create expense

Endpoint

POST /v1/expenses/

Request body

AttributesTypeDescription
datestringThe date of the expense.
accountstringThe id of the expense account to categorize the expense.
paid_through_accountstringThe id of the account used to pay for the expense.
currencystringThe currency used in the expense.
amountnumberThe expense amount.
contactstring(Optional) The id of the contact (vendor).
tax_ratestring(Optional) The id of the tax rate.
amount_tax_typestring(Optional) Either TAX_INCLUSIVE or TAX_EXCLUSIVE. Required if tax_rate is provided.
descriptionstring(Optional) The description attached to it.
referencestring(Optional) A reference attached to the expense.

Request

curl --location \
    --request POST 'https://api.wafeq.com/v1/expenses/' \
    --header 'Authorization: Api-Key <api_key>' \
    --header 'Content-Type: application/json' \
      --data-raw '{
	"account": "<account>",
	"paid_through_account": "<paid_through_account>",
	"amount": 12,
	"currency": "SAR",
	"amount_tax_type": "TAX_INCLUSIVE",
	"description": "This is a test from the API",
	"date": "2022-07-19",
	"reference": "A reference to be reused",
	"tax_rate": "<tax_rate>"
}'

Update expense

PATCH /v1/expenses/:id/

Request body

AttributesTypeDescription
datestringThe date of the expense.
accountstringThe id of the expense account to categorize the expense.
paid_through_accountstringThe id of the account used to pay for the expense.
currencystringThe currency used in the expense.
amountnumberThe expense amount.
contactstring(Optional) The id of the contact (vendor).
tax_ratestring(Optional) The id of the tax rate.
amount_tax_typestring(Optional) Either TAX_INCLUSIVE or TAX_EXCLUSIVE. Required if tax_rate is provided.
descriptionstring(Optional) The description attached to it.
referencestring(Optional) A reference attached to the expense.

Delete expense

DELETE /v1/expenses/:id/
Previous
Debit Notes