# Spareroom — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Browse SpareRoom UK flatshare listings by city with prices, locations, images, and listing links, and fetch a curated list of top flatsharing cities.

**Category:** Real Estate | **Website:** [spareroom.co.uk/](https://spareroom.co.uk/) | **Docs:** [parse.bot/marketplace/9d4b2dd2-4dc2-44b5-935b-a2fa181f8e9c/spareroom-co-uk-api](https://parse.bot/marketplace/9d4b2dd2-4dc2-44b5-935b-a2fa181f8e9c/spareroom-co-uk-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-spareroom-co-uk-api-9d4b2dd2/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_top_cities

Get the top flatsharing cities in the UK as listed on SpareRoom. Returns a list of city names with their SpareRoom search URLs. Useful for discovering valid city inputs for the search_listings endpoint.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-spareroom-co-uk-api-9d4b2dd2/get_top_cities \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### search_listings

Search for flat listings in a specific city or area on SpareRoom. Returns paginated results with up to 100 listings per page. Each listing includes title, price (with period), location, image URL, and a detail link. Pagination is integer-based via the page param; total_count indicates total matching listings across all pages.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `city` | string | Yes | City or area to search in (e.g. London, Manchester, Brighton). |
| `page` | integer | No | Page number for pagination (1-based). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-spareroom-co-uk-api-9d4b2dd2/search_listings \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"city":"<string>","page":"<integer>"}'
```
