instagram apifind location data on photolocation endpoint· 11 min read

Find Location Data on Photo Using the Instagram API

Learn to find location data on photo posts with the Instagram API: three location endpoints, JSON fields, cursor pagination, and a fallback when EXIF is gone.

Find Location Data on Photo Using the Instagram API

Search for how to find location data on a photo and the top results all say the same thing. Open the file, read the EXIF GPS tags, convert latitude and longitude, done. That advice is correct for a JPEG straight off a phone camera and close to useless for an Instagram post.

A downloaded Instagram image does not carry a coordinate pair inside the pixels. The post carries a place: a venue the poster picked from a list, stored beside the post rather than in the file. That split decides which endpoint you call, what comes back, and how you report confidence when the file is a third-generation screenshot.

Developers who follow EXIF-only guides often download an Instagram image, find no GPS block, and wrongly conclude the photo has no location. The GPS block is gone. The location was there the whole time, sitting in a different layer: the tagged place, not coordinates readers assume are still in the image.

Table of Contents

What the API Returns as Photo Location Data

An Instagram post does not hand you coordinates extracted from the image. The API exposes location as a tagged place object attached to the post, and the Get location endpoint returns its metadata: id, name, category, address, city, zip, latitude, longitude, phone, website, and an external_id that is the Facebook Places ID.

That external_id is the field most integrations ignore and later regret. It's the stable join key between the Instagram place and the same venue on Facebook, so if you're deduplicating venues across sources, match on external_id, not on the display name. Names get edited, translated, and duplicated across a city.

The three endpoints that carry place data

Endpoint Path Input Returns Cost
Search locations GET /v1/search/locations Keyword (venue name) Matching locations with ids 1 credit
Get location GET /v1/location Location id or location URL (required) id, name, category, address, city, zip, latitude, longitude, phone, website, external_id 1 credit
Location posts GET /v1/location/posts Location id or full location URL Post id, shortcode, media type, product type, URL, caption, taken_at, like/comment/view counts, image URL, video URL, duration, location details, author details 1 credit per page

All three cost one credit, and none requires an Instagram login or an app review, because public place data and posts tagged at public places are public. You're querying a REST wrapper, not negotiating OAuth scopes.

Those three endpoints cover three distinct jobs, and mixing them up is the usual source of wasted credits.

  • Read the place off a known post. The post record carries location details, including the place id. Take the id and fetch the full place metadata, no name search needed.
  • Walk a venue's feed. Once you have an id, the posts endpoint gives you everything tagged there, newest first, so a store, a stadium, or a restaurant becomes a monitorable stream.
  • Search a name you half remember. When all you have is "that rooftop bar near the river", keyword search resolves it to candidate ids and you confirm by coordinates.

When you archive the image itself, keep the place record beside it. A tool that lets you save public Instagram photos gives you the file, but the downloaded copy won't carry the coordinates. Store the API response alongside the media or you'll be re-querying the same post next month.

How to Retrieve a Photo's Location Step by Step

The sequence below is the one I'd run in any script. It resolves a name to an id, fetches the place record once, then spends credits on posts only where they're needed.

An infographic illustrating three steps to retrieve a photo's location using specific API calls.

  1. Resolve the place. Call GET /v1/search/locations with a keyword and keep the returned id. Store the whole candidate list, not just the top hit, because the first result is often a similarly named venue in another city.
  2. Fetch the place metadata. Call GET /v1/location?id=<id>, or pass the full location URL. Persist name, address, city, latitude, longitude, and external_id. This is the only call that returns the coordinate pair, so it's the record your map layer reads from.
  3. Pull the posts. Call GET /v1/location/posts?id=<id>. For each post, read its location field and compare the external_id against the place you fetched. A mismatch means the post is tagged to a different venue than the one you think you're reading.
  4. Paginate with the cursor. Keep requesting the next page until the feed ends or a returned post id is already in your table. That second condition is what stops a scheduled job from paying for the same page twice.
  5. Reverse-geocode and log. Convert latitude and longitude to a human-readable address if a report needs one, and write taken_at next to it. The timestamp is what lets you say when the photo was posted, which is not the same as when it was shot.

