# Instagram Location API

> Find Instagram places by name or near a point, get a place's details and its top or recent posts, as JSON. 1 credit per call.

**Find Instagram places by name or near a latitude and longitude**, get a place's name, category, address and contact, and **read its top or recent posts**.

```
GET https://api.klupt.io/v1/search/places?q=&lat=&lng=
GET https://api.klupt.io/v1/places/{place}
GET https://api.klupt.io/v1/places/{place}/posts
```

- `GET /v1/search/places?q=&lat=&lng=`: Find places
- `GET /v1/places/{place}`: A place
- `GET /v1/places/{place}/posts`: Top or recent posts at a place

**Cost:** 1 credit per successful call (0.5 from cache). Failed calls and private accounts are free.

## Parameters

| Parameter | In | Description |
|---|---|---|
| `q` | query | search: a place name. |
| `lat` | query | search: latitude (with lng). |
| `lng` | query | search: longitude. |
| `place` | path | Numeric place id. |
| `sort` | query | posts: `top` (default) or `recent`. |
| `cursor` | query | `pagination.next_cursor` from the previous page. |
| `fresh` | query | `true` skips the cache (full price). |

## Response

```json
{{SAMPLE_search_places}}
```

## Examples

```bash
curl "https://api.klupt.io/v1/search/places?lat=48.8584&lng=2.2945" -H "X-Api-Key: $KLUPT_API_KEY"
```

```python
import os, requests
r = requests.get("https://api.klupt.io/v1/search/places?lat=48.8584&lng=2.2945",
                 headers={"X-Api-Key": os.environ["KLUPT_API_KEY"]}, timeout=30)
r.raise_for_status()
for p in r.json()["data"]:
    print(p["id"], p["name"], p["city"])
```

```javascript
const res = await fetch("https://api.klupt.io/v1/search/places?lat=48.8584&lng=2.2945", {
  headers: { "X-Api-Key": process.env.KLUPT_API_KEY },
});
const { data: places } = await res.json();
```

## FAQ

### How do I get Instagram posts from a location?
Find the place with `GET /v1/search/places`, then call `GET /v1/places/{id}/posts?sort=recent` for the newest posts tagged there.
