# UK Parliament API
> The UK Parliament as an API — Members of the House of Commons (MPs) and the House of Lords, and the bills passing through Parliament, live from the official UK Parliament data services. Search members by name and house and get their party, constituency or peerage, gender, portrait and membership dates; look up any member by id; and search the bills currently before (or recently passed) Parliament with their long and short titles, originating and current house, and current stage (e.g. Report stage, Royal Assent). Ideal for civic-tech, news, political-research, transparency and government-monitoring apps. Open data from the UK Parliament.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/ukparliament-api/..."
```

## Pricing
- **Free** (Free) — 3,950 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 52,500 calls/Mo, 8 req/s
- **Pro** ($13/Mo) — 251,000 calls/Mo, 20 req/s
- **Mega** ($35/Mo) — 1,208,000 calls/Mo, 50 req/s

## Endpoints

### UK Parliament

#### `GET /v1/bills` — Search bills before Parliament

**Parameters:**
- `q` (query, optional, string) — Search term (full-text)
- `current_house` (query, optional, string) — commons | lords
- `sort` (query, optional, string) — date (default) | title
- `limit` (query, optional, string) — Results per page (1-50, default 20) Example: `20`
- `skip` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ukparliament-api/v1/bills?limit=20&skip=0"
```

**Response:**
```json
{
    "data": {
        "count": 20,
        "query": null,
        "total": 3891,
        "results": [
            {
                "id": 4030,
                "url": "https://bills.parliament.uk/bills/4030",
                "title": "Railways Bill",
                "is_act": false,
                "long_title": null,
                "is_defeated": false,
                "last_update": "2026-05-29T21:30:34.5777116",
                "current_house": "Commons",
                "current_stage": "Report stage",
                "originating_house": "Commons"
            },
            {
                "id": 4080,
                "url": "https://bills.parliament.uk/bills/4080",
                "title": "Representation of the People Bill",
                "is_act": false,
                "long_title": null,
                "is_defeated": false,
                "last_update": "2026-05-29T21:16:22.5580253",
                "current_house": "Commons",
                "current_stage": "Report stage",
                "originating_house": "Commons"
            },
            {
                "id": 4123,
                "url": "https://bills.parliament.uk/bills/4123",
                "title": "Steel Industry (Nationalisation) Bill",
                "is_act": false,
                "long_title": null,
                "is_defeated": false,
                "last_update": "2026-05-29T18:46:12.9017698",
                "current_house": "Commons",
                "current_stage": "Committee 
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/member` — One member by id

**Parameters:**
- `id` (query, required, string) — Member id, e.g. 172 (Diane Abbott) Example: `172`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ukparliament-api/v1/member?id=172"
```

**Response:**
```json
{
    "data": {
        "member": {
            "id": 172,
            "name": "Ms Diane Abbott",
            "house": "Commons",
            "party": "Independent",
            "gender": "F",
            "thumbnail": "https://members-api.parliament.uk/api/Members/172/Thumbnail",
            "full_title": "Rt Hon Diane Abbott MP",
            "is_current": true,
            "member_since": "1987-06-11T00:00:00",
            "membership_from": "Hackney North and Stoke Newington"
        }
    },
    "meta": {
        "timestamp": "2026-05-31T10:30:27.555Z",
        "request_id": "3b3e3799-0e07-4cdf-8ea7-37bdb3d6a918"
    },
    "status": "ok",
    "message": "Member retrieved",
    "success": true
}
```

#### `GET /v1/members` — Search MPs & Lords

**Parameters:**
- `name` (query, required, string) — Member name, e.g. Sunak Example: `Sunak`
- `house` (query, optional, string) — commons | lords
- `current` (query, optional, string) — false = include former members
- `limit` (query, optional, string) — Results per page (1-50, default 20) Example: `20`
- `skip` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ukparliament-api/v1/members?name=Sunak&limit=20&skip=0"
```

**Response:**
```json
{
    "data": {
        "count": 1,
        "house": null,
        "query": "Sunak",
        "total": 1,
        "results": [
            {
                "id": 4483,
                "name": "Rishi Sunak",
                "house": "Commons",
                "party": "Conservative",
                "gender": "M",
                "thumbnail": "https://members-api.parliament.uk/api/Members/4483/Thumbnail",
                "full_title": "Rt Hon Rishi Sunak MP",
                "is_current": true,
                "member_since": "2015-05-07T00:00:00",
                "membership_from": "Richmond and Northallerton"
            }
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T10:30:27.940Z",
        "request_id": "034a023f-9755-4d17-b7ab-8c5c7d2dbf10"
    },
    "status": "ok",
    "message": "Members searched",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Source & options

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ukparliament-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "Live UK Parliament data. /v1/members searches Members of the House of Commons (MPs) and House of Lords by name and house; /v1/member returns one member by id; /v1/bills searches bills currently before (or recently passed) Parliament with their current stage.",
        "houses": [
            "commons",
            "lords"
        ],
        "source": "UK Parliament (members-api & bills-api.parliament.uk)",
        "endpoints": [
            "/v1/members",
            "/v1/member",
            "/v1/bills",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T10:30:27.991Z",
        "request_id": "c2738c88-b5a7-4eb5-b726-8944c3b34a20"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/ukparliament-api
OpenAPI spec: https://www.oanor.com/api/ukparliament-api/openapi.json