What a response looks like

Expect predictable JSON with a request id, credits charged, remaining balance, and processing time in the response metadata. Those four fields are your instrumentation. If remaining balance drops faster than your post count grows, a cursor is looping.

One structural limit catches people coming from mapping APIs. You cannot fetch posts by latitude and longitude radius. Instagram organises posts by tagged place, so to cover an area you enumerate the venues inside it, then pull each id in turn. A bounding-box query against this API returns an error, not a result set.

The full field list for the posts endpoint, including the media and author objects, is documented in the Instagram posts API reference.

When you need a visual cross-check on a post, the Analyze image endpoint returns AI vision tags for the image. Treat it as a separate endpoint outside the location trio and check its credit cost before you put it inside a loop over thousands of posts.

Why the Photo's GPS Data Is Often Gone

EXIF was built as a standardised way to store camera information beside image data, and its GPS extension records latitude and longitude through fields such as GPSLatitude, GPSLongitude, GPSLatitudeRef, and GPSLongitudeRef, plus altitude, GPS date and time, and camera direction. The EXIF specification documentation notes that by 2014 many digital cameras and phones had built-in GPS receivers writing those fields at capture. When a file still carries them, you get a coordinate-based starting point for mapping and reverse geocoding.

A digital illustration showing how mobile devices and cameras record GPS and EXIF location metadata in photos.

The problem is what happens between capture and download. Social platforms commonly re-encode uploaded images and remove GPS from the publicly downloadable copies, as this analysis of photo EXIF privacy explains. A screenshot, a compressed repost, or a saved download sits several generations away from the camera original. The machine-readable layer is gone, and with it any coordinate the phone once wrote.

That inversion matters more than any single field. A clean metadata result does not prove the photo had no location. It proves the layer was removed. Instagram makes this concrete, because a post can expose a manually selected place name while the downloaded image contains no EXIF coordinates at all.

Practical rule: never let an empty EXIF dump end an investigation. Record the absence, then move to the next signal layer.

Start every job by preserving the original file and computing a hash, then dump the raw EXIF and XMP fields into storage so the absence is documented rather than assumed. Use a tool built to inspect EXIF data from RAW files when you need to confirm what a camera original contained before you blame the platform.

Name the signal you used, where it came from, and how confident the result is, before any fallback runs. That one sentence of provenance is what separates a defensible answer from a guess with coordinates attached.

Fallback Inference When No Place Tag Exists

When neither the tag nor the metadata survives, don't ask a model for one unconstrained guess. Run a staged procedure and let the stages disagree with each other.

  1. Generate several independent hypotheses at country or region level from visible cues. Three competing candidates beat one confident answer.
  2. OCR everything with text. Signs, storefronts, vehicle plates, and language fragments give you script and toponym evidence that survives compression.
  3. Match distinctive structures against geospatial imagery or a reference-image index. A bridge, a chain hotel facade, a specific guardrail profile.
  4. Test consistency. Timezone, sun direction and shadow length, road markings, utility infrastructure, and terrain all have to agree with the candidate.
  5. Return a ranked list with kilometre-level error estimates. Not one street address.
  6. Require human review for anything high-impact, such as a safety, legal, or publication decision.

The published benchmarks explain why step five exists. In one evaluation, Gemini 1.5 Pro reached 81.46% country accuracy but only 8.99% city accuracy, with a 287.27 km median distance error, while Sonnet reached 70.54% country accuracy and 10.17% city accuracy at a 382.07 km median error, according to the visual geolocation benchmark study. Country-level recognition is good. Street-level recognition is not, and the gap is where false precision lives.

