Developer Docs

Instagram Scraper: Profiles, Posts, Reels & Comments

Scraping is asynchronous: submit a run → poll status → fetch data. See Quick Start for the full end-to-end flow, and Auth & Error Handling for the shared envelope, run state machine, billing, and error codes. This page only lists each endpoint's submit parameters (target fields) and output record fields.


At a Glance

  • Base URL: https://api.antsdata.com/v1
  • Submit a run: POST /v1/scraper/instagram/<resource>, body { deliveryMode, recordLimit, targets:[…] }

💡 You can also use deliveryMode: "sync" (small jobs block until terminal, auto fallback to polling on timeout) — see quick-start · Sync mode.

  • Auth: header Authorization: Bearer ants_xxxxxxxxxxxx (static API Key)
  • Content-Type: application/json
  • targets: array input (≥1); each element's fields = the endpoint's "target fields" table below. Per-target success/failure lives in the run's tasks[], not in the result records.
  • Fetching data: submit returns 201 + { id, status:"queued" }; poll GET /v1/scraper/runs/{id} until succeeded, then page through records or download by id (see Quick Start).

Endpoints

Endpoint Description Target field
POST /v1/scraper/instagram/profile Account profile username
POST /v1/scraper/instagram/posts Account posts username
POST /v1/scraper/instagram/reels Account Reels username
POST /v1/scraper/instagram/comments Post comments post

Profile — Account Profiles

Scrape the public profile of one or more accounts.

Endpoint: POST /v1/scraper/instagram/profile

Target fields (each element of targets[]):

Field Type Required Description
username string Account username

Output record fields (each item in records):

Field Type Description Example
username string Instagram username. nike
fullName string Display name. Nike
biography string Bio. Just do it.
externalUrl string External link URL. https://nike.com
followersCount number Follower count. 305000000
followsCount number Following count. 185
postsCount number Total number of posts. 987
isVerified boolean Whether the account has a verified badge. true
isBusinessAccount boolean Whether the account is a business account. true
businessCategory string Business category. Sports Apparel
profilePicUrl string Avatar URL. https://instagram.fcdn.net/.../xxx.jpg
profileUrl string Profile URL. https://instagram.com/nike

Submit example:

curl -X POST "https://api.antsdata.com/v1/scraper/instagram/profile" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryMode": "async",
    "recordLimit": 1000,
    "targets": [
      { "username": "nike" },
      { "username": "instagram" }
    ]
  }'

Returns 201 + { "id": <run id>, "status": "queued" }; then poll and fetch data by id (see Quick Start).


Posts — Account Posts

Scrape the posts published by a given account.

Endpoint: POST /v1/scraper/instagram/posts

Target fields (each element of targets[]):

Field Type Required Description
username string Account username

The number of posts returned per account is controlled by the run's recordLimit (default 1000).

Output record fields (each item in records):

Field Type Description Example
id string Post ID. 3201234567890123456
shortCode string Short code of the post. C1aB2c3DEF
url string Post URL. https://instagram.com/p/C1aB2c3DEF/
type string Post type: Image / Video / Sidecar / Carousel. Sidecar
caption string Post caption. Introducing the new Air Max.
createdAt string Published time. 2026-05-20T10:00:00Z
owner object Author information of the post.
owner.username string Author username. nike
owner.fullName string Author display name. Nike
metrics object Engagement metrics of the post.
metrics.likesCount number Like count. 1250000
metrics.commentsCount number Comment count. 5600
metrics.sharesCount number Share count. 8900
metrics.savesCount number Save count. 45000
metrics.viewsCount number Video view count. 2300000
media array List of media items in the post.
media.type string Media type: image / video. image
media.url string High resolution image or video URL. https://instagram.fcdn.net/.../xxx.jpg
media.width number Media width in pixels. 1080
media.height number Media height in pixels. 1350
hashtags array List of hashtags. ["nike", "airmax"]
mentions array List of mentions. ["@nikesoccer"]
location object Location attached to the post.
location.name string Location name. Beaverton, Oregon
location.lat string Latitude. 45.4871
location.lng string Longitude. -122.8037
comments array List of comments on the post.
comments.id string Comment ID. 17862345678901234
comments.text string Comment content. Love these!
comments.createdAt string Comment published time. 2026-05-20T11:00:00Z
comments.authorUsername string Username of the comment author. sneakerhead_99
comments.likesCount number Like count of the comment. 45

Submit example:

curl -X POST "https://api.antsdata.com/v1/scraper/instagram/posts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryMode": "async",
    "recordLimit": 500,
    "targets": [
      { "username": "nike" }
    ]
  }'

Returns 201 + { "id": <run id>, "status": "queued" }; then poll and fetch data by id (see Quick Start).


Reels — Account Reels

Scrape the Reels published by a given account.

Endpoint: POST /v1/scraper/instagram/reels

Target fields (each element of targets[]):

