Documentation
api.thepubdb.comEverything you need to integrate with the Pub DB API — authentication, endpoints, filtering, error handling, and SDKs.
Quick start
Get your first response in under a minute. Grab an API key from the dashboard, then make a request:
curl https://api.thepubdb.com/api/v1/pubs \
-H "X-API-Key: $PUBDB_KEY"The API returns JSON by default. Every response wraps results in a data array with a pagination object for page metadata.
{
"success": true,
"data": [
{
"id": "pub_0f1a3b",
"name": "The Crown & Anchor",
"city": "London",
"area": "Soho",
"postcode": "W1D 3HB",
"country": "GB",
"hasCaskAle": true,
"hasSundayRoast": false
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 12418,
"pages": 249,
"hasNext": true,
"hasPrev": false
}
}https://api.thepubdb.com/api/v1.Authentication
Pass your API key in the X-API-Key header on every request to an authenticated endpoint.
X-API-Key: pk_developer_xxxx····Tiers
pk_free_*Access to core list and detail endpoints. Limited monthly quota.
pk_developer_*Unlocks geo search, stats, and a higher monthly quota.
Endpoints
The API exposes five core endpoints. All return JSON and accept query parameters for filtering and pagination.
Endpoint reference
/api/v1/pubsList all pubs (paginated)/api/v1/pubs/:idGet a single pub by ID/api/v1/pubs/nearGeo search — Developer tier+/api/v1/beer-typesList tracked beer types/api/v1/contributors/leaderboardContributor leaderboard/api/v1/statsDatabase stats — Developer tier+Filtering & search
Filter pubs by amenities, location, or free-text search. All filters are query parameters on GET /api/v1/pubs.
Amenity filters
Pass any amenity as a boolean query parameter to include only matching pubs. Multiple filters are AND-ed together.
curl "https://api.thepubdb.com/api/v1/pubs?hasCaskAle=true" \
-H "X-API-Key: $PUBDB_KEY"isIndependenthasFoodhasCaskAlehasBeerGardenhasDogisFamilyFocusedisDogFriendlyisLateNighthasLiveMusichasPoolTablehasLeaderboardhasPremierLeagueisLgbtFriendlyPagination
All list endpoints are paginated. Use page and limit query parameters. The pagination object in every response includes total, page, pages, hasNext, and hasPrev.
GET /pubs?page=2&limit=25Default page size is 50. Pages are 1-indexed.
Rate limits
Rate limits are applied per API key across three windows: hourly, daily, and monthly.
HobbyDeveloperBusinessExceeded limits return a 429 Too Many Requests response. Check the X-RateLimit-Remaining header on any response to see your remaining quota.
Errors
All errors return a JSON body with a code and message field.
400bad_request401unauthorized403forbidden404not_found429rate_limited500server_error