Dataset composition compounds it. Models do better on familiar, heavily photographed locations and can overfit visual stereotypes, which means your worst results cluster exactly where you have the least ability to notice them.

Human review isn't a token step either. As of December 2024, the GeoComp dataset contained 2.7 million unique geolocation tasks, 25 million human response records, and data from 740,000 users, per the GeoComp research authors. Crowdsourced geolocation is a real evidence layer, not a formality.

Store provenance, model and version, input resolution, OCR output, candidate scores, and corroborating evidence. Never publish exact coordinates without consent and a privacy review.

If the fallback runs inside a broader monitoring system, the same ranked-candidate logic applies to how you queue and score results, which is the pattern behind this guide to a social listening API.

Polling, Credits and Metadata Checks

A venue monitor is a polling job, and polling jobs fail on cost before they fail on logic. Four habits keep the bill predictable.

A diagram outlining three steps for optimizing API polling, including fixed intervals, early paging, and metadata checks.

Poll on a fixed schedule and store every post id you see. Call /v1/location/posts?id=<id> at a steady interval, and keep the ids in a table with a unique constraint. The stored id is the only thing that tells you where new content starts.

Stop paging the moment you hit a known id. Each page costs one credit, so a cursor that runs to the end of a venue's history every hour is pure waste after the first pass.

Validate ids before spending. A well-formed request for a private, deleted, or nonexistent account returns 404 and is still billed, because the API did query Instagram for you. Invalid input and upstream failures are not charged. The difference is whether the request was well formed.

Case Credits Note
Search locations request 1 per request
Get location request 1 per request
Location posts page 1 per page, stop on a stored id
Invalid input 0 not charged
Upstream failure 0 not charged
404 for private, deleted or nonexistent account 1 still billed, validate ids first

Log request id, credits charged, and remaining balance on every response. A runaway cursor shows up as a balance drop within an hour, which is far cheaper to catch than on an invoice.

Treat a location id and a full location URL as interchangeable inputs and store whichever your downstream code reuses most easily. If you're generating client code from a schema rather than hand-writing requests, the OpenAPI specification guide covers the typed-error side of this, which is where most wasted retries originate.

Pick the Location Method That Matches Your Question

Every method here answers a different question, and picking the wrong one produces a confident answer to something nobody asked.

Situation Method Output to report
Known post, need its tagged place Location endpoints, read place id then get location Place name, id and coordinates from the place
Venue feed, or only a half-remembered name Search by name, then posts per id Post ids, taken_at and tagged venue
Photo at a pin, any tag Enumerate venues, then pull each id Venue list with ids, not pin-level photos
No tag and no EXIF Staged visual workflow Ranked candidate with km error estimate, never one street address

The tagged place answers where this was posted. A camera's coordinates answer where this was shot. Only a visual workflow answers where this could be when neither signal survives, and it answers with a distribution rather than a point.

The distance bands published in the PIGEON geolocation paper show the shape of that distribution: PIGEON placed more than 40% of global street-level guesses within 25 km, while another evaluated system achieved 28.7% within 1 km, 59.2% within 25 km, and 95.6% within 750 km. Report the band you're operating in. A single street address from a visual model is a fiction with formatting.

For a pin-level question, remember that radius search doesn't exist here, so the honest output is a venue list with ids, not every photo at that pin. The API's organising unit is the tagged place.

My recommendation for today is unglamorous. Run the search, get, and posts loop against five venues you already know, confirm the returned place ids match the posts you expected, and log the credits you spent. That number, not a vendor comparison, tells you what your full pipeline will cost.


The Instagram API at Instagram API gives you the tagged place behind a post as structured JSON, with place search, place metadata, and paginated posts for each location id. That's the layer EXIF can't recover once a platform has re-encoded the upload, and it's the one you can query on demand. Start with five venues you already know and see what the place records return.

Pull Instagram data with one API call

Profiles, posts, reels, followers and more. 50 free credits, no credit card.

Get your free key