Expenses

Expenses represent expenses associated with an account.

The expense object

Properties

  • idstring

    Unique identifier for the object.

  • namestring

    The name of the expense.

  • amountnumber

    The amount of the expense.

  • archiveboolean

    True if the entity is archived.

  • clientobject

    The client.
  • currencyobject

    The currency.
  • dueDatedate

    The due date of the expense.

  • expenseDatedate

    The date of the expense.

  • externalReferencestring

    The external reference of the expense.

  • fileembedded

    The file associated with the expense.
  • invoiceobject

    The invoice linked to the expense.
  • jobstring

    The job id.

  • labelobject

    The label of the expense.
  • notesstring

    The notes linked to the entity.

  • outsourcingstring

    The outsourcing id.

  • paidboolean

    True if the entity is paid.

  • paymentDatedate

    The payment date of the expense.

  • pinnedboolean

    True if the entity is pinned.

  • purchaseOrderobject

    The linked purchase order.
  • supplierobject

    The supplier linked to the expense.
  • taxesobject

    The taxes.
  • totalnumber

    The total.

  • userobject

    The user that created the expense.
  • createdAtdate

    The date and time the entity was created.

  • updatedAtdate

    The date and time the entity was last updated.

Expense object

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  "amount": 90,
  "archive": false,
  "client": {
    "id": "6718a1350e27164043ce9e80",
    "name": "Microsoft"
  },
  "currency": {
    "code": "EUR",
    "symbol": "€"
  },
  "dueDate": "2024-12-17T23:00:00.000Z",
  "expenseDate": "2024-11-17T23:00:00.000Z",
  "job": "6718a1350e27164043ce9f2f",
  "label": {
    "id": "6718a0fd0e27164043ce97b0",
    "name": "Outsourcing",
    "color": "#15803D"
  },
  "notes": null,
  "object": "expense",
  "outsourcing": "6718a1a20e27164043cea544",
  "paid": false,
  "pinned": false,
  "purchaseOrder": {
    "id": "673b0ab223b8c71a21e1914b",
    "number": "003"
  },
  "supplier": {
    "id": "6718a1a20e27164043cea4e8",
    "name": "Caroline Dupont"
  },
  "taxes": {
    "tax1": {
      "id": "6718a0fd0e27164043ce97ae",
      "name": "VAT",
      "amount": 18.9
    }
  },
  "total": 108.9,
  "user": {
    "id": "6718a0b50e27164043ce912e",
    "name": "Cédric Doe"
  },
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:37:00.123Z"
}

GET/v2/expenses/

List all expenses

This endpoint allows you to retrieve all the expenses. This endpoint is paginated.

Filters

All the filters are optional and can be combined. See Pagination for the rules shared by all the list endpoints (multiple values, dates, keywords).

  • idstring

    Comma-separated list of expense ids.

  • namestring

    Only the expenses whose name contains this text (not case sensitive).

  • externalReferencestring

    Only the expenses whose external reference contains this text (not case sensitive).

  • label.idstring

    Comma-separated list of label ids.

  • supplier.idstring

    Comma-separated list of supplier ids.

  • client.idstring

    Comma-separated list of client ids.

  • projectManager.idstring

    Comma-separated list of user ids. Only the expenses of the clients managed by these users (project managers) are returned.

  • jobstring

    Comma-separated list of job ids. Only the expenses linked to one of these jobs are returned.

  • outsourcingstring

    Comma-separated list of outsourced job ids. Only the expenses linked to one of these outsourced jobs are returned.

  • invoice.idstring

    Comma-separated list of invoice ids. Only the expenses linked to one of these invoices are returned.

  • purchaseOrder.numberstring

    Only the expenses whose purchase order number contains this text (not case sensitive).

  • currencystring

    The currency code (ISO, e.g., EUR).

  • paidboolean

    true to retrieve only the paid expenses, false to retrieve only the unpaid ones.

  • archiveboolean

    true to retrieve only the archived expenses, false to exclude them. If not provided, both are returned.

  • expenseDateFromdate

    Only the expenses whose expense date is on or after this date (ISO 8601).

  • expenseDateTodate

    Only the expenses whose expense date is before this date (ISO 8601).

  • paymentDateFromdate

    Only the expenses whose payment date is on or after this date (ISO 8601).

  • paymentDateTodate

    Only the expenses whose payment date is before this date (ISO 8601).

  • dueDateFromdate

    Only the expenses whose due date is on or after this date (ISO 8601).

  • dueDateTodate

    Only the expenses whose due date is before this date (ISO 8601).

Sorting

  • sortstring

    The field to sort by. One of: label.name, dueDate, expenseDate, amount. The default is expenseDate.

  • directionstring

    The sort direction: asc or desc. The default is desc.

