Introduction
Welcome to the LP Anywhere API! You can use our API to access Lonely Planet articles and POIs, with a valid API Key.
We have language bindings in Shell, Ruby, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
This example API documentation page was created with Slate.
Authentication
To authorize, add the
x-api-keyparameter to your request headers and pass your API key as the value:
# With shell, you can just pass the correct header with each request
curl --location --globoff 'https://data.lonelyplanet.com/anywhere/api/v1/pois?place=italy/florence&page_size=20&page_offset=0' \
--header 'x-api-key: <API KEY>' \
--header 'Content-Type: application/json'
Make sure to replace
<API KEY>with your API key.
POIs
POIs are Lonely Planets catalog of Points of Interest, associated with a given place, i.e. The Eiffel Tower is a POI in Paris, France.
Get All POIs
POIs are accessed through the /anywhere/api/v1/pois endpoint. Results are paged. If no page size is provided, the default is 10 per page. The maximum number of results per page is 100.
# With shell, you can just pass the correct header with each request
curl --location --globoff 'https://data.lonelyplanet.com/anywhere/api/v1/pois?place=italy/florence&page_size=20&page_offset=0' \
--header 'x-api-key: <API KEY>' \
--header 'Content-Type: application/json'
The above command returns JSON structured like this:
[
{
"id": "string",
"title": "string",
"excerpt": "string",
"body": "HTML string",
"type": {
"title": "string",
"slug": "string"
},
"coordinates": {
"lat": "string",
"lon": "string"
},
"featured_image": {
"alt": "string",
"caption": "string",
"credit": "string",
"height": "integer",
"name": "string",
"title": "string",
"url": "string",
"width": "integer"
}
},
{
"id": "string",
"title": "string",
"excerpt": "string",
"body": "HTML string",
"type": {
"title": "string",
"slug": "string"
},
"coordinates": {
"lat": "string",
"lon": "string"
},
"featured_image": null
}
]
HTTP Request
GET https://data.lonelyplanet.com/anywhere/api/v1/pois?place=italy/florence
Query Parameters
| Parameter | Default | Description | Required |
|---|---|---|---|
| place | null |
A Lonely Planet place slug, i.e. italy/florence |
✅ |
| tag[] | null |
Accepts a tag slug. Limit results to matching tags. Each POI can have more than one tag. Not exclusive. i.e. tag[]=art-and-culture&tag[]=dining will match POIs with either or both terms. |
|
| type[] | null |
Accepts a type slug. Limit results to matching POI types. Each POI has only one type. Not exclusive. i.e. type[]=attractions&type[]=restaurants will match POIs of either type. |
|
| top_tier | null |
Accepts a boolean value. "false" has no effect. If used in combination with type[], incompatible types will be excluded from the results. If all given types are incompatible the results will be empty. |
|
| page_size | 10 | Maximum size is 100 items. | |
| page_offset | 0 | How many results to skip. i.e. To get page 2 using the default page size you would pass page_offset=10 |
POI Types
| Title | Slug | Top Tier |
|---|---|---|
| Do | activities |
|
| Drink | nightlife |
✅ |
| Eat | restaurants |
✅ |
| Entertainment | entertainment |
✅ |
| Event | event |
|
| General | information |
|
| See | attractions |
✅ |
| Shop | shopping |
✅ |
| Sleep | hotels |
|
| Transport | transportation |
Articles
Get All Articles
Articles are accessed through the /anywhere/api/v1/articles endpoint. Results are paged. If no page size is provided, the default is 10 per page. The maximum number of results per page is 100.
# With shell, you can just pass the correct header with each request
curl --location --globoff 'https://data.lonelyplanet.com/anywhere/api/v1/articles?place=italy/florence&page_size=20&page_offset=0' \
--header 'x-api-key: <API KEY>' \
--header 'Content-Type: application/json'
The above command returns JSON structured like this:
[
{
"id": "string",
"title": "string",
"excerpt": "string",
"body": "HTML string",
"featured_image": {
"alt": "string",
"caption": "string",
"credit": "string",
"height": "integer",
"name": "string",
"title": "string",
"url": "string",
"width": "integer"
},
"authors": [
{
"image": {
"alt": "string",
"caption": "string",
"credit": "string",
"height": "integer",
"name": "string",
"title": "string",
"url": "string",
"width": "integer"
},
"name": "string"
},
{
"image": {
"alt": "string",
"caption": "string",
"credit": "string",
"height": "integer",
"name": "string",
"title": "string",
"url": "string",
"width": "integer"
},
"name": "string"
}
]
},
{
"id": "string",
"title": "string",
"excerpt": "string",
"body": "HTML string",
"featured_image": null,
"authors": []
}
]
HTTP Request
GET https://data.lonelyplanet.com/anywhere/api/v1/articles?place=italy/florence
Query Parameters
| Parameter | Default | Description | Required |
|---|---|---|---|
| place | null |
A Lonely Planet place slug, i.e. italy/florence |
✅ |
| tag[] | null |
Accepts a tag slug. Limit results to matching tags. Each Article can have more than one tag. Not exclusive. i.e. tag[]=art-and-culture&tag[]=dining will match Articles with either or both terms. |
|
| page_size | 10 | Maximum size is 100 items. | |
| page_offset | 0 | How many results to skip. i.e. To get page 2 using the default page size you would pass page_offset=10 |
Errors
The Anywhere API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 403 | Forbidden -- The place requested is oustide of your licensed agreement. |
| 404 | Not Found -- The specified resource could not be found. |
| 429 | Too Many Requests |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |