πŸ“Έ Instagram

The Social Media Scraping API allows you to scrape information from Instagram. The following targets are available:

  • instagram_profile
  • instagram_post
  • instagram_reel

The API also allows you to scrape GraphQL targets which returned parsed data in JSON. The following targets are available:

  • instagram_graphql_profile
  • instagram_graphql_post
  • instagram_graphql_hashtag

Instagram profile

POST https://scraper-api.smartproxy.com/v1/scrape

Payload type: JSON

ParameterTypeRequiredDescriptionExample
urlurlβœ…Instagram profile URLhttps://www.instagram.com/nba
targetstringβœ…targetinstagram_profile
localestringlanguage locale
geostringgeolocation
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/scrape -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/nba\", \"target\": \"instagram_profile\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/nba',
  	'target': 'instagram_profile',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/scrape',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/nba',
  	'target' => 'instagram_profile',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Return value

Target returns:

  • Basic information (name, description, follower count).
  • 12 most recent posts.
  • Related accounts (variable number, only retrieved if related accounts are visible in the HTML).

Instagram GraphQL profile

POST https://scraper-api.smartproxy.com/v1/scrape

Payload type: JSON

ParameterTypeRequiredDescriptionExample
urlurlβœ…Instagram profile URLhttps://www.instagram.com/nba
targetstringβœ…targetinstagram_graphql_profile
localestringlanguage locale
geostringgeolocation
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/scrape -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/nba\", \"target\": \"instagram_graphql_profile\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/nba',
  	'target': 'instagram_graphql_profile',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/scrape',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/nba',
  	'target' => 'instagram_graphql_profile',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Return value JSON:

  • Basic information (name, description, follower count).
  • 25 most recent posts.

Instagram post

POST https://scraper-api.smartproxy.com/v1/scrape

Payload type: JSON

ParameterTypeRequiredDescriptionExample
urlurlβœ…Instagram post URLhttps://www.instagram.com/p/ChYHpdAvnob
targetstringβœ…targetinstagram_post
localestringlanguage locale
geostringgeolocation
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/scrape -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/p/ChYHpdAvnob/\", \"target\": \"instagram_post\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/p/ChYHpdAvnob/',
  	'target': 'instagram_post',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/scrape',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/p/ChYHpdAvnob/',
  	'target' => 'instagram_post',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Return value JSON:

  • Basic information (post description, likes, comment count, author, related posts).

Instagram GraphQL post

POST https://scraper-api.smartproxy.com/v1/scrape

Payload type: JSON

ParameterTypeRequiredDescriptionExample
urlurlβœ…Instagram post URLhttps://www.instagram.com/p/ChYHpdAvnob
targetstringβœ…targetinstagram_graphql_post
localestringlanguage locale
geostringgeolocation
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/scrape -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/p/ChYHpdAvnob/\", \"target\": \"instagram_graphql_post\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/p/ChYHpdAvnob/',
  	'target': 'instagram_graphql_post',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/scrape',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/p/ChYHpdAvnob/',
  	'target' => 'instagram_graphql_post',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Return value JSON:

  • Basic information (post description, likes, comment count, author, related posts).
  • The top 10 comments (Instagram sorts these by its own ranking).

Instagram reel

POST https://scraper-api.smartproxy.com/v1/scrape

Payload type: JSON

ParameterTypeRequiredDescriptionExample
urlurlβœ…Instagram reel URLhttps://www.instagram.com/reel/ClfPAdQgqTc/
targetstringβœ…targetinstagram_reel
localestringlanguage locale
geostringgeolocation
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/scrape -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/reel/ClfPAdQgqTc/\", \"target\": \"instagram_reel\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/reel/ClfPAdQgqTc/',
  	'target': 'instagram_reel',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/scrape',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/reel/ClfPAdQgqTc/',
  	'target' => 'instagram_reel',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Instagram GraphQL hashtag

API Link: https://scraper-api.smartproxy.com/v1/scrape

  POST /scrape

Payload type: JSON

Required parameters:
url (in this example, https://www.instagram.com/explore/tags/nba/)
target (in this example, instagram_graphql_hashtag)

ParameterTypeDescription
urlurlInstagram hashtag URL
targetstringtarget
localestringlanguage locale
geostringgeolocation
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/scrape -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/explore/tags/nba/\", \"target\": \"instagram_graphql_hashtag\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/explore/tags/nba/',
  	'target': 'instagram_graphql_hashtag',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/scrape',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/explore/tags/nba/',
  	'target' => 'instagram_graphql_hashtag',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Create callback for Instagram post

  POST https://scraper-api.smartproxy.com/v1/task

Payload type: JSON

ParameterTypeRequiredDescriptionExamples
urlurlβœ…Instagram post URLhttps://www.instagram.com/p/ChYHpdAvnob
targetstringβœ…targetinstagram_post
localestringlanguage locale
geostringgeolocation

curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v1/task -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/p/ChYHpdAvnob/\", \"target\": \"instagram_post\",\"locale\": \"en-us\",\"geo\": \"United States\" }"
import requests

headers = {
    'Content-Type': 'application/json'
}

task_params = {
    'url': 'https://www.instagram.com/p/ChYHpdAvnob/',
  	'target': 'instagram_post',
  	'locale': 'en-us',
  	'geo': 'United States'
}

username = 'username'
password = 'password'
  
response = requests.post(
    'https://scraper-api.smartproxy.com/v1/task',
    headers = headers,
    json = task_params,
    auth = (username, password)
)
print(response.text)
<?php

$params = array(
    'url' => 'https://www.instagram.com/p/ChYHpdAvnob/',
  	'target' => 'instagram_post',
  	'locale' => 'en-us',
  	'geo' => 'United States'
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartproxy.com/v1/task');
curl_setopt($ch, CURLOPT_USERPWD, 'username' . ':' . 'password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>

Retrieve parsed results via callback

GET https://scraper-api.smartproxy.com/v1/task/{Task_ID}/results?type=parsed

Retrieve raw HTML results via callback

GET https://scraper-api.smartproxy.com/v1/task/{Task_ID}/results?type=raw