API Configuration

Query Builder

WHERE Conditions (AND logic)

OR WHERE Conditions (OR logic)

JOINS

Comma-separated list. Supports nested joins with dot notation.
Left outer joins. Automatically adds DISTINCT.

Outputs (Field Selection & Aggregates)

Query Options

Generated Query

{}

                    
                

Examples

Basic Query

Simple field filtering with operators

JSON Fields

Query JSON/JSONB columns

Nested Joins

Join through multiple tables

Complex Query

Multiple conditions, joins, and OR logic

Field Selection

Return only specific fields

Simple Aggregate

Count records with filters

Grouped Aggregate

Count by category with grouping

Multiple Aggregates

Multiple calculations in one query

SQL Debug

Generate SQL for debugging

Quick Reference

Field References

  • email - Direct column
  • party_roles.active - Joined table
  • custom_fields.department - JSON field
  • custom_fields.meta.source - Nested JSON

Operators

  • eq - Equals (default)
  • gt/gte - Greater than/equal
  • lt/lte - Less than/equal
  • in - Array values (comma-separated)
  • like - Pattern matching (%wildcards%)
  • between - Range (value1,value2)
  • null - true/false for NULL checks

Special Values

  • current_user_id - Requesting user's ID
  • current_party_id - User's party ID
  • current_tenant_id - Current tenant
  • current_date - Today's date
  • current_datetime - Current timestamp

Outputs Feature

  • Field Selection: Return only specific fields
  • Aggregates: COUNT, AVG, MIN, MAX, SUM
  • Grouping: GROUP BY with aggregates
  • Multiple Functions: Multiple aggregates in one query
  • Debugging: Generate SQL or EXPLAIN plans

Response Types

  • Standard: {success: true, parties: [...], total_count: N}
  • Aggregate: {success: true, aggregate_result: N}
  • Grouped: {success: true, aggregate_results: [...]}
  • SQL Debug: {success: true, sql: "SELECT ..."}

Common Use Cases

  • Dashboards: Use aggregates for summary data
  • Reports: Group by categories with counts
  • Performance: Select only needed fields
  • Debugging: Generate SQL to understand queries