Request

GET
/v2/expenses/
curl -G https://api.lsp.expert/v2/expenses/ \
  -u {key}: 

Response

{
  "items": [
    {
      "id": "673b0abc23b8c71a21e1942a",
      "name": "First job",
      "amount": 90,
      "archive": false,
      "client": {
        "id": "6718a1350e27164043ce9e80",
        "name": "Microsoft"
      },
      "currency": {
        "code": "EUR",
        "symbol": "€"
      },
      "dueDate": "2024-12-17T23:00:00.000Z",
      "expenseDate": "2024-11-17T23:00:00.000Z",
      "job": "6718a1350e27164043ce9f2f",
      "label": {
        "id": "6718a0fd0e27164043ce97b0",
        "name": "Outsourcing",
        "color": "#15803D"
      },
      "notes": null,
      "object": "expense",
      "outsourcing": "6718a1a20e27164043cea544",
      "paid": false,
      "pinned": false,
      "purchaseOrder": {
        "id": "673b0ab223b8c71a21e1914b",
        "number": "003"
      },
      "supplier": {
        "id": "6718a1a20e27164043cea4e8",
        "name": "Caroline Dupont"
      },
      "taxes": {
        "tax1": {
          "id": "6718a0fd0e27164043ce97ae",
          "name": "VAT",
          "amount": 18.9
        }
      },
      "total": 108.9,
      "user": {
        "id": "6718a0b50e27164043ce912e",
        "name": "Cédric Doe"
      },
      "createdAt": "2024-11-18T09:37:00.109Z",
      "updatedAt": "2024-11-18T09:37:00.123Z"
    },
    // ...
  ],
  "pageSize": 20,
  "page": 1,
  "totalPages": 1,
  "totalItems": 2,
  "hasNextPage": false,
  "hasPreviousPage": false
}


POST/v2/expenses/

Create an expense

This endpoint allows you to add a new expense.

Parameters

  • namestring Required

    The name of the expense.

  • amountnumber Required

    The amount of the expense.

  • currencystring Required

    The currency code (ISO, e.g., EUR).

  • dueDatestring,null

    The due date of the expense.

  • exchangeRatenumber,null

    The exchange rate.

  • expenseDatestring Required

    The date of the expense.

  • externalReferencestring,null

    The external reference of the expense.

  • invoicestring

    The invoice id linked to the expense.

  • jobstring

    The job id linked to the expense.

  • labelstring Required

    The label id linked to the expense.

  • notesstring,null

    The notes linked to the entity.

  • outsourcingstring

    The outsourcing id linked to the expense.

  • paidboolean

    True if the entity is paid.

  • paymentDatestring,null

    The payment date of the expense.

  • supplierstring

    The supplier id linked to the expense.

  • tax1string,null

    The first tax id linked to the expense.

  • tax1Amountnumber,null

    The amount of the first tax.

  • tax2string,null

    The second tax id linked to the expense.

  • tax2Amountnumber,null

    The amount of the second tax.

Request

POST
/v2/expenses/
curl https://api.lsp.expert/v2/expenses/ \
  -u {key}: \
  -d amount=90 \
  -d currency="EUR" \
  -d expenseDate="2024-11-17T23:00:00.000Z" \
  -d label="6718a0fd0e27164043ce97b0" \
  -d name="First job" \
  -d paid=false \
  -d tax1="6718a0fd0e27164043ce97ae" \
  -d tax1Amount=18.9 \
  -d exchangeRate=null \
  -d job="6718a1350e27164043ce9f2f" \
  -d outsourcing="6718a1a20e27164043cea544"

Response

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  "amount": 90,
  "archive": false,
  "client": {
    "id": "6718a1350e27164043ce9e80",
    "name": "Microsoft"
  },
  "currency": {
    "code": "EUR",
    "symbol": "€"
  },
  "dueDate": "2024-12-17T23:00:00.000Z",
  "expenseDate": "2024-11-17T23:00:00.000Z",
  "job": "6718a1350e27164043ce9f2f",
  "label": {
    "id": "6718a0fd0e27164043ce97b0",
    "name": "Outsourcing",
    "color": "#15803D"
  },
  "notes": null,
  "object": "expense",
  "outsourcing": "6718a1a20e27164043cea544",
  "paid": false,
  "pinned": false,
  "purchaseOrder": {
    "id": "673b0ab223b8c71a21e1914b",
    "number": "003"
  },
  "supplier": {
    "id": "6718a1a20e27164043cea4e8",
    "name": "Caroline Dupont"
  },
  "taxes": {
    "tax1": {
      "id": "6718a0fd0e27164043ce97ae",
      "name": "VAT",
      "amount": 18.9
    }
  },
  "total": 108.9,
  "user": {
    "id": "6718a0b50e27164043ce912e",
    "name": "Cédric Doe"
  },
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:37:00.123Z"
}

