Expert guide to the auto-generated GraphQL API (Queries, Mutations, Aggregations).
The Platform auto-generates GraphQL fields from your SCL schema.
app__ prefix (snake_case).app__plural (List), app__singular (By ID).insert_..., update_..., delete_....Example: App com.acme.crm (com_acme_crm), Table user (users).
com_acme_crm__userscom_acme_crm__userquery ListUsers {
users: com_acme_crm__users(
limit: 10
offset: 0
order_by: { created_at: desc }
) {
id
email
# Nested relationship
orders {
id
total
}
}
}
where)| Operator | Logic | Example |
|---|---|---|
_eq, _neq |
Equals / Not Equals | { status: { _eq: "active" } } |
_gt, _lt |
Greater / Less Than | { count: { _gt: 5 } } |
_in, _nin |
In List | { id: { _in: ["A", "B"] } } |
_is_null |
Is Null | { notes: { _is_null: true } } |
_and, _or |
Logic Groups | { _or: [ { a: ... }, { b: ... } ] } |
Fetch counts, sums, averages.
_agg Suffix: Use table_name_agg.aggregate: Holds the stats.nodes: Holds the actual records (optional).query UserStats {
com_acme_crm__users_agg(where: { status: { _eq: "active" } }) {
aggregate {
count
sum { lifetime_value }
avg { age }
}
}
}
mutation NewUser($data: JSON!) {
# returns the created object
insert_com_acme_crm__user(object: $data) {
id
}
}
mutation MakeActive($id: ID!) {
update_com_acme_crm__user(
id: $id
_set: { status: "active", updated_at: "now()" }
) {
id
status
}
}
mutation RemoveUser($id: ID!) {
delete_com_acme_crm__user(id: $id) {
id
}
}
Get the TOTAL count of matches (aggregate) but only fetch the FIRST PAGE of actual data (nodes).
query SearchAndPaginate {
com_acme_crm__users_agg(
where: { status: { _eq: "active" } }
order_by: { created_at: desc }
limit: 20 # Applies to 'nodes'
offset: 0 # Applies to 'nodes'
) {
# 1. Total count matching the filter (ignoring limit!)
aggregate {
count
}
# 2. The actual page of data (respected limit)
nodes {
id
email
}
}
}
Calculate stats for related records (e.g., Average Order Value per User).
query UserStats {
users: com_acme_crm__users {
email
# Aggregate on relationship
orders_agg {
aggregate {
count
sum { total }
}
}
}
}
When in doubt, query the schema itself to discover available types and fields.
query Introspection {
__schema {
types { name kind }
}
}