Filtering & Sorting

Filtering

Rackbeat APIs provide filtering capabilities to help you retrieve specific subsets of data from collection endpoints. Filtering allows you to narrow down results based on specific criteria, reducing the amount of data transferred and improving response times.

Filtering is implemented through query parameters in GET requests to collection endpoints.


Basic Search Filtering

The most common filtering method is the search parameter, which allows you to filter results using a text-based search.

Examples

GET /bank-accounts?search=mybank
GET /delivery-addresses?search=strandvej
GET /fields?search=invoice

Advanced Filtering

Some endpoints support additional filtering parameters beyond basic search.


Entity Range Filtering

This allows you to filter records between specific entity boundaries using parameters like customer_from/customer_to, employee_from/employee_to, and item_group_from/item_group_to, enabling precise targeting of data within defined organizational hierarchies.

Examples

# Get invoices for customers between ID 1000-2000
GET /api/customer-invoices?customer_from=1000&customer_to=2000

# Get invoices handled by employees 50-75
GET /api/customer-invoices?employee_from=50&employee_to=75

# Get invoices for items in groups 10-20
GET /api/customer-invoices?item_group_from=10&item_group_to=20

All Entity Range Filters

  • customer_from / customer_to - Customer ID ranges
  • customer_group_from / customer_group_to - Customer group ranges
  • employee_from / employee_to - Employee ID ranges
  • group_from / group_to - General group ranges (for reports)
  • item_from / item_to - Item ID ranges
  • item_group_from / item_group_to - Item group ranges

Temporal Filtering

This provides comprehensive date-based filtering with multiple time dimension options including date_from/date_to for general date ranges, invoice_date_from/invoice_date_to for invoice-specific dates, and updated_at_from/updated_at_to for tracking recent changes.

Examples

# Get invoices created in the last 30 days
GET /api/customer-invoices?date_from=2025-06-15 00:00:00&date_to=2025-07-15 23:59:59

# Get invoices with specific invoice dates
GET /api/customer-invoices?invoice_date_from=2025-07-01 00:00:00&invoice_date_to=2025-07-31 23:59:59

# Get recently updated invoices
GET /api/customer-invoices?updated_at_from=2025-07-14 00:00:00

All Temporal Filters

  • booked_at_from / booked_at_to - Booking date ranges
  • date_from / date_to - General date ranges
  • delivery_date_from / delivery_date_to - Delivery date ranges
  • invoice_date_from / invoice_date_to - Invoice date ranges
  • offer_date_from / offer_date_to - Offer date ranges
  • order_date_from / order_date_to - Order date ranges
  • order_delivery_date_from / order_delivery_date_to - Order delivery date ranges
  • purchase_date_from / purchase_date_to - Purchase date ranges
  • purchase_delivery_date_from / purchase_delivery_date_to - Purchase delivery date ranges
  • updated_at_from / updated_at_to - Update date ranges

Simple Filter Operations

The simple_filter[field_name] pattern supports all comparison operators on timestamp fields like created_at and updated_at, allowing for complex temporal queries.

General syntax:

GET api/[endpoint]?simple_filter[field_name]=[filter_operator],[filter_value]

Filter Operators

  • eq --> '=' (EQUALS)
  • neq --> '!=' (DOES NOT EQUAL)
  • gt --> '>' (GREATER THAN)
  • lt --> '<' (LESS THAN)
  • gte --> '>=' (GREATER THAN OR EQUAL)
  • lte --> '<=' (LESS THAN OR EQUAL)
  • like --> 'LIKE'

Examples

# Get invoices created after a specific timestamp
GET /api/customer-invoices?simple_filter[created_at]=lt,2025-07-01 00:00:00

# Get invoices updated before a specific date
GET /api/customer-invoices?simple_filter[updated_at]=gte,2022-11-02 00:00:00

All Simple Filters

  • simple_filter[available_quantity] - Available quantity filtering
  • simple_filter[company_name] - Company name filtering
  • simple_filter[company_vat] - Company VAT number filtering
  • simple_filter[contact_email] - Contact email filtering
  • simple_filter[contact_phone] - Contact phone filtering
  • simple_filter[created_at] - Creation date filtering
  • simple_filter[ean] - EAN number filtering
  • simple_filter[in_order_quantity] - In-order quantity filtering
  • simple_filter[name] - Name filtering
  • simple_filter[number] - Number filtering (orders, offers, etc.)
  • simple_filter[purchased_quantity] - Purchased quantity filtering
  • simple_filter[stock_quantity] - Stock quantity filtering
  • simple_filter[updated_at] - Update date filtering

State-Based Boolean Filtering

This enables filtering by operational status using parameters such as is_archived, is_booked, is_shipped, and is_creditnote, making it easy to segment data by business process states.

Examples

