Instagram

The Social Media Scraping API allows you to scrape information from Instagram.

The API uses GraphQL targets which return data in JSON.

📘

While the targets in this page use GraphQL under the hood, they are interfaced with via REST.

The following Instagram targets are available:

TargetSyncAsyncBatchPagination
instagram_graphql_user_posts
instagram_graphql_profile
instagram_graphql_post

Instagram GraphQL User Posts

Returns information about a specific Instagram user.

ParameterTypeRequiredDescriptionExample
targetstringtargetinstagram_graphql_user_posts
querystringqueryInstagram user profile namenba
cursorstringnext page string (look for end_cursor value in response)3547611165414990351\_1067259270

Pagination

When making an initial request:

{
    "target": "instagram_graphql_user_posts",
    "query": "nba"
}

The response will contain an end_cursor:

{
    ...
    "page_info": {
        "end_cursor": "3547611165414990351_1067259270",
        "has_next_page": true,
        "has_previous_page": false,
        "start_cursor": null
    },
    ...
}

This cursor can be user to fetch the next page of results:

{
    "target": "instagram_graphql_user_posts",
    "query": "nba",
    "cursor": "3547611165414990351_1067259270"
}

Instagram GraphQL profile

Returns information about a specific Instagram user.

ParameterTypeRequiredDescriptionExample
targetstringtargetinstagram_graphql_profile
querystringInstagram profile namenba

Return value JSON:

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

Instagram GraphQL post

Returns information from a specific Instagram post.

🚧

This target does not support batch integration.

ParameterTypeRequiredDescriptionExample
targetstringtargetinstagram_graphql_post
urlstringInstagram post URL<https://www.instagram.com/p/ChYHpdAvnob>

Create callback for Instagram post

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

Payload type: JSON

ParameterTypeRequiredDescriptionExamples
targetstringtargetinstagram_graphql_post
urlurlInstagram post URLhttps://www.instagram.com/p/ChYHpdAvnob
curl -u username:password -X POST --url https://scraper-api.smartproxy.com/v2/task -H "Content-Type: application/json" -d "{\"url\": \"https://www.instagram.com/p/ChYHpdAvnob/\", \"target\": \"instagram_graphql_post\",\"locale\": \"en-us\",\"geo\": \"United States\" }"

Retrieve parsed results via callback

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

Retrieve raw HTML results via callback

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