GraphQL Core Concepts

Beta: The GraphQL API is in beta. Types, fields and limits may change before it becomes generally available.

This page explains how to shape queries and mutations in the Zuper GraphQL API: choosing fields, including related records, and filtering, sorting and paging through lists.


Selecting fields

A response contains only the fields you select. To select an object field, list the sub-fields you want inside braces:

query JobAddress($id: ID!) {
  job(id: $id) {
    job_title
    customer_address { street city zip_code }
  }
}

These object types are used across several modules.

Address

street, city, state, country, zip_code, landmark, county, first_name, last_name, phone_number, email, geo_coordinates ([Float!], latitude and longitude)

CustomField

label, value, type, group_name, group_uid, hidden

hidden is true when your user isn't allowed to see the field, for example a field hidden from field executives when your API key belongs to a field executive, or a field your access role has no access to. The value is still returned; hide it in your app.

ExternalId

key, value

User

id (user UID), emp_code, first_name, last_name, email, designation, is_active

Team

id (team UID), team_name

LineItem (job products, estimate and invoice line_items)

FieldTypeDescription
line_item_uidString
line_item_typeString
product_uid / product_idStringThe product from your catalog, if any
nameString
descriptionString
uomStringUnit of measure
quantityFloat
unit_priceFloat
discountFloat
discount_typeStringFIXED or PERCENTAGE
totalFloat
taxLineItemTax{ tax_name tax_rate tax_amount tax_exempt }

TaxLine (estimate and invoice tax)

tax_uid, tax_name, tax_percent, tax_amount


Including related records

Fields that point to another module return that record, so you don't need a second request. For example, job.customer returns the job's customer and invoice.estimate returns the estimate the invoice was created from.

KindExamplesArguments
Single recordjob.customer, job.organization, job.property, job.category, estimate.job, invoice.estimate, property.parent_property, customer.customer_organizationNone
Paginated listjob.estimates, job.invoices, estimate.invoices, customer.properties, customer.jobs, customer.estimates, customer.invoices, organization.customers, organization.properties, organization.jobs, property.customers, property.jobsfirst (default 10), after, filter, sort
Peoplejob.assigned_to { user team }, created_by, job.status_history { done_by }None

Related records can be nested, for example job → customer → organization:

query JobWithCustomer($id: ID!) {
  job(id: $id) {
    job_title
    customer {
      customer_full_name
      customer_organization { organization_name }
    }
  }
}

Filtering

List queries take a filter argument. Each module has its own filter fields, listed on the module's page.

  • All conditions in one filter must match (AND).
  • Reference filters, such as customer_uid, take UIDs. A UID that doesn't exist in your account returns an empty list.
  • A variable sent as null is treated as "no condition", so one query can serve several optional filters.
  • Range filters (*_from / *_to, scheduled_from / scheduled_to, created_after / created_before) include both ends. updated_after also includes the given time.
  • custom_field: [{ label, value }] matches values exactly, and every entry must match.
  • name (organizations and properties) matches the start of the name, ignoring letter case. email and mobile are exact, case-sensitive matches.
query OpenJobsWithContractType($cf: [CustomFieldFilter!]) {
  jobs(first: 25, filter: { status_type_in: ["NEW", "SCHEDULED"], custom_field: $cf }) {
    nodes { id job_title }
  }
}
{ "cf": [{ "label": "Contract Type", "value": "AMC" }] }

Sorting

List queries take a sort argument:

sort: { field: UPDATED_AT, direction: ASC }

The default is CREATED_AT, DESC. Records with the same sort value are always returned in the same order, so paging is stable. Each module's page lists its sort fields.


Pagination

Lists use cursor-based pagination. Every list returns a connection:

{
  nodes { id }                            # the records on this page
  edges { cursor node { id } }            # the same records, each with its own cursor
  page_info { has_next_page end_cursor }
}
ArgumentDescription
firstNumber of records per page. The default is 25 for top-level lists and 10 for nested lists. The maximum is 100, and larger values are reduced to 100. 0 or a negative number is an error
afterThe end_cursor from the previous page. Leave it out, or send null, for the first page

To read a whole list:

  1. Send the query without after.
  2. If page_info.has_next_page is true, send the same query again with after set to page_info.end_cursor.
  3. Repeat until has_next_page is false.
query JobsPage($after: String) {
  jobs(first: 100, after: $after, sort: { field: CREATED_AT, direction: ASC }) {
    nodes { id work_order_number job_title }
    page_info { has_next_page end_cursor }
  }
}
{ "after": "eyJkIjoiMjAyNi0xMS0xN1QwNDozMDowMC4wMDBaIiwiaWQiOiIuLi4ifQ" }