GET/v2/expenses/:id

Retrieve an expense

This endpoint allows you to retrieve an expense by providing their id.

Request

GET
/v2/expenses/:id
curl https://api.lsp.expert/v2/expenses/673b0abc23b8c71a21e1942a \
  -u {key}:

Response

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  "amount": 90,
  "archive": false,
  "client": {
    "id": "6718a1350e27164043ce9e80",
    "name": "Microsoft"
  },
  "currency": {
    "code": "EUR",
    "symbol": "€"
  },
  "dueDate": "2024-12-17T23:00:00.000Z",
  "expenseDate": "2024-11-17T23:00:00.000Z",
  "job": "6718a1350e27164043ce9f2f",
  "label": {
    "id": "6718a0fd0e27164043ce97b0",
    "name": "Outsourcing",
    "color": "#15803D"
  },
  "notes": null,
  "object": "expense",
  "outsourcing": "6718a1a20e27164043cea544",
  "paid": false,
  "pinned": false,
  "purchaseOrder": {
    "id": "673b0ab223b8c71a21e1914b",
    "number": "003"
  },
  "supplier": {
    "id": "6718a1a20e27164043cea4e8",
    "name": "Caroline Dupont"
  },
  "taxes": {
    "tax1": {
      "id": "6718a0fd0e27164043ce97ae",
      "name": "VAT",
      "amount": 18.9
    }
  },
  "total": 108.9,
  "user": {
    "id": "6718a0b50e27164043ce912e",
    "name": "Cédric Doe"
  },
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:37:00.123Z"
}


PUT/v2/expenses/:id

Update an expense

This endpoint allows you to perform an update on an expense. Any parameters not provided will be left unchanged.

Parameters

  • namestring

    The name of the expense.

  • amountnumber

    The amount of the expense.

  • archiveboolean

    True if the entity is archived.

  • currencystring

    The currency code (ISO, e.g., EUR).

  • dueDatestring,null

    The due date of the expense.

  • exchangeRatenumber,null

    The exchange rate.

  • expenseDatestring

    The date of the expense.

  • externalReferencestring,null

    The external reference of the expense.

  • labelstring

    The label id linked to the expense.

  • notesstring,null

    The notes linked to the entity.

  • paidboolean

    True if the entity is paid.

  • paymentDatestring,null

    The payment date of the expense.

  • pinnedboolean

    True if the entity is pinned.

  • tax1string,null

    The first tax id linked to the expense.

  • tax1Amountnumber,null

    The amount of the first tax.

  • tax2string,null

    The second tax id linked to the expense.

  • tax2Amountnumber,null

    The amount of the second tax.

Request

PUT
/v2/expenses/:id
curl -X PUT https://api.lsp.expert/v2/expenses/673b0abc23b8c71a21e1942a \
  -u {key}: \
  -d paid=true

Response

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  "amount": 90,
  "archive": false,
  "client": {
    "id": "6718a1350e27164043ce9e80",
    "name": "Microsoft"
  },
  "currency": {
    "code": "EUR",
    "symbol": "€"
  },
  "dueDate": "2024-12-17T23:00:00.000Z",
  "expenseDate": "2024-11-17T23:00:00.000Z",
  "job": "6718a1350e27164043ce9f2f",
  "label": {
    "id": "6718a0fd0e27164043ce97b0",
    "name": "Outsourcing",
    "color": "#15803D"
  },
  "notes": null,
  "object": "expense",
  "outsourcing": "6718a1a20e27164043cea544",
  "paid": true,
  "paymentDate": "2024-11-18T09:44:51.432Z",
  "pinned": false,
  "purchaseOrder": {
    "id": "673b0ab223b8c71a21e1914b",
    "number": "003"
  },
  "supplier": {
    "id": "6718a1a20e27164043cea4e8",
    "name": "Caroline Dupont"
  },
  "taxes": {
    "tax1": {
      "id": "6718a0fd0e27164043ce97ae",
      "name": "VAT",
      "amount": 18.9
    }
  },
  "total": 108.9,
  "user": {
    "id": "6718a0b50e27164043ce912e",
    "name": "Cédric Doe"
  },
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:44:51.433Z"
}

DELETE/v2/expenses/:id

Delete an expense

This endpoint allows you to delete an expense.

Request

DELETE
/v2/expenses/:id
curl -X DELETE https://api.lsp.expert/v2/expenses/673b0abc23b8c71a21e1942a \
  -u {key}: