WooCommerce API — Store Category Tree
Documentation menu
FetchLayer FetchLayer API

List a store's categories

Read a WooCommerce store's category tree: each category's name, slug, URL, description, parent, image and the number of products the store reports in it. Cheap on every data source, so it is the usual way to map a catalog before deciding which slices of it are worth pulling as products.

POST /categories Catalog
https://api.fetchlayer.dev/woocommerce-stores/categories
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

store string required

Store domain, for example example.com, or any URL on the store. 3–255 characters.

dataSource string optional

Pin the read to one published source: catalog-api, content-api or product-pages. catalog-api carries every field, content-api carries no prices, SKUs or stock, and product-pages carries no attributes or variations and is far more expensive to read. (default: the most complete source the store offers)

limit number optional

Maximum categories returned (max 500), or -1 for everything available. (default: 30)

slug string optional

Only the category with this slug.

parent string optional

Only categories directly under this one, by slug or id.

includeEmpty boolean optional

Include categories holding no products. (default: false)

pages number optional

Pages of results to collect in one request (max 100), or -1 for the maximum allowed. Each page walked counts as one request.

cursor string optional

Resume from a previous response's nextCursor.

delayMs number optional

Milliseconds to wait between requests to the store (max 30000). Use it on a store you are walking deeply.

timeoutMs number optional

Per-request time limit in milliseconds (max 600000).

Response Fields

categories

List a store's categories

requestedUrl string

The store this result corresponds to.

scrapedAt string

ISO 8601 timestamp of the read.

blocked boolean

Always false on a successful response.

notes string[]

Caveats about this particular result — a truncated walk, an upstream limit, a field this store does not publish. Read it: a short result set is usually explained here rather than by an error.

store object

The resolved store: canonical domain and the store's own base URL.

dataSource string

Which published source these categories were read from.

categories object[]

The matching categories.

categories[].id number | null

The store's own category id.

categories[].name string

Category name.

categories[].slug string | null

Pass it to /products as category.

categories[].parentId number | null

Parent category id — walk it to rebuild the tree.

categories[].productCount number | null

Products in the category, as the store reports it.

categories[].imageUrl string | null

Category image, where the store sets one.

categoryCount number

Categories in this response.

totalCategories number | null

The total the store reports, where it reports one.

nextCursor string | null

Pass back as cursor to continue, or null when the listing is exhausted.

Request

curl -X POST "https://api.fetchlayer.dev/woocommerce-stores/categories" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"store":"example-shop.com","includeEmpty":false,"limit":100}'

Response

{
  "dataSource": "catalog-api",
  "categoryCount": 24,
  "totalCategories": 24,
  "categories": [
    {
      "id": 31,
      "name": "Outerwear",
      "slug": "outerwear",
      "parentId": null,
      "productCount": 118
    }
  ],
  "notes": []
}