# Get all shipped but unbooked invoices
GET /api/customer-invoices?is_shipped=true&is_booked=false

# Get archived credit notes
GET /api/customer-invoices?is_archived=true&is_creditnote=true

All State Boolean Filters

  • has_batch_control - Product has batch control enabled
  • has_customer_orders - Product has associated customer orders
  • has_serial_numbers - Product has serial number tracking enabled
  • is_accepted - Offer acceptance status
  • is_active - General active status for webhooks and iframes / tabs
  • is_approved - Approval status
  • is_archived - Archive status
  • is_barred - Barred/blocked status
  • is_booked - Booking status for financial documents
  • is_cancelled - Cancellation status
  • is_creditnote - Credit note flag
  • is_default - Default selection flag
  • is_deleted - Deletion status
  • is_draft - Draft status
  • is_finished - Completion status for production orders
  • is_picked - Picking status for orders
  • is_ready_for_receiving - Ready for receipt status
  • is_ready_for_shipping - Ready for shipment status
  • is_received - Receipt confirmation
  • is_rejected - Rejection status
  • is_sellable - Sellable flag for BOMs
  • is_sent - Sent status for documents
  • is_shipped - Shipment status
  • is_started - Started status for production orders

Special Filters

Unique filtering options specific to certain endpoints.

Customer Management:

  • company_name - Direct company name filtering, alternative to simple_filter (Customers)
  • email - Direct email filtering, alternative to simple_filter (Customers)
  • with_deleted - Include deleted records in results (Customers)
  • in - Include specific values using comma-separated list (e.g., "123,777,1002") (Customers)
  • not_in - Exclude specific values using comma-separated list (Customers)
  • group - Group filtering (Customers)

Customer Contacts:

  • must_have_email - Require that contacts have an email address (Customer Contacts)
  • cc_invoice - Customer contact invoice carbon copy flag (Customer Contacts)
  • cc_offer - Customer contact offer carbon copy flag (Customer Contacts)
  • cc_order - Customer contact order carbon copy flag (Customer Contacts)
  • name - Direct name filtering (Customer Groups, Customer Contacts)

Orders & Invoices:

  • customer_number - Filter by specific customer number (Orders, Invoices, Shipments)
  • order_number - Filter by specific order number (Orders, Invoices, Shipments)
  • default - Filter for default selection status (Customer Invoices)

Shipping & Logistics:

  • customer_invoice_number - Filter by specific customer invoice number (Shipments)
  • delivery_date - Filter by delivery date (Shipments)
  • location - Filter by location (Shipments)
  • employee - Filter by employee (Shipments)
  • employee_number - Filter by specific employee number (Shipments)
  • sort_by_delivery_date - Sort results by delivery date (Shipments)
  • with_percentage_shippable - Include percentage shippable information (Shipments)

Inventory & Products:

  • lot_number - Filter by BOM number (BOMs)
  • number - Filter by product number (Products)
  • name - Filter by product name (Products)
  • group - Filter by product group (Products)
  • group_in - Include specific product groups using comma-separated list (Products)
  • barcode - Filter by barcode (Products)

🤓

Combine Filtering Options

All these filtering patterns can be combined to create highly specific queries, such as finding all invoices for customers within a specific range that were created within the last month and have been shipped but not yet booked.


Filter Behavior

  • Filters are case-insensitive
  • Search typically matches partial text across relevant fields
  • Multiple filters can be combined using the & operator
  • Empty search values return unfiltered results
  • Filters work in conjunction with pagination

Response Structure

Filtered responses maintain the same structure as unfiltered requests, including pagination metadata. The total count reflects the number of records matching your filter criteria, not the entire dataset.


Implementation Notes

When implementing filtering in your application, make sure you have accounted for:

  • URL Encode Parameters: Ensure special characters in filter values are properly encoded
  • Handle Empty Results: Be prepared for cases where filters return no matching records
  • Test Filter Combinations: Verify that multiple filters work as expected together

Filtering provides an efficient way to retrieve only the data you need from Rackbeat APIs, reducing bandwidth usage and improving application performance.




Sorting

By default, API responses are sorted descendingly (Z-A) by the entity primary key. For orders, invoices, products, customers and more, that would be the number. So it would for example list products by their number, greatest to lowest.

It is possible to change the direction, and the field, by adding query parameters to the API request.

Order Direction

By appending ?order_direction=[DIRECTION] to the request, you can change how the response is sorted. As mentioned above, by default the behavior is descending (desc), but you can change it to ascending by setting order_direction to asc.

  • Ascending: ?order_direction=asc
  • Descending: ?order_direction=desc

Order by Field

Similarly to direction, which field is sorted by can also be modified. In many cases, all fields returned by the API can be sorted. You can do this by using ?order_by=[FIELD].

Example:

GET api/customer-invoices?order_by=invoice_date