q and query_by work together to control what data you search for and which fields to search in. These parameters enable you to perform full-text searches, exact matches, and wildcard queries across your ledger data.
The q parameter is required in all search requests. The query_by parameter is required when searching for specific terms, and optional only when using the wildcard *.
Quick start
Here’s a basic search query that demonstrates both parameters:Response
Query parameters
Exact text search
Search for specific text or IDs by specifying the fields to search in:Wildcard search
Use* to return all records (only case where query_by is optional):
Multi-word search
Search for multiple words across specified fields:Single vs multiple fields
Search in one field or across multiple fields using comma separation:Metadata search
Available in version 0.11.0 and later.
Common patterns
1
Search for a specific balance's transactions
This finds all transactions where the specified balance ID appears as either source or destination.
2
Find customers by name or email
This searches for “alice” across name and email fields, useful for customer support.
3
Find transactions by description keywords
This finds transactions containing “refund” in their description or reference fields.
Best practices
- Be specific with fields: Target relevant fields in
query_byfor better performance. - Validate field names: Invalid fields in
query_bymay return unexpected results.