Search & Filtering
The Renesis Stellar DEX Vaults API provides powerful search and filtering capabilities to help you discover and query vaults efficiently. This section covers the advanced search endpoint with comprehensive filtering, pagination, and sorting options.GET /api/vaults/search
Advanced search endpoint for discovering vaults with flexible filtering, pagination, and sorting capabilities.Parameters
Query Parameters- page (number, optional): Page number for pagination (default: 1, min: 1)
- limit (number, optional): Number of items per page (default: 10, min: 1, max: 100)
- owner (string, optional): Filter by vault owner Stellar address (must start with ‘G’, 56 characters)
- tradePermission (boolean, optional): Filter by trade permission status (
trueorfalse) - search (string, optional): Search vault names using case-insensitive partial matching
- sortBy (string, optional): Sort field -
creationDate,creationLedger,vaultName,updatedAt(default:creationDate) - sortOrder (string, optional): Sort order -
ascordesc(default:desc) - minLedger (number, optional): Filter vaults created after this ledger number (inclusive)
- maxLedger (number, optional): Filter vaults created before this ledger number (inclusive)
Request Examples
Basic Search with Pagination
Search by Vault Name
Filter by Owner and Trade Permission
Filter by Ledger Range with Sorting
Complex Multi-Filter Search
Response Example
Error Responses
400 Bad Request - Invalid ParametersPagination Structure
The search endpoint returns comprehensive pagination information to help you navigate through large result sets efficiently.Pagination Response Fields
- page (number): Current page number (1-based indexing)
- limit (number): Number of items per page as requested
- totalItems (number): Total number of vaults matching the search criteria
- totalPages (number): Total number of pages available
- hasNext (boolean): Whether there are more pages after the current page
- hasPrev (boolean): Whether there are pages before the current page
Pagination Example
Pagination Best Practices
- Start Small: Begin with a reasonable page size (10-25 items) to optimize performance
- Check Boundaries: Always check
hasNextandhasPrevbefore navigating - Handle Empty Results: Be prepared for empty result sets when no vaults match criteria
- Respect Limits: The maximum page size is 100 items to prevent performance issues
Filtering Options
Owner Filtering
Filter vaults by their owner’s Stellar address. The owner parameter must be a valid Stellar address starting with ‘G’ and exactly 56 characters long.Trade Permission Filtering
Filter vaults based on their trading permission status. Usetrue to find vaults with trading enabled, or false for vaults with trading disabled.
Name Search Filtering
Search vault names using case-insensitive partial matching. The search parameter will match any vault name containing the specified text.Ledger Range Filtering
Filter vaults based on their creation ledger numbers. UseminLedger and maxLedger to define a range of ledger numbers.
Sorting Options
Available Sort Fields
- creationDate: Sort by vault creation timestamp (default)
- creationLedger: Sort by Stellar ledger number when vault was created
- vaultName: Sort alphabetically by vault name
- updatedAt: Sort by last modification timestamp
Sort Orders
- desc: Descending order (newest/highest first) - default
- asc: Ascending order (oldest/lowest first)
Sorting Examples
Comprehensive Filtering Examples
Example 1: Find Recent Trading Vaults
Find all vaults with trading enabled that were created in the last 1000 ledgers, sorted by creation date.Example 2: Owner’s Trading Vaults with Name Search
Find all vaults owned by a specific address that have “trading” in the name and have trading enabled.Example 3: Historical Vault Analysis
Find all vaults created within a specific ledger range, sorted by creation ledger for historical analysis.Example 4: Recently Updated Vaults
Find vaults that have been recently updated, regardless of other criteria.Example 5: Complex Multi-Criteria Search
Find vaults owned by a specific address, with trading disabled, created after a certain ledger, with “storage” in the name.Performance Considerations
Optimization Tips
- Use Specific Filters: More specific filters reduce the result set and improve performance
- Reasonable Page Sizes: Keep page sizes between 10-50 items for optimal performance
- Index-Friendly Sorting: Sorting by
creationDateorcreationLedgeris most efficient - Combine Filters: Use multiple filters together to narrow results effectively
Query Performance
- Fast Queries: Owner filtering, trade permission filtering, ledger range filtering
- Moderate Queries: Name search (uses text indexing)
- Complex Queries: Multiple combined filters with large result sets
Caching Recommendations
- Cache frequently used search results for short periods (1-5 minutes)
- Cache pagination metadata for consistent user experience
- Invalidate cache when vault data is modified
Common Search Patterns
Dashboard Queries
Trading Interface Queries
Analytics Queries
TypeScript Interfaces
Search Parameters Interface
Example Search Responses
Advanced Search Examples
Integration Examples
JavaScript/TypeScript Integration
React Hook Example
Python Integration
Next Steps
- Vault Endpoints - Core vault management operations
- Token Endpoints - Token holdings and balance management
- Error Handling - Error codes and troubleshooting
- API Overview - Authentication and general API information

