Dev

Queries

Read data from your CloudCart store using GraphQL queries.

Queries let you fetch data from the Admin API without modifying anything. You request exactly the fields you need, traverse nested relationships, and filter results.

Endpoint

All queries are sent as POST requests to your store's GraphQL endpoint:

POST /api/gql HTTP/1.1
Host: {shop}.cloudcart.com
Authorization: Bearer cc_pat_xxxxxxxxxxxxx
Content-Type: application/json

The two naming rules

These two conventions explain almost every error beginners hit:

  1. Output fields are camelCase, and big types group related fields into sub-objects: Product.pricing, Product.flags, Product.inventory, Order.buyer, Order.amounts. Flat fields like product.price do not exist.
  2. Arguments and input fields are snake_case: category_id, price_min, date_added.

Fetching a single resource

Use a singular query field with an id argument:

query {
  product(id: 42) {
    id
    name
    pricing { from to }
    inventory { variantsCount }
    flags { active }
  }
}

Response

{
  "data": {
    "product": {
      "id": "42",
      "name": "Wireless Headphones",
      "pricing": { "from": 79.99, "to": 99.99 },
      "inventory": { "variantsCount": 3 },
      "flags": { "active": true }
    }
  }
}

Fetching a list

List queries return a connection: edges { node } plus pageInfo:

query {
  products(first: 5) {
    edges {
      node {
        id
        name
        pricing { from to }
      }
    }
    pageInfo { total }
  }
}

See Pagination for cursors and paging patterns.

Filtering

Filters are top-level arguments on the list query (snake_case), not a filter: object:

query {
  products(first: 10, active: yes, category_id: 5) {
    edges { node { id name } }
    pageInfo { total }
  }
}

Useful product filters: query (free text), sku, barcode, active: YesNo, category_id, vendor_id, tag, price_min / price_max, stock: { operator: lte, value: 5 }, date_added / date_modified date filters.

YesNo is an enum, not a Boolean

Flags like active, sale, digital take yes / no (unquoted enum values) — not true / false.

Variables

Use variables for anything dynamic — never interpolate strings into the query:

query GetProduct($id: ID!) {
  product(id: $id) {
    id
    name
    pricing { from to }
  }
}
{ "query": "query GetProduct($id: ID!) { product(id: $id) { id name pricing { from to } } }", "variables": { "id": 42 } }

Multiple resources in one request

GraphQL lets you combine independent queries into a single round-trip:

query {
  products(first: 5) { edges { node { id name } } }
  orders(first: 5) { edges { node { id amounts { total } } } }
}

Discovering the schema

Don't guess field names — explore:

  • CLI: cloudcart app schema --search order --compact (docs)
  • AI assistant: the Dev MCP server searches and validates against the live schema
  • Validation: cloudcart app validate --query '...' catches errors before execution

On this page