You can scrape Instagram followers in Python by sending one or more public profile usernames, URLs, or numeric user IDs to Datablist's Instagram Followers Scraper API with the Requests library. The API returns follower records as JSON and identifies the source profile behind every relationship.

This guide starts with the followers collected for Jupiter Hikes, a long-distance hiker and filmmaker. I then reuse the same Python function to compare his collected followers with those of Darwin on the Trail, another long-distance hiker and outdoor filmmaker. The code groups the results by numeric Instagram user ID and finds the users present in both collected lists.

๐Ÿ”‘ Summary For Those In a Rush

Use Datablist's Instagram Followers Scraper API to scrape followers from public Instagram profiles with Python. Submit the profiles you want to scrape, set a per-profile limit, and retrieve the available follower records as JSON for your own research or marketing workflow. Check that Instagram lets you browse each profile's followers before starting.

  • Input: Instagram usernames, profile URLs, or numeric user IDs.
  • Output: Follower records with user IDs, available profile details, and the source profile each follower came from.

๐Ÿ’ก Prefer a no-code solution? Use Datablist's Instagram Followers source to generate follower rows without writing code.

The collection-based Instagram follower guide covers the same source through the Datablist interface. The rest of this guide focuses on the API.

Check if Instagram limits the follower list

Before submitting a scrape, open the target Instagram profile and click Followers. Check that you can browse the follower list. A public profile does not guarantee that Instagram exposes all its followers.

If you see โ€œOnly [username] can see all followers,โ€ expect a partial list from the scraper, even for a public profile. The API can retrieve only the followers Instagram makes available; increasing the requested limit does not make hidden followers accessible.

The follower visibility notice on Leviโ€™s Instagram profile.
The follower visibility notice on Leviโ€™s Instagram profile.

Check each profile you plan to scrape so you know whether its available follower list is sufficient for your task before starting the API request.

Set up Python and your Datablist API key

Datablist REST API access is included with the Growth plan. Source tasks also consume credits. I break down the follower-source cost after the walkthrough.

Create a Personal API Key from your Datablist API account page. For this example, I use the requests package. Create a project folder, open it in a terminal, and run:

shell
python -m venv .venv
source .venv/bin/activate
python -m pip install requests

Create a file named scrape_instagram_followers.py, then put your key in the DATABLIST_API_KEY environment variable:

shell
export DATABLIST_API_KEY="your-api-key"

The script reads this variable and sends the value through the X-API-Key header.

Scrape Instagram followers with one Python function

The first request uses jupiterhikes, the username of long-distance hiker and creator Jupiter Hikes. The source also accepts a full profile URL or a numeric Instagram user ID string. For example, Jupiter Hikes' numeric ID is "1507518892".

Paste this complete script into scrape_instagram_followers.py:

python
import json
import os
import time
import uuid
import requests
def scrape_instagram_users(
profiles,
api_key,
scraping_type="followers",
limit_per_profile=100,
):
"""Submit profiles, wait for the source task, and return all generated users."""
tasks_url = "https://api.datablist.com/v1/sources/tasks"
headers = {"X-API-Key": api_key}
unique_id = str(uuid.uuid4())
print(f"Task uniqueId: {unique_id}", flush=True)
payload = {
"sourceId": "instagram-source",
"uniqueId": unique_id,
"settings": {
"profiles": profiles,
"scrapingType": scraping_type,
"limitPerProfile": limit_per_profile,
},
}
response = requests.post(tasks_url, headers=headers, json=payload)
response.raise_for_status()
task = response.json()
task_id = task["@id"]
task_url = f"{tasks_url}/{task_id}"
print(f"Task ID: {task_id}")
while task["status"] not in ("completed", "failed", "stopped"):
time.sleep(3)
response = requests.get(task_url, headers=headers)
response.raise_for_status()
task = response.json()
print(f"Task status: {task['status']}; credits used: {task['credits']['used']}")
if task["status"] != "completed":
raise RuntimeError(
f"Task {task_id} {task['status']}: {task.get('error')}"
)
results = []
params = {"limit": 10}
while True:
response = requests.get(
f"{task_url}/results",
headers=headers,
params=params,
)
response.raise_for_status()
page = response.json()
results.extend(page["results"])
next_cursor = page["nextCursor"]
if next_cursor is None:
break
params["cursor"] = next_cursor
return results
if __name__ == "__main__":
api_key = os.environ.get("DATABLIST_API_KEY")
if not api_key:
raise RuntimeError("Set DATABLIST_API_KEY before running this script.")
profiles = ["jupiterhikes"]
follower_results = scrape_instagram_users(profiles, api_key)
print(json.dumps(follower_results, indent=2, ensure_ascii=False))

