> ## 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 Locations

> Browse Gumtree's location tree in the UK, Australia or South Africa: nations, states or provinces down to towns.

Browse Gumtree's location tree one level at a time. On `uk` and `au` each
child's `slug` is a valid `location` for
[`/search`](https://docs.scrapebadger.com/api-reference/endpoint/gumtree/search) — a name slug on `uk`, the
numeric id on `au`. On `za` pass the child's `id`, a ref such as `dkp8y`
(Gauteng).

* `uk`: United Kingdom → nations → counties → towns.
* `au`: Australia → states → regions → areas, each with its live ad count.
* `za`: South Africa → provinces → towns and suburbs.

**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`

Location id (`uk`, `au`: a number) or ref (`za`) to list the children of.
Omit it for the whole country (`uk` root `10000392`, `za` root `gsptp`). Then
drill down by `id`, e.g. `10000393` for England, `3003435` for the Sydney
Region, `dkp8y` for Gauteng.

## Response

**market** `string`

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

**id** `integer | string`

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

**name** `string`

e.g. `England`.

**slug** `string`

e.g. `england`.

**result\_count** `integer`

Number of children.

**children** `TreeNode[]`

Child locations.

**TreeNode**

**id** `integer | string`

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

**name** `string`

**slug** `string`

The `/search``location` value on `uk` (the id itself on `au`). `null` on `za` — search with the `id`.

**has\_children** `boolean`

## Example

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

```javascript Node.js theme={null}
const res = await fetch(
  "https://scrapebadger.com/v1/gumtree/locations?" +
    new URLSearchParams({ parent_id: "10000393" }),
  { 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/locations",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"parent_id": 10000393},
)
children = res.json()["children"]
```

```json Response theme={null}
{
  "market": "uk",
  "id": 10000393,
  "name": "England",
  "slug": "england",
  "result_count": 47,
  "children": [
    { "id": 11000000, "name": "Bedfordshire", "slug": "bedfordshire", "has_children": true },
    { "id": 11000001, "name": "Berkshire", "slug": "berkshire", "has_children": true },
    { "id": 10000348, "name": "Bristol", "slug": "bristol", "has_children": true }
  ]
}
```

### Australia

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

```json Response (abridged) theme={null}
{
  "market": "au",
  "id": 3003435,
  "name": "Sydney Region",
  "slug": "3003435",
  "result_count": 38,
  "children": [
    { "id": 3003812, "name": "Ku-ring-gai Area", "slug": "3003812", "has_children": null },
    { "id": 3003771, "name": "Inner Sydney", "slug": "3003771", "has_children": null },
    { "id": 3003633, "name": "Eastern Suburbs", "slug": "3003633", "has_children": null }
  ]
}
```

On `za`, the root (`parent_id` omitted, ref `gsptp` South Africa) lists the 9
provinces — `dkp8y` Gauteng, `pys74` KwaZulu-Natal, `x0r1b` Western Cape … Each province lists its towns:

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

```json Response (abridged) theme={null}
{
  "market": "za",
  "id": "dkp8y",
  "name": "Gauteng",
  "slug": null,
  "result_count": 80,
  "children": [
    { "id": "yb4jd", "name": "Akasia", "slug": null, "has_children": true },
    { "id": "m22ns", "name": "Alberton", "slug": null, "has_children": true },
    { "id": "tvszd", "name": "Alexandra", "slug": null, "has_children": false }
  ]
}
```

## 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 location 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.