Payhawk icon

Payhawk

Interact with the Zitadel API

Actions99

Expenses → Get Expenses

AI-generated

Overview

This node operation retrieves a list of expenses from an external service associated with a specified account. It allows users to query and filter expense data based on various criteria such as creation date, status, category, supplier name, and more. This is useful for financial reporting, auditing, or integrating expense data into workflows for further processing or analysis.

Practical examples include:

  • Fetching all expenses created on a specific date.
  • Retrieving expenses filtered by status or category.
  • Paginating through large sets of expenses using skip and take parameters.
  • Sorting expenses by date or amount.

Properties

Name Meaning
Account Id Identifier of the account whose expenses are to be retrieved. This is a required string input.
Filter A JSON-stringified and URL-encoded filter expression object that conforms to an expense filter schema. It supports filtering by multiple fields such as id, status, createdAt, settledAt, reviewedAt, title, type, category.id, createdBy.id, document-related dates and numbers, reconciliation amounts, supplier name, card id, and logical operators $and and $or. Date filters ignore time and compare only by date part.
Order By A JSON-stringified and URL-encoded sort expression object conforming to an expense order-by schema. It defines how the results should be sorted (e.g., by date ascending or descending).
Skip Number of objects to skip from the beginning of the result set. Useful for pagination. Default is 0.
Take Maximum number of objects to return. The maximum allowed is 1000. Used to limit the size of the returned dataset. Default is 0 (which may mean no limit or default server behavior).

Output

The output contains a JSON array of expense objects matching the query criteria. Each expense object includes detailed information such as identifiers, status, dates, titles, types, categories, creator info, document details, reconciliation amounts, supplier information, and card details.

If binary data were involved (e.g., attachments), it would be summarized here, but this operation focuses on JSON data representing expenses.

Dependencies

  • Requires an API key credential or similar authentication token configured in n8n to access the external expense service.
  • The base URL for the API must be configured in the node credentials.
  • The node depends on the external service's REST API supporting filtering, sorting, pagination, and returning expense data in JSON format.

Troubleshooting

  • Invalid Filter Format: If the filter JSON is malformed or does not conform to the expected schema, the API may return errors or empty results. Ensure the filter is properly JSON-stringified and URL-encoded.
  • Authentication Errors: Missing or invalid API credentials will cause authorization failures. Verify that the API key or token is correctly set up in n8n credentials.
  • Pagination Issues: Setting Take to zero or a value greater than 1000 might lead to unexpected results or API rejections. Keep Take within allowed limits.
  • Empty Results: If no expenses match the filter criteria, the output will be an empty array. Double-check filter conditions for correctness.
  • Date Filtering: Since date filters ignore time parts, filtering by exact timestamps may not behave as expected. Use date-only values for filtering.

Links and References

  • Refer to the external expense service API documentation for detailed schema definitions of filters and order-by expressions.
  • n8n documentation on HTTP Request node for understanding how query parameters are sent.
  • JSON Schema standards for constructing valid filter and sort objects.

Discussion