Run it with:

shell
python scrape_instagram_followers.py

The function makes three kinds of API calls in order.

  1. POST /v1/sources/tasks sends the source ID and settings. The API accepts the background task and returns its task ID.
  2. GET /v1/sources/tasks/{taskId} checks that task every three seconds. The Requests client waits, but the task itself runs asynchronously in Datablist.
  3. GET /v1/sources/tasks/{taskId}/results retrieves a page of flat follower objects. The loop passes every non-null nextCursor back unchanged until the API returns null.

The example sets scrapingType to followers and requests 100 users with limitPerProfile. Treat 100 as a requested limit, not an exact result count. Provider page boundaries and the users available during the task can change the number returned.

The script prints uniqueId before submission. If the connection drops during the POST, that value helps you find the accepted task instead of immediately creating another paid run.

How the API builds follower relationship records

Datablist first resolves each username, full profile URL, or numeric ID to its source Instagram profile. Background work then retrieves follower pages and handles the provider cursor. You only manage the Datablist task and result-page cursors shown in the script.

Repeated user IDs are deduplicated within one source profile's returned list. When the same user appears under two submitted creators, the API keeps two relationship records. Each one has different followerSourceProfile... fields. That behavior is what makes the audience comparison possible.

Use these fields in the next sections:

  • instagramUserId is the stable key for comparing returned users.
  • instagramUsername, instagramFullName, and the other instagram... fields describe the follower when that public value is available.
  • followerSourceProfileId, followerSourceProfileUsername, and followerSourceProfileUrl identify the starting creator.

This source retrieves relationship lists. It does not search candidates or calculate confidence scores.

Read the Jupiter Hikes results

The completed Jupiter Hikes task returned 124 unique follower records and used 2.24 credits. Although the request specified limitPerProfile: 100, the running count was 99 before the provider returned another page of 25 users. Datablist kept that complete page, which brought the result to 124.

Here is the final results-page response. The envelope and all four follower objects are preserved as returned:

json
{
"taskId": "695846750eb440c3870e763d38ef4f4b",
"results": [
{
"instagramUserId": "52256365838",
"instagramUsername": "adventuresoforest",
"instagramFullName": "Forest",
"instagramProfileUrl": "https://www.instagram.com/adventuresoforest/",
"instagramPicture": "https://scontent-fra3-2.cdninstagram.com/v/t51.82787-19/809812326_18068055263741839_8426418313724501534_n.jpg?stp=dst-jpg_e0_s150x150_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6InByb2ZpbGVfcGljLmRqYW5nby4xMDgwLmMyIn0&_nc_ht=scontent-fra3-2.cdninstagram.com&_nc_cat=107&_nc_oc=Q6cZ2gGE1JNYkQoszNL29wj7UyG4OGKOarcf_iw1luHzGMllAjP-kLWQ5LQPxtYI3LUcC5g&_nc_ohc=1hyyyEDHulgQ7kNvwFJIKKP&_nc_gid=ATIykjgJSgaEOBqdAnjQcg&edm=AIfao94BAAAA&ccb=7-5&ig_cache_key=GGbBRDCPB8fvzDBAAB4eZa7PpvB0bmNDAQAB1501500j-ccb7-5&oh=00_AQQZ3R0wDeV-bTnR2lYSje_IQ-ly9n6pyxGHXpJGAmzUHA&oe=6AF37F89&_nc_sid=9f8d40",
"followerSourceProfile": "https://www.instagram.com/jupiterhikes/",
"followerSourceProfileId": "1507518892",
"followerSourceProfileUsername": "jupiterhikes",
"followerSourceProfileUrl": "https://www.instagram.com/jupiterhikes/",
"instagramVerified": false,
"instagramPrivate": false
},
{
"instagramUserId": "199102398",
"instagramUsername": "richie_nu_field",
"instagramFullName": "ๆ–ฐ้‡Ž ่ฑŠ",
"instagramProfileUrl": "https://www.instagram.com/richie_nu_field/",
"instagramPicture": "https://scontent-fra3-1.cdninstagram.com/v/t51.2885-19/348434195_2264827180367957_813086592749200065_n.jpg?stp=dst-jpg_e0_s150x150_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6InByb2ZpbGVfcGljLmRqYW5nby42NDAuYzIifQ&_nc_ht=scontent-fra3-1.cdninstagram.com&_nc_cat=105&_nc_oc=Q6cZ2gGE1JNYkQoszNL29wj7UyG4OGKOarcf_iw1luHzGMllAjP-kLWQ5LQPxtYI3LUcC5g&_nc_ohc=xux3gQ4SQEAQ7kNvwGj5tEv&_nc_gid=ATIykjgJSgaEOBqdAnjQcg&edm=AIfao94BAAAA&ccb=7-5&ig_cache_key=GBOvxBRVQJAr2QsIAMHicrzyqUgLbkULAAAB1501500j-ccb7-5&oh=00_AQRa3Zl_viAM914UM1_kQYrqGwPLfpmVqPwlMltzkNd44Q&oe=6AF3871F&_nc_sid=9f8d40",
"followerSourceProfile": "https://www.instagram.com/jupiterhikes/",
"followerSourceProfileId": "1507518892",
"followerSourceProfileUsername": "jupiterhikes",
"followerSourceProfileUrl": "https://www.instagram.com/jupiterhikes/",
"instagramVerified": false,
"instagramPrivate": false
},
{
"instagramUserId": "43861505420",
"instagramUsername": "shivroam",
"instagramFullName": "Shivam Rana I Mountaineer",
"instagramProfileUrl": "https://www.instagram.com/shivroam/",
"instagramPicture": "https://scontent-fra3-1.cdninstagram.com/v/t51.82787-19/858921985_18104766389457421_6701325443259882004_n.jpg?stp=dst-jpg_e0_s150x150_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6InByb2ZpbGVfcGljLmRqYW5nby4xMDgwLmMyIn0&_nc_ht=scontent-fra3-1.cdninstagram.com&_nc_cat=101&_nc_oc=Q6cZ2gGE1JNYkQoszNL29wj7UyG4OGKOarcf_iw1luHzGMllAjP-kLWQ5LQPxtYI3LUcC5g&_nc_ohc=NMw7vs1oyqQQ7kNvwEYvnsx&_nc_gid=ATIykjgJSgaEOBqdAnjQcg&edm=AIfao94BAAAA&ccb=7-5&ig_cache_key=GAEcMjMNkmJpMFJAABTaykn84-9cbmNDAQAB1501500j-ccb7-5&oh=00_AQR5iJXKSUhS5uS8xmmkgeYw-QZ8AbYxVHqIj3guogZgyA&oe=6AF38C8B&_nc_sid=9f8d40",
"followerSourceProfile": "https://www.instagram.com/jupiterhikes/",
"followerSourceProfileId": "1507518892",
"followerSourceProfileUsername": "jupiterhikes",
"followerSourceProfileUrl": "https://www.instagram.com/jupiterhikes/",
"instagramVerified": false,
"instagramPrivate": false
},
{
"instagramUserId": "23413245087",
"instagramUsername": "double24762",
"instagramFullName": "double ไฝณ",
"instagramProfileUrl": "https://www.instagram.com/double24762/",
"instagramPicture": "https://scontent-iad6-1.cdninstagram.com/v/t51.2885-19/573323465_1219825463302212_7278921664109726296_n.png?stp=dst-jpg_e0_s150x150_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6InByb2ZpbGVfcGljLmRqYW5nby4xNTAuYzIifQ&_nc_ht=scontent-iad6-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gH2sHBsdmQY1aWiWoZZWA6eZ603UbEQOH0raGAaH9APRHqzVjuOTqB7gW86Vp6E9Xx44csiK9pjfjrqCVl5R1HC&_nc_ohc=kwiilGbw6cUQ7kNvwHe7b38&edm=AAAAAAABAAAA&ccb=7-5&ig_cache_key=YW5vbnltb3VzX3Byb2ZpbGVfcGlj.3-ccb7-5&oh=00_AQT5TH4G4DvUg9YUXYlVAW4_1Z03ebdjvl84MLuV0umlaQ&oe=6AF37C2A&_nc_sid=328259",
"followerSourceProfile": "https://www.instagram.com/jupiterhikes/",
"followerSourceProfileId": "1507518892",
"followerSourceProfileUsername": "jupiterhikes",
"followerSourceProfileUrl": "https://www.instagram.com/jupiterhikes/",
"instagramVerified": false,
"instagramPrivate": false
}
],
"nextCursor": null
}

The first record has numeric user ID 52256365838, username adventuresoforest, and the available public profile fields. Its followerSourceProfileUsername is jupiterhikes, so you know which submitted profile produced the relationship. The task can still complete when an optional profile value is absent. Read the fields that exist instead of rebuilding every record from a fixed schema.

Compare two collected audiences by Instagram user ID

Once the single-profile request works, reuse scrape_instagram_users() with both hiking creators in one task. Group the returned relationships by numeric user ID and keep every source username attached to that ID:

python
comparison_profiles = [
"jupiterhikes",
"https://www.instagram.com/darwin_onthetrail/",
]
comparison_results = scrape_instagram_users(comparison_profiles, api_key)
audience_by_id = {}
collected_count = {}
for result in comparison_results:
source_username = result["followerSourceProfileUsername"]
collected_count[source_username] = collected_count.get(source_username, 0) + 1
user_id = result["instagramUserId"]
grouped_user = audience_by_id.setdefault(
user_id,
{"user": result, "source_profiles": set()},
)
grouped_user["source_profiles"].add(source_username)
overlap = [
{
**grouped_user["user"],
"source_profiles": sorted(grouped_user["source_profiles"]),
}
for grouped_user in audience_by_id.values()
if len(grouped_user["source_profiles"]) == len(comparison_profiles)
]
overlap_report = {
"collected_count": collected_count,
"overlap_count": len(overlap),
"overlap": overlap,
}
print(json.dumps(overlap_report, indent=2, ensure_ascii=False))

The two-profile task returned 124 follower relationships for Jupiter Hikes and 46 for Darwin on the Trail. Three numeric IDs appeared in both collected lists. The task used 2.7 credits.

The grouping code uses instagramUserId instead of the username because the ID is the stable join key returned by the API. It keeps one complete API user object and adds a sorted source_profiles list. For each of the three shared IDs, that list contains darwin_onthetrail and jupiterhikes.

For example, numeric ID 42048393083 appears once in the Jupiter Hikes results and once in the Darwin on the Trail results. Both records describe the username hikingful, but each carries a different followerSourceProfileUsername. The grouping code joins those two relationship records into one user object with source_profiles: ["darwin_onthetrail", "jupiterhikes"].

Two collected Instagram follower lists joined by numeric user ID to find audience overlap while preserving both source profiles
Two collected Instagram follower lists joined by numeric user ID to find audience overlap while preserving both source profiles

๐Ÿ“˜ Interpret the overlap narrowly: A shared ID appeared in both returned slices. It does not measure the creators' complete audience overlap, prove a current follow at publication time, or qualify the account for outreach.

The collected_count values make the denominator explicit. If you calculate a percentage, label it clearly. For example, 3 / 124 describes the shared IDs as a percentage of the Jupiter Hikes records collected in this task.

If you prefer a local browser script, see the guide to scraping Instagram followers, following lists, and post authors for free.

Enrich shared profiles for audience research

The overlap gives you numeric Instagram IDs and source provenance. A practical follow-up is to submit those shared IDs to the Instagram Profile Scraper enrichment, then segment the successful results by available website, public email, bio, category, or profile metrics.

Add this second function below the source function. It uses the same API key and the same submit, poll, and paginate sequence:

python
def enrich_instagram_profiles(overlap_users, api_key):
"""Retrieve public profile details for the numeric IDs in the overlap."""
if not overlap_users:
return []
tasks_url = "https://api.datablist.com/v1/enrichments/tasks"
headers = {"X-API-Key": api_key}
inputs = [
{
"inputId": user["instagramUserId"],
"data": {"instagramIdentifier": user["instagramUserId"]},
}
for user in overlap_users
]
payload = {
"enrichmentId": "instagram-profile-scraper",
"uniqueId": str(uuid.uuid4()),
"settings": {"scrapeType": "profile"},
"inputs": inputs,
}
response = requests.post(tasks_url, headers=headers, json=payload)
response.raise_for_status()
task = response.json()
task_id = task["@id"]
task_url = f"{tasks_url}/{task_id}"
while task["status"] not in ("completed", "failed", "stopped"):
time.sleep(3)
response = requests.get(task_url, headers=headers)
response.raise_for_status()
task = response.json()
if task["status"] != "completed":
raise RuntimeError(
f"Task {task_id} {task['status']}: {task.get('error')}"
)
profile_results = []
params = {"limit": 100}
while True:
response = requests.get(
f"{task_url}/results",
headers=headers,
params=params,
)
response.raise_for_status()
page = response.json()
profile_results.extend(page["results"])
if page["nextCursor"] is None:
break
params["cursor"] = page["nextCursor"]
return profile_results
profile_results = enrich_instagram_profiles(overlap, api_key)
profiles_with_websites = [
result
for result in profile_results
if result["status"] == "success"
and result["outputs"].get("instagramWebsite")
]
profiles_with_public_email = [
result
for result in profile_results
if result["status"] == "success"
and result["outputs"].get("instagramEmail")
]

When the two collected lists have no shared IDs, overlap is empty and this function returns [] before it sends a POST request. You can continue with an empty research segment without creating a paid enrichment task.

Using each numeric ID as both inputId and instagramIdentifier makes the join back to the overlap unambiguous. Keep every returned result object, including unsuccessful statuses, empty outputs, credit usage, and errors. Filter only when you build a local segment.

The profile mode starts at 2 credits per numeric ID and can return public bio, website, email or phone fields when the profile exposes them, along with profile counts and category details. A found profile may still have empty contact fields. The code prepares research segments locally. It does not send messages or treat a shared follower as consent to contact them.

For a no-code version of this follow-up, use Datablist's Instagram Profile Scraper.

Switch from followers to following

The same source can retrieve accounts followed by a submitted profile. Change only the scraping_type argument:

python
following_results = scrape_instagram_users(
["1507518892"],
api_key,
scraping_type="following",
limit_per_profile=100,
)

These records describe accounts followed by Jupiter Hikes. Their provenance moves to followingSourceProfileId, followingSourceProfileUsername, and followingSourceProfileUrl. Use the actual returned count just as you would in followers mode.

Estimate the Instagram follower API cost

The Instagram follower source uses 0.01 credits for each returned follower or following user. Resolving a submitted source profile can use up to 1 additional credit. Cached resolution can reduce the actual charge.

For two profiles and a requested limit of 100 users per profile, a planning estimate is:

2 ร— (1 + 100 ร— 0.01) = 4 credits

This is an estimate, not a cap. The two-profile task returned 170 relationship records and used 2.7 credits. Read task.credits.used after your run for the actual charge.

Loading pricingโ€ฆ

API access, included plan credits, optional top-ups, and task usage are separate. The Growth monthly plan costs $50 or โ‚ฌ50 and includes REST API access plus 20,000 monthly credits. The smallest current top-up adds 20,000 credits for $20 or โ‚ฌ17.50.

At those top-up rates, 1,000 returned users consume 10 credits. That usage is equivalent to $0.01 or โ‚ฌ0.00875 before source-profile resolution. This is a normalized usage value, not a package you can buy: the top-up still costs $20 or โ‚ฌ17.50, and API access still requires the Growth subscription. See the current Datablist pricing for the catalog.

The optional Instagram Profile Scraper has its own cost. With a numeric ID and scrapeType: "profile", it starts at 2 credits for each submitted overlap profile.

Fix common input, task, and result problems

The API key is missing

The script raises Set DATABLIST_API_KEY before running this script. before an HTTP request. Export the variable in the same shell and run the file again.

The API rejects the key

response.raise_for_status() raises an HTTP error. Check that you copied the Personal API Key correctly and that your account has Growth-plan API access. Keep the single X-API-Key header used in the example.

A source profile cannot be resolved

Check that each value is a username, a full Instagram profile URL, or a numeric user ID string. Inspect the existing task and its error before creating another paid run.

Credits are insufficient

Check your balance and reduce the number of profiles or the requested limit before submitting another task. A task that has already started can still have used credits.

The task is failed or stopped

The script prints the task ID and raises a RuntimeError. Use that ID to inspect the existing task, its error, credits.used, and any available partial results. A failed or stopped task can retain generated rows, so do this before submitting again.

The returned count differs from the requested limit

Report the actual count from the results. limitPerProfile is a requested limit. It does not guarantee an exact number, and one result does not tell you why the provider returned fewer or more accessible users.

The submission response was lost

List your recent source tasks and match the uniqueId printed before the POST:

python
unique_id = "paste-the-printed-unique-id"
response = requests.get(
"https://api.datablist.com/v1/sources/tasks",
headers={"X-API-Key": api_key},
params={"sourceId": "instagram-source", "limit": 100},
)
response.raise_for_status()
for task in response.json()["tasks"]:
if task["uniqueId"] == unique_id:
print(task["@id"], task["status"])

Continue polling that task ID or retrieve its existing results. The Sources task documentation covers the list, status, result, and retention endpoints in detail.

Next steps

You now have one reusable Python Requests function that retrieves Instagram follower relationships and a local report that compares the collected Jupiter Hikes and Darwin on the Trail lists by numeric user ID. Each shared record keeps both source profiles.

Replace the examples with a small, reviewed set of public creator profiles. Choose a deliberate per-profile limit, then interpret the overlap against the actual count returned for each source. You can download the maintained synchronous Requests example or use the maintained async HTTPX example when you need non-blocking concurrency. If you need source accounts first, start with the guide to finding Instagram profiles by keywords.