Note: Keep the same filter and sort while you page through a list. Treat cursors as opaque strings; their format can change. Lists don't return a total count.

Use nodes unless you need a cursor for each record.

Paging a nested list

Every list of related records, such as job.invoices or customer.properties, is a connection too. It returns 10 records unless you set first (up to 100). Each parent's list has its own cursor. To read past the first page, request that one parent by ID and page its list:

query JobInvoicesPage($id: ID!, $after: String) {
  job(id: $id) {
    invoices(first: 100, after: $after) {
      nodes { id invoice_no_string invoice_status total }
      page_info { has_next_page end_cursor }
    }
  }
}
{ "id": "<job_uid>", "after": null }

You can also use the module's top-level list with a filter, for example invoices(filter: { job_uid: "<job_uid>" }).


Keeping data in sync

To copy changes into another system, filter on updated_after and sort by UPDATED_AT ascending. Save the updated_at of the last record you processed, and use it as updated_after on the next run.

query JobSync($since: DateTime!, $after: String) {
  jobs(
    first: 100
    after: $after
    filter: { updated_after: $since }
    sort: { field: UPDATED_AT, direction: ASC }
  ) {
    nodes { id work_order_number job_title current_status { status_type } updated_at }
    page_info { has_next_page end_cursor }
  }
}
{ "since": "2026-11-01T00:00:00Z", "after": null }

Because updated_after includes the given time, the last record from the previous run comes back again. Skip records you've already processed.


Mutations

Create and update mutations return the saved record and a user_errors list. Delete mutations return deleted_id and user_errors.

mutation UpdateJob($id: ID!, $input: JobUpdateInput!) {
  updateJob(id: $id, input: $input) {
    job { id job_priority }
    user_errors { field message code }
  }
}
  • Business and validation errors come back in user_errors, with HTTP status 200. Always check user_errors; when it isn't empty, the record field is null.
  • Authentication, limit and system errors come back in the top-level errors list. See Query Cost, Limits and Errors.
  • Mutations follow the same rules as the REST API and the Zuper app: user permissions, workflows, webhooks and activity logs all apply.
  • For update mutations, only the fields you send are changed, unless the module's page says that a field replaces the stored value.

Running several operations in one request

One request can run several root fields. To call the same field more than once, give each call an alias (up to 10 aliases per request).

query Dashboard($today: DateTime!, $weekEnd: DateTime!) {
  viewer { first_name }
  this_week: jobs(
    first: 20
    filter: { scheduled_from: $today, scheduled_to: $weekEnd }
    sort: { field: SCHEDULED_START_TIME, direction: ASC }
  ) {
    nodes { work_order_number job_title scheduled_start_time current_status { status_name } }
  }
  pending_estimates: estimates(first: 10, filter: { status_in: [AWAIT_RESPONSE] }) {
    nodes { estimate_no_string total customer { customer_full_name } }
  }
  unpaid_invoices: invoices(first: 10, filter: { is_paid: false }, sort: { field: DUE_DATE, direction: ASC }) {
    nodes { invoice_no_string amount_due due_date }
  }
}
{ "today": "2026-11-17T00:00:00Z", "weekEnd": "2026-11-23T23:59:59Z" }

Mutations in one request run one after another, in the order you write them:

mutation StartJob($id: ID!, $status: JobStatusInput!, $patch: JobUpdateInput!) {
  updateJobStatus(id: $id, input: $status) {
    job { current_status { status_name } }
    user_errors { message code }
  }
  updateJob(id: $id, input: $patch) {
    job { job_tags }
    user_errors { message code }
  }
}
{
  "id": "<job_uid>",
  "status": { "status_uid": "<started_status_uid>", "remarks": "Work started" },
  "patch": { "job_tags": ["amc", "in-progress"] }
}

Note: Each mutation is applied on its own. If the second mutation fails, the first one is not undone.


Known limitations

  • Job status_history { remarks } doesn't include free-text remarks entered with a status change.
  • A related record that was deleted later is still returned. For example, a job whose customer was deleted still shows that customer. property.customers leaves out deleted customers.
  • customer.jobs and the customer_uid job filter match the job's primary customer only.
  • Jobs assigned only to a team, with no individual user, return an empty assigned_to.
  • Line items return a single tax. Line items with more than one tax are not fully represented; use the document-level tax list for totals.

Did this page help you?