# Instagram Location Scraper (`xtracto/instagram-location-scraper`) Actor

Get Instagram place data and its recent tagged posts: location name, category, coordinates, total media count, plus each post's caption, likes, comments, author and the exact venue tagged. No login.

- **URL**: https://apify.com/xtracto/instagram-location-scraper.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.67 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Instagram Location Scraper — Place Data and Recent Tagged Posts

Give it Instagram location IDs and get the place itself — name, category, coordinates and total
media count — together with its most recent tagged posts: caption, likes, comments, author, media
type and the exact venue each post was tagged at. No login, no browser.

### The ceiling, stated up front

**Up to 15 posts per location.** Instagram embeds at most that many in the page — runs returned 15,
15 and 12 for the same location — and the pagination cursor it also embeds cannot be used from an
HTTP client: passing it as `?max_id=`, `?cursor=` or `?after=`
returned the same first five posts every time — ignored, not rejected. Going deeper needs the
GraphQL persisted-query id, which is not in the initial HTML and cannot be harvested without a
browser session. The run log says so whenever Instagram reports more pages.

What you get in exchange is the place's **full metadata** — including a `media_count` in the tens of
millions for a city — and those posts with everything attached, from a single request.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `locations` | array | *required* | Numeric location IDs, or any `/explore/locations/<id>/` URL |
| `maxPostsPerLocation` | integer | `15` | Capped at 15 — see above |

### Output

One row per post, with the location block repeated so the dataset stands alone.

```jsonc
{
  "_input": "212988663",
  "_source": "S1-embedded-payload",
  "_scrapedAt": "2026-09-13T00:53:23Z",

  "postCode": "DdMkUjDESND",
  "postUrl": "https://www.instagram.com/p/DdMkUjDESND/",
  "postId": "3984717922580892255",
  "caption": "Cenas de dentro do desfile…",
  "takenAt": "2026-09-12T17:53:23Z", "takenAtTimestamp": 1789235603,

  "likeCount": 1, "commentCount": 0, "viewCount": null,
  "mediaType": "carousel", "productType": "carousel_container",
  "carouselCount": 10,
  "isPaidPartnership": false, "commentsDisabled": false,

  "authorUsername": "calvinkleinbrasil", "authorId": "1269432363",
  "authorIsVerified": true,
  "authorUrl": "https://www.instagram.com/calvinkleinbrasil/",

  "taggedVenueName": "Terminal Warehouse",     // ← not the same as the location
  "taggedVenueId": 241562007,
  "taggedVenueLatitude": 40.75171, "taggedVenueLongitude": -74.00519,

  "imageUrl": "…", "imageCount": 4,

  "locationId": "212988663",
  "locationName": "New York, New York",
  "locationCategory": "City",
  "locationSlug": "new-york-new-york",
  "locationMediaCount": 83545709,
  "locationLatitude": 40.7306, "locationLongitude": -73.9352,
  "locationPriceRange": 3,
  "locationUrl": "https://www.instagram.com/explore/locations/212988663/"
}
```

### The tagged venue is usually not the location you searched

Instagram's location pages aggregate narrower places. Searching **New York, New York** returned
posts tagged at *Terminal Warehouse*, *New York City* and *Red Hook Waterfront, Brooklyn* — in one
run, **29 of 30 posts** carried a venue different from the location searched. Both ship:
`locationName` is what you asked for, `taggedVenueName` is where the poster actually said they were,
with its own coordinates. Collapsing them into one field would quietly misplace almost every post.

### Fields not emitted, and why

`full_name` on the post author and `location_address`, `location_city`, `location_zip` and `phone`
on the place exist in Instagram's payload and are **never filled** — empty across 45 sampled posts,
and empty even for venue-type places like *Englischer Garten München* (category "Public Garden"),
not merely for cities. Shipping them would add columns that are always null.

`viewCount` **is** emitted, but it applies to video and no video appeared in the 45 posts sampled,
so it is passed through unproven rather than advertised as working.

### Errors

| `_error` | Meaning |
|---|---|
| `invalid_input` | Not a numeric ID or an `/explore/locations/<id>/` URL |
| `location_not_found` | 404, or a page with neither place metadata nor posts |
| `no_posts` | The place resolved — its metadata is on the row — but carried no posts |
| `login_required` | Instagram served a login page |
| `unexpected_shape` | The embedded payloads are gone; the page shape changed |
| `blocked` | Every TLS profile was refused |
| `network_error` | Never reached Instagram |

`no_posts` rows carry the full location metadata, so a quiet place is still useful output rather
than a lost input.

If no location resolves at all, the run fails rather than reporting success over an empty dataset.

# Actor input Schema

## `locations` (type: `array`):

Numeric Instagram location ids, or any /explore/locations/<id>/ URL. Find an id by opening a location page on Instagram — it is the number in the URL.

## `maxPostsPerLocation` (type: `integer`):

Instagram embeds at most 15 posts in the page (15, 15 and 12 observed for the same location) and its pagination cursor cannot be used without a browser session, so 15 is the ceiling regardless of what you set here.

## `proxyConfiguration` (type: `object`):

Recommended. Instagram rate-limits per IP, so residential proxies help on larger location lists.

## Actor input object example

```json
{
  "locations": [
    "212988663",
    "https://www.instagram.com/explore/locations/213385402/"
  ],
  "maxPostsPerLocation": 15,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

One row per scraped record, stored in the run's default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "locations": [
        "212988663",
        "https://www.instagram.com/explore/locations/213385402/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/instagram-location-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "locations": [
        "212988663",
        "https://www.instagram.com/explore/locations/213385402/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("xtracto/instagram-location-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "locations": [
    "212988663",
    "https://www.instagram.com/explore/locations/213385402/"
  ]
}' |
apify call xtracto/instagram-location-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xtracto/instagram-location-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/mwlb3GPQLG583ddhn/builds/uEVcKfBtvjX6vEFRK/openapi.json