Field Type Required Description
username string Account username

The number of Reels returned per account is controlled by the run's recordLimit (default 1000).

Output record fields (each item in records):

Field Type Description Example
id string Reel ID. 3109876543210987654
shortCode string Short code of the reel. CxxY2z3ABC
url string Reel URL. https://instagram.com/reel/CxxY2z3ABC/
caption string Reel caption. Behind the design process
createdAt string Published time. 2026-04-15T08:30:00Z
videoUrl string Direct video URL. https://instagram.fcdn.net/.../xxx.mp4
thumbnailUrl string Cover image URL. https://instagram.fcdn.net/.../xxx.jpg
duration string Video duration (in seconds). 45.5
owner object Author information of the reel.
owner.username string Author username. nike
owner.fullName string Author display name. Nike
metrics object Engagement metrics of the reel.
metrics.playCount number Play count. 8500000
metrics.likesCount number Like count. 420000
metrics.commentsCount number Comment count. 3200
metrics.sharesCount number Share count. 15000
musicInfo object Music information used in the reel.
musicInfo.trackName string Track name. Original Sound - Nike
musicInfo.artistName string Artist name. Nike Official
musicInfo.musicUrl string Audio clip URL. https://instagram.com/reuse/audio/xxx/
hashtags array List of hashtags. ["nike"]
mentions array List of mentions. []
transcript string Audio transcript text (returned only when transcribeAudio=true). Welcome back to our channel...

Submit example:

curl -X POST "https://api.antsdata.com/v1/scraper/instagram/reels" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryMode": "async",
    "recordLimit": 300,
    "targets": [
      { "username": "nike" }
    ]
  }'

Returns 201 + { "id": <run id>, "status": "queued" }; then poll and fetch data by id (see Quick Start).


Comments — Post Comments

Scrape comments by post URL.

Endpoint: POST /v1/scraper/instagram/comments

Target fields (each element of targets[]):

Field Type Required Description
post string Post URL (e.g. https://www.instagram.com/p/DZyno24tbY2/)

The number of comments returned per post is controlled by the run's recordLimit (default 1000).

Output record fields (each item in records):

Field Type Description Example
postShortCode string Short code of the post the comments belong to. C1aB2c3DEF
comments array List of comments.
comments.id string Comment ID. 17862345678901234
comments.text string Comment content. Love these!
comments.createdAt string Comment published time. 2026-05-20T11:00:00Z
comments.author object Author information of the comment.
comments.author.username string Author username. sneakerhead_99
comments.author.fullName string Author display name. Mike
comments.author.profilePicUrl string Avatar URL. https://instagram.fcdn.net/.../xxx.jpg
comments.author.isVerified boolean Whether the author has a verified badge. false
comments.likesCount number Like count of the comment. 45
comments.repliesCount number Number of replies to the comment. 3
comments.replies array List of replies to the comment.
comments.replies.id string Reply ID. 17862345678905678
comments.replies.text string Reply content. Same here!
comments.replies.authorUsername string Username of the reply author. jane.doe
comments.replies.likesCount number Like count of the reply. 5
comments.replies.createdAt string Reply published time. 2026-05-20T11:15:00Z

Submit example:

curl -X POST "https://api.antsdata.com/v1/scraper/instagram/comments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryMode": "async",
    "recordLimit": 200,
    "targets": [
      { "post": "https://www.instagram.com/p/DZyno24tbY2/" }
    ]
  }'

Returns 201 + { "id": <run id>, "status": "queued" }; then poll and fetch data by id (see Quick Start).


Fetching Data & Lifecycle

After submitting a run:

  1. Poll: GET /v1/scraper/runs/{id} until status reaches a terminal state succeeded / failed (backoff 1s→2s→5s recommended).
  2. Fetch: once succeeded, page through records with GET /v1/scraper/runs/{id}/records?page=1&pageSize=20, or download the full result with GET /v1/scraper/runs/{id}/download?format=json|csv|excel.
  3. Partial success: a failing target does not affect the others — it is marked tasks[].status=failed with an errorMessage, and as long as ≥1 target succeeds the run is succeeded and returns records for the successful ones.

For full field definitions, the run state machine, billing, and error codes, see Auth & Error Handling.


FAQ

Q: Can I scrape multiple accounts / posts at once?

Yes. targets is an array; one run can hold multiple targets, executed in parallel, with per-target status in the run's tasks[].

Q: What happens with private or non-existent accounts?

That target is marked status:"failed" with an errorMessage in tasks[]; the other targets still return data and the run can be succeeded.

Q: Am I charged for failed scrapes?

No. Billing settles on the number of records successfully produced; if all targets fail the hold is released and nothing is charged (see Auth & Error Handling).

Q: What is recordLimit?

The record cap per target (default 1000). For example, on the posts endpoint with 3 username targets and recordLimit: 500, each account yields up to 500 posts.


Next Steps