Instagram profile embed HTML API
  1. Docs
  2. Instagram
  3. Instagram profile embed HTML API

Instagram profile embed HTML API

The profile's embed document (what Instagram serves at /<handle>/embed/): HTML in `html`, with the follower and post counts it carries in `extra`.

GET /v1/instagram/profile/embed

GET /v1/instagram/profile/embed

The profile's embed document (what Instagram serves at /<handle>/embed/): HTML in html, with the follower and post counts it carries in extra.

  • Cost: 1 credit
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
handlestringyesUsername, with or without the leading @. Also accepted as username.

Every request also accepts:

  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).

Example request#

Set your key in the environment first (see Authentication).

1curl -G "https://api.socialscrape.dev/v1/instagram/profile/embed" \2  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3  --data-urlencode "handle=nasa"

Example response#

This is a sample from a recorded response, lists and long text are shortened. Status 200.

200 OKSample response
1{2  "ok": true,3  "credits_charged": 1,4  "credits_remaining": 4999,5  "cached": false,6  "cached_at": null,7  "request_id": "req_9319d3b216eab5563feebe05",8  "data": {9    "object": "embed",10    "platform": "instagram",11    "url": "https://www.instagram.com/nasa/",12    "html": "<!DOCTYPE html>\n<html lang=\"en\" id=\"facebook\" class=\"no_js\">\n<head><meta charset=\"utf-8\" /><meta name=\"referrer\" content=\"origin-when-crossorigin\" id=\"meta_referrer\" /><script nonce=\"kzjFYa5l\">function envFlush(e){function t(t){for(var n in...",13    "extra": {14      "embed_url": "https://www.instagram.com/nasa/embed/",15      "followers": 104361175,16      "full_name": "NASA",17      "kind": "profile",18      "posts": 4984,19      "verified": true20    }21  },22  "cursor": null,23  "has_more": null24}

Response#

A Embed object in data.

See Data models for every field. The envelope around data is described in Responses.

Errors#

Failures are free: credits_charged is 0. Branch on error.code, never on the message.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.

Every request can also fail with the account and platform errors listed on the Errors page.

Also served at#

These paths answer the same request, so code written for other APIs keeps working: /v1/instagram/user/embed. See Switching from ScrapeCreators.