List All Expenses

get https://api.vendloop.com/expenses

Returns a paginated list of expenses sorted by date in descending order.

Header

Authorization
String
Set value to Bearer SECRET_KEY
employee_id
integer
Specify an ID to retrieve expenses made by the selected employee only
start_date
datetime
A timestamp from which to start listing expenses. see date & time formats section
end_date
datetime
A timestamp from which to stop listing expenses. see date & time formats section
limit
integer
Specify how many records you want to retrieve per page. If not specified we use a default value of 50.
curl -L 'https://api.vendloop.com/expenses/' \
-H 'Authorization: Bearer SECRET_KEY'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.vendloop.com/expenses',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer SECRET_KEY");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.vendloop.com/expenses", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
val client = OkHttpClient()
val request = Request.Builder()
  .url("https://api.vendloop.com/expenses")
  .addHeader("Authorization", "Bearer SECRET_KEY")
  .build()
val response = client.newCall(request).execute()

Sample Response

{
  "status":true,
  "message":"Expense records found",
  "data":[
    {
      "id":"1",
      "date":"2023-07-21 10:28:00",
      "name":"Printhead change",
      "amount":"5000.0000",
      "reference":"EXP/468259723301",
      "business_id":"1",
      "store_id":"1",
      "category":{
        "id":"1",
        "name":"Maintenance and repairs",
        "code":"1111"
      },
      "employee_id":"2",
      "note":""
    }
  ],
  "metadata":{
    "limit":50,
    "start":1,
    "total":1
  }
}
{
    "status": false,
    "message": "Expense records not found"
}

Fetch a Single Expense

get https://api.vendloop.com/expenses/{id}

Returns details of an expense with the given ID.

Header

Authorization
String
Set value to Bearer SECRET_KEY
id required
integer
Auto-generated unique ID
reference
string
Specify the reference number for this expense. this is ignored if the id parameter is used
employee_id
integer
Specify an ID to retrieve expense made by the selected employee only
start_date
datetime
A timestamp from which to start listing expense. see date & time formats section
end_date
datetime
A timestamp from which to stop listing expense. see date & time formats section
curl -L 'https://api.vendloop.com/expenses/{id}' \
-H 'Authorization: Bearer SECRET_KEY'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.vendloop.com/expenses/{id}',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer SECRET_KEY");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.vendloop.com/expenses/{id}", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
val client = OkHttpClient()
val request = Request.Builder()
  .url("https://api.vendloop.com/expenses/{id}")
  .addHeader("Authorization", "Bearer SECRET_KEY")
  .build()
val response = client.newCall(request).execute()

Sample Response

{
  "status":true,
  "message":"Expense record found",
  "data":{
    "id":"1",
    "date":"2023-07-21 10:28:00",
    "name":"Printhead change",
    "amount":"5000.0000",
    "reference":"EXP/468259723301",
    "business_id":"1",
    "store_id":"1",
    "category":{
      "id":"1",
      "name":"Maintenance and repairs",
      "code":"1111"
    },
    "employee_id":"2",
    "note":""
  }
}
{
    "status": false,
    "message": "Expense record not found"
}

Delete a Single Expense

post https://api.vendloop.com/expenses/delete

Delete expense with the given ID.

Header

Authorization
String
Set value to Bearer SECRET_KEY
id required
integer
The ID of the expense to be deleted.
curl -L 'http://api.vendloop.com/expenses/delete' \
-H 'Authorization: Bearer SECRET_KEY' \
-F 'id="{id}"'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.vendloop.com/expenses/delete',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('id' => '{id}'),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer SECRET_KEY");

var formdata = new FormData();
formdata.append("id", "{id}");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://api.vendloop.com/expenses/delete", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
val client = OkHttpClient()
val mediaType = "text/plain".toMediaType()
val body = MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("id","{id}")
  .build()
val request = Request.Builder()
  .url("https://api.vendloop.com/expenses/delete")
  .post(body)
  .addHeader("Authorization", "Bearer SECRET_KEY")
  .build()
val response = client.newCall(request).execute()

Sample Response

{
  "status":true,
  "message":"Expense record deleted"
}
{
    "status": false,
    "message": "Expense record not found"
}