The Lamassu API supports powerful server-side filtering and sorting on list endpoints, allowing you to query resources based on field values, nested JSON properties, and complex expressions.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lamassuiot/lamassuiot/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Filtering capabilities:- Scalar Fields: Filter by string, number, date, and enum fields
- JSON Fields: Use JSONPath expressions to query nested metadata
- Array Fields: Search within arrays (tags, lists)
- Multiple Filters: Combine multiple conditions with AND logic
- Server-Side Processing: Efficient filtering at the database level
Basic Filtering Syntax
Query Parameter Format
Filter expression in the format
field[operator]value. Can be specified multiple times for AND conditions.Example Requests
Filter Operators
String Operators
| Operator | Meaning | Example | Description |
|---|---|---|---|
eq | Equal | name[eq]=production | Exact match (case-sensitive) |
eq_ic | Equal (case-insensitive) | name[eq_ic]=Production | Case-insensitive match |
ne | Not equal | status[ne]=REVOKED | Does not match |
ne_ic | Not equal (case-insensitive) | name[ne_ic]=test | Case-insensitive non-match |
ct | Contains | description[ct]=backup | Substring search |
ct_ic | Contains (case-insensitive) | description[ct_ic]=Backup | Case-insensitive substring |
nc | Not contains | description[nc]=deprecated | Does not contain substring |
nc_ic | Not contains (case-insensitive) | description[nc_ic]=DEPRECATED | Case-insensitive exclusion |
Date Operators
| Operator | Meaning | Example | Description |
|---|---|---|---|
bf | Before | creation_ts[bf]=2026-01-01 | Date before specified time |
af | After | valid_from[af]=2025-01-01 | Date after specified time |
YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ)
Examples:
Numeric Operators
| Operator | Meaning | Example | Description |
|---|---|---|---|
lt | Less than | level[lt]=3 | Value less than |
le | Less than or equal | size[le]=2048 | Value less than or equal |
gt | Greater than | level[gt]=0 | Value greater than |
ge | Greater than or equal | size[ge]=2048 | Value greater than or equal |
Array Operators
For array fields (liketags), use string operators:
JSONPath Filtering
Overview
For JSON fields (metadata, settings), use the jsonpath operator with PostgreSQL JSONPath expressions:
JSONPath filtering uses PostgreSQL’s native JSONPath implementation, providing powerful querying capabilities for nested JSON structures.
Basic JSONPath Expressions
Existence Check
String Equality
Numeric Comparison
Nested Properties
Array Operations
Array Contains Value
Array Contains Object
Array Index Access
Array Numeric Comparison
Multiple Array Conditions
JSONPath Syntax Reference
Type-Aware Comparisons
JSONPath comparisons respect JSON types:- Strings:
$.name == "value" - Numbers:
$.count > 10 - Booleans:
$.enabled == true - Null:
$.field == null
Sorting
Basic Sorting
Field name to sort by
Sort order:
asc (ascending) or desc (descending)JSONPath Sorting
Sort by nested JSON properties using the JSONPath syntax:Type-Aware Sorting
The system automatically detects JSON value types for proper sorting:| Type | Behavior | Example |
|---|---|---|
| String | Alphabetical | dev → prod → stage |
| Number | Numeric (not lexicographic) | 5 → 10 → 20 |
| Date | Chronological (ISO 8601) | 2025-01-10 → 2026-01-15 |
| NULL | Last (asc) or First (desc) | Configurable |
Combining Filters and Sorting
Filterable Fields by Resource
Certificate Authorities (CA)
| Field | Type | Operators | Example |
|---|---|---|---|
id | String | eq, ne, ct, nc | id[eq]=root-ca |
status | Enum | eq, ne | status[eq]=ACTIVE |
level | Number | lt, le, gt, ge | level[ge]=2 |
engine_id | String | eq, ne, ct, nc | engine_id[eq]=aws-kms |
valid_from | Date | bf, af | valid_from[af]=2026-01-01 |
valid_to | Date | bf, af | valid_to[bf]=2027-01-01 |
subject.common_name | String | eq, ne, ct, nc | subject.common_name[ct]=root |
metadata | JSON | jsonpath | metadata[jsonpath]$.env=="prod" |
Certificates
| Field | Type | Operators | Example |
|---|---|---|---|
serial_number | String | eq, ne | serial_number[eq]=0A1B2C |
status | Enum | eq, ne | status[eq]=ACTIVE |
type | Enum | eq, ne | type[eq]=MANAGED |
engine_id | String | eq, ne | engine_id[eq]=aws-kms |
valid_from | Date | bf, af | valid_from[af]=2026-01-01 |
valid_to | Date | bf, af | valid_to[bf]=2026-12-31 |
subject.common_name | String | eq, ne, ct, nc | subject.common_name[ct]=device |
metadata | JSON | jsonpath | metadata[jsonpath]$.purpose=="signing" |
Devices
| Field | Type | Operators | Example |
|---|---|---|---|
id | String | eq, ne, ct, nc | id[eq]=device-123 |
dms_owner | String | eq, ne | dms_owner[eq]=my-dms |
status | Enum | eq, ne | status[eq]=ACTIVE |
creation_timestamp | Date | bf, af | creation_timestamp[af]=2026-01-01 |
tags | Array | ct, nc | tags[ct]=production |
metadata | JSON | jsonpath | metadata[jsonpath]$.region=="us-west-1" |
DMS Instances
| Field | Type | Operators | Example |
|---|---|---|---|
id | String | eq, ne, ct, nc | id[eq]=my-dms |
name | String | eq, ne, ct, nc | name[ct]=production |
creation_date | Date | bf, af | creation_date[af]=2026-01-01 |
metadata | JSON | jsonpath | metadata[jsonpath]$.region=="eu-west" |
settings | JSON | jsonpath | settings[jsonpath]$.auto_enroll==true |
Keys (KMS)
| Field | Type | Operators | Example |
|---|---|---|---|
key_id | String | eq, ne | key_id[eq]=signing-key-1 |
engine_id | String | eq, ne | engine_id[eq]=aws-kms |
algorithm | String | eq, ne, ct | algorithm[ct]=RSA |
size | Number | lt, le, gt, ge | size[ge]=2048 |
status | String | eq, ne | status[eq]=ENABLED |
creation_ts | Date | bf, af | creation_ts[af]=2026-01-01 |
tags | Array | ct, nc | tags[ct]=production |
metadata | JSON | jsonpath | metadata[jsonpath]$.purpose=="signing" |
Statistics with Filtering
Statistics endpoints support filtering to compute aggregates on subsets:SDK Usage Examples
Best Practices
URL Encoding
URL Encoding
Always URL-encode filter values containing:
- Spaces (use
%20) - Quotes (use
%22) - Special operators (
>,<,=become%3E,%3C,%3D)
Filter Specificity
Filter Specificity
Start with the most selective filters first to improve query performance:
JSONPath Performance
JSONPath Performance
- Index frequently queried JSON fields in PostgreSQL for better performance
- Use simple existence checks when possible:
exists($.field)vs complex predicates - Avoid deep nesting when designing metadata schemas
Pagination with Filters
Pagination with Filters
Filters are preserved across pagination requests via the bookmark:
Common Use Cases
Find Expiring Certificates
Production Environment Resources
High-Priority Issues
Compliance Reporting
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
field 'X' is not filterable | Field not in allowed list | Check filterable fields table |
invalid JSONPath expression | Syntax error in JSONPath | Verify JSONPath syntax and URL encoding |
invalid filter expression | Malformed filter parameter | Use correct field[op]value format |
status field cannot be filtered | Status filter on stats endpoint | Remove status filter or use list endpoint |
Next Steps
API Overview
Learn about base URLs and pagination
Authentication
Configure JWT and mTLS authentication
CA API
Manage certificate authorities
Device API
Device inventory operations
