> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapebadger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Categories

> Browse Gumtree's category tree in the UK, Australia or South Africa. A node's slug is the category value /search takes.

Browse Gumtree's category tree one level at a time. On `uk` and `au` each
child's `slug` is the value [`/search`](https://docs.scrapebadger.com/api-reference/endpoint/gumtree/search)
and [`/search/filters`](https://docs.scrapebadger.com/api-reference/endpoint/gumtree/search-filters) take as
`category` — a name slug on `uk` (`cars`), the numeric id on `au` (`18320`).
On `za` pass the child's `id`, a ref such as `p6dnh` (Cars & Bakkies).

**Credits:** 1

## Authorization

**X-API-Key** `string` *required*

Your ScrapeBadger API key.

## Query Parameters

**market** `string` (default: uk)

`uk` (gumtree.com), `au` (gumtree.com.au) or `za` (gumtree.co.za).

**parent\_id** `string`

Category id (`uk`, `au`: a number) or ref (`za`) to list the children of.
Omit it for the market's root — all categories (`uk` root id `1`, `au` root
id `0` with 16 top-level categories, `za` root ref `kyzkk` with 17). Then
drill down by `id`, e.g. `2551` for UK Motors, `9299` for AU Cars &
Vehicles, `l4dq6` for ZA Vehicles.

## Response

**market** `string`

`uk`, `au` or `za`.

**id** `integer | string`

The parent category id — a ref string on `za`.

**name** `string`

e.g. `Motors`.

**slug** `string`

e.g. `cars-vans-motorbikes`.

**result\_count** `integer`

Number of children.

**children** `TreeNode[]`

Child categories.

**TreeNode**

**id** `integer | string`

Pass as `parent_id` to go one level deeper. On `za` (a ref like `p6dnh`) it is also the `/search``category` value.

**name** `string`

**slug** `string`

The `/search``category` value on `uk` (the id itself on `au`). On `za`, the site's URL segment (e.g. `cars-bakkies`) — search with the `id` instead.

**has\_children** `boolean`

## Example

```bash cURL theme={null}
curl "https://scrapebadger.com/v1/gumtree/categories?parent_id=2551" \
  -H "X-API-Key: YOUR_API_KEY"
```

```javascript Node.js theme={null}
const res = await fetch(
  "https://scrapebadger.com/v1/gumtree/categories?" +
    new URLSearchParams({ parent_id: "2551" }),
  { headers: { "X-API-Key": process.env.SCRAPEBADGER_API_KEY } },
);
const { children } = await res.json();
```

```python Python theme={null}
import requests

res = requests.get(
    "https://scrapebadger.com/v1/gumtree/categories",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"parent_id": 2551},
)
children = res.json()["children"]
```

```json Response theme={null}
{
  "market": "uk",
  "id": 2551,
  "name": "Motors",
  "slug": "cars-vans-motorbikes",
  "result_count": 12,
  "children": [
    { "id": 11986, "name": "Other Categories", "slug": "other-vehicle-categories", "has_children": false },
    { "id": 9311, "name": "Cars", "slug": "cars", "has_children": false },
    { "id": 10442, "name": "Motorbikes & Scooters", "slug": "motorbikes-scooters", "has_children": false },
    { "id": 94, "name": "Vans", "slug": "vans", "has_children": false }
  ]
}
```

### South Africa

```bash theme={null}
curl "https://scrapebadger.com/v1/gumtree/categories?market=za&parent_id=l4dq6" \
  -H "X-API-Key: YOUR_API_KEY"
```

```json Response (abridged) theme={null}
{
  "market": "za",
  "id": "l4dq6",
  "name": "Vehicles",
  "slug": "vehicles",
  "result_count": 8,
  "children": [
    { "id": "c07q9", "name": "Auto Parts & Accessories", "slug": "auto-parts-accessories", "has_children": true },
    { "id": "p6dnh", "name": "Cars & Bakkies", "slug": "cars-bakkies", "has_children": false },
    { "id": "b8stt", "name": "Motorcycles & Scooters", "slug": "motorcycles-scooters", "has_children": false }
  ]
}
```

Pass `p6dnh` as `category` to `/search?market=za` — the `slug` (`cars-bakkies`)
is the site's URL segment, not the value `/search` takes.

On `au`, `parent_id=9299` (Cars & Vehicles) lists `18320` (Cars, Vans & Utes)
among its children.

## Errors

| Status | Meaning |
| - | - |
| `400` | `parent_id` is not a number (`uk`, `au`) or not a ref (`za` — including the old numeric ids). |
| `404` | `parent_id` is not a category of this market (`au`, `za`). |
| `422` | Gumtree temporarily refused the request — **not billed**. Retry shortly. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.