Skip to content

API reference / RivetMSP

Expenses

GET /expenses Bearer token or API key

List expenses (paged)

Parameters

NameInTypeDescription
pagequeryinteger
limitqueryinteger

Example request

curl "https://YOUR-HOST/api/v1/expenses" \
  -H "Authorization: Bearer $TOKEN"
import requests

response = requests.get(
    "https://YOUR-HOST/api/v1/expenses",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
print(response.json())
const response = await fetch("https://YOUR-HOST/api/v1/expenses", {
  method: "GET",
  headers: { "Authorization": `Bearer ${TOKEN}` },
});
const data = await response.json();
$ch = curl_init("https://YOUR-HOST/api/v1/expenses");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
]);
$data = json_decode(curl_exec($ch), true);

Responses

200Paged expense list

FieldTypeDescription
data array of object
data[].id integer
data[].description string
data[].amount number
data[].currency string
data[].date string
data[].reference string
data[].payment_method string
data[].has_receipt boolean
data[].client string
total integer
Example response
json
{
    "data": [
        {
            "id": 1,
            "description": "string",
            "amount": 1.5,
            "currency": "string",
            "date": "string",
            "reference": "string",
            "payment_method": "string",
            "has_receipt": true,
            "client": "string"
        }
    ],
    "total": 1
}
POST /expenses Bearer token or API key

Create an expense (multipart, optional receipt upload)

Request body (multipart/form-data, required)

FieldTypeDescription
descriptionrequired string
amountrequired number
date string (date)
currency string
reference string
payment_method string
client_id integer
receipt string (binary)

Example request

curl -X POST "https://YOUR-HOST/api/v1/expenses" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","amount":1.5,"date":"string","currency":"string","reference":"string","payment_method":"string","client_id":1,"receipt":"string"}'
import requests

response = requests.post(
    "https://YOUR-HOST/api/v1/expenses",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={
        "description": "string",
        "amount": 1.5,
        "date": "string",
        "currency": "string",
        "reference": "string",
        "payment_method": "string",
        "client_id": 1,
        "receipt": "string"
    },
)
print(response.json())
const response = await fetch("https://YOUR-HOST/api/v1/expenses", {
  method: "POST",
  headers: { "Authorization": `Bearer ${TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
      "description": "string",
      "amount": 1.5,
      "date": "string",
      "currency": "string",
      "reference": "string",
      "payment_method": "string",
      "client_id": 1,
      "receipt": "string"
  }),
});
const data = await response.json();
$ch = curl_init("https://YOUR-HOST/api/v1/expenses");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer $token", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => '{"description":"string","amount":1.5,"date":"string","currency":"string","reference":"string","payment_method":"string","client_id":1,"receipt":"string"}',
]);
$data = json_decode(curl_exec($ch), true);

Responses

201Expense created

FieldTypeDescription
id integer
Example response
json
{
    "id": 1
}

400Bad request

FieldTypeDescription
error string

403Authenticated but not permitted

FieldTypeDescription
error string