GTM Engineering term, automation and APIs

GraphQL

GraphQL is a query language and runtime for APIs that lets a client request exactly the data fields it needs, often across related objects, from a single endpoint.

Also called: GraphQL API, GQL

GraphQL sits under every stage: it's part of the data and systems the whole funnel runs on, near related terms like REST API, API and JSON (the blue squares).

GraphQL is a query language for APIs that lets the caller ask for exactly the fields it needs, including related objects, from a single endpoint. Facebook built it internally and open-sourced it in 2015. In a GTM stack you meet it when pulling data from tools like Shopify, GitHub or Linear, where one well-shaped query replaces a chain of REST calls.

How it works

A GraphQL API publishes a schema: the types of objects it holds, their fields and how they relate. Instead of separate URLs per resource, you send every request to one endpoint, usually /graphql, with a query describing the shape you want back:

query {
  accounts(first: 50) {
    name
    domain
    contacts { email title }
  }
}

The response mirrors the query as JSON, with nothing extra. Three operation types cover most use:

  • Queries read data.
  • Mutations create, update or delete data.
  • Subscriptions stream changes over a live connection, where supported.

Because the schema is typed and self-describing, tools can autocomplete fields and catch mistakes before you run anything.

Example

Say you need 50 accounts and the contacts at each for a weekly account research brief. With a typical REST API that's 1 call to list accounts plus 50 calls to fetch contacts per account: 51 requests, each returning every field whether you need it or not.

With GraphQL it's 1 request returning only name, domain, email and title. If each REST call takes 300 milliseconds (assumption), the REST version spends about 51 x 0.3 = 15.3 seconds in network time versus well under a second for the single query. Multiply by a nightly job across 5,000 accounts and you're comparing about 5,001 calls to roughly 100 paginated queries.

GraphQL vs REST

GraphQL wins on nested data, fewer round trips and precise payloads. It also gives you a single typed schema to explore, which speeds up building.

REST wins on simplicity. Any no-code tool, spreadsheet add-on or shell command can call it. HTTP caching works naturally, errors map cleanly to status codes, and most SaaS vendors document REST first. GraphQL often returns a 200 status even when part of a query failed, with errors listed in the body, so naive error checks miss problems.

Our rule of thumb: use whatever the vendor treats as its primary API. If both exist and you're pulling related objects into a data pipeline, GraphQL usually saves calls. For quick one-step automations, REST is less friction.

Common mistakes

  • Checking only the HTTP status and missing the errors array in a 200 response.
  • Writing one giant query that blows through the API rate limit cost budget.
  • Forgetting cursor pagination on nested lists, so you silently get the first page only.
  • Requesting every field "just in case," which throws away GraphQL's main advantage.
  • Hardcoding queries without tracking schema deprecations.

FAQ

Is GraphQL better than REST?

Not in general. GraphQL is better when you need nested, related data in few round trips or want to avoid over-fetching. REST is simpler to cache, easier to call from basic tools and still the default for most SaaS APIs.

Which tools use GraphQL APIs?

Well-known examples include Shopify's Admin API, GitHub's v4 API, Linear and monday.com. Many SaaS vendors offer GraphQL alongside REST rather than instead of it.

Do GraphQL APIs have rate limits?

Yes, but they often work differently. Instead of counting requests, many GraphQL APIs assign each query a cost based on how much data it touches, and you spend from a points budget that refills over time.

See all automation and APIs terms ↳

Used in these articles