Query a product category in Connect

Use the productCategories and productCategory queries to retrieve product categories from the catalog. Categories support a hierarchy (parent/child) and you can filter by parent, by name, or fetch a single category by its ID.

Get all categories with pagination

query ProductCategories {
  productCategories {
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
      count
    }
    nodes {
      id
      categoryId
      categoryName
      description
      sourceUrl
      namespace
      parentId
      calculatedFields {
        path
        depth
      }
      tracking {
        createdBy
        createdAt
        lastModifiedBy
        lastModifiedAt
      }
    }
  }
}

Get categories filtered by parent ID

query ProductCategories {
  productCategories(
    filter: [ { field: "parentId", eq: "473d331a-6884-40ab-b87b-cb1a962be764" } ]
  ) {
    nodes {
      id
      categoryId
      categoryName
      parentId
      calculatedFields { path depth }
    }
  }
}

Get categories filtered by name

query ProductCategories {
  productCategories(
    filter: [ { field: "name", eq: "camping" } ]
  ) {
    nodes {
      id
      categoryId
      categoryName
      parentId
      calculatedFields { path depth }
    }
  }
}

Get a single category by ID

query ProductCategory {
  productCategory(id: "5") {
    id
    categoryId
    categoryName
    description
    sourceUrl
    namespace
    parentId
    calculatedFields { path depth }
    tracking { createdBy createdAt lastModifiedBy lastModifiedAt }
  }
}

Response fields

  • id — System-generated unique ID for the category
  • categoryId — Customer-supplied category identifier
  • categoryName — Display name
  • description — Free-text description
  • sourceUrl — Optional URL pointing back to the customer's source system
  • namespace — One of PRIMARY, DYNAMIC, CONFLICT
  • parentId — The id of the parent category, or null for top-level categories
  • calculatedFields.path — Full hierarchy path, e.g. "sporting goods > camping > tents"
  • calculatedFields.depth — Depth in the hierarchy (1 = top level)
  • tracking — Audit info (createdBy, createdAt, lastModifiedBy, lastModifiedAt)

Authentication

This API uses API Key authentication. See Using the Connect API for instructions on how to get and use your API key.