Instagram DM & Engagement API - Like, Follow, Comment avatar

Instagram DM & Engagement API - Like, Follow, Comment

Pricing

from $14.99 / 1,000 dm sents

Go to Apify Store
Instagram DM & Engagement API - Like, Follow, Comment

Instagram DM & Engagement API - Like, Follow, Comment

Send Instagram DMs, like posts, follow users, post comments, and scrape profiles via REST API. Multi-account sessions with proxy routing. 43 endpoints, pay-per-use. No browser, no Selenium.

Pricing

from $14.99 / 1,000 dm sents

Rating

0.0

(0)

Developer

Zen Studio

Zen Studio

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

1

Monthly active users

3 days ago

Last modified

Share

Instagram Automation API & DM Bot

The only Instagram DM API on Apify. Send, read, and automate Direct Messages programmatically. Plus: scrape private profiles you follow, automate likes, comments, follows, and more. 43 endpoints. Instant responses.

No browser. No headless Chrome. No Selenium. Just authenticated HTTP endpoints that act as your account.

Send DM example

43 endpoints. DMs, scraping, engagement, sessions. All through one REST API.

Follow example

92% open rate. Instagram DMs outperform every other channel. Send, read, react, manage threads programmatically.

Private profiles. Logs in as your account. Scrape anything a logged-in user can see.

Login once. Sessions persist for days. Multi-account. No token management.

 

What You Can Do

Direct Messages (8 endpoints)

EndpointMethodDescription
/send-dmPOSTSend DM to a user (auto-creates thread)
/send-messagePOSTSend to existing thread
/reactPOSTReact with emoji
/unreactPOSTRemove reaction
/unsendPOSTUnsend a message
/mark-readPOSTMark thread as read
/typingPOSTTyping indicator
/delete-threadPOSTDelete a thread

Read Data (15 endpoints)

EndpointMethodDescription
/user-infoGETProfile lookup (username, URL, or ID)
/user-info-by-idGETProfile by numeric ID (legacy)
/followersGETPaginated follower list
/followingGETPaginated following list
/postsGETPosts with images, videos, captions, locations
/commentsGETPost comments (paginated)
/comment-repliesGETThreaded replies
/storiesGETActive stories
/stories-trayGETAccounts with active stories
/highlightsGETHighlight reels
/highlight-itemsGETItems within a highlight
/searchGETSearch users, hashtags, places
/media-infoGETDetailed post/reel metadata
/inboxGETDM inbox threads
/threadGETMessages in a DM thread

Automate Actions (17 endpoints)

EndpointMethodDescription
/likePOSTLike a post or reel
/unlikePOSTUnlike
/savePOSTSave to collections
/unsavePOSTRemove saved post
/followPOSTFollow a user
/unfollowPOSTUnfollow
/remove-followerPOSTRemove from your followers
/blockPOSTBlock a user
/unblockPOSTUnblock
/restrictPOSTRestrict a user
/unrestrictPOSTUnrestrict
/commentPOSTPost a comment (supports replies)
/comment-likePOSTLike a comment
/comment-unlikePOSTUnlike a comment
/comment-deletePOSTDelete your comment
/story-likePOSTLike a story or highlight item
/story-unlikePOSTUnlike a story

Auth & Session (3 endpoints)

EndpointMethodDescription
/loginPOSTLogin with email/password (2FA supported)
/verify-2faPOSTSubmit verification code
/session-statusGETCheck session health

 

Quick Start

1. Login

curl https://zen-studio--instagram-automation-api.apify.actor/login \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "your@email.com", "password": "...", "country": "US"}'

2FA enabled? You'll get "status": "pending_2fa". Submit the code:

curl .../verify-2fa \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "your@email.com", "code": "123456"}'

2. Call Any Endpoint

Read a profile:

curl ".../user-info?email=your@email.com&user=zuck" \
-H "Authorization: Bearer YOUR_APIFY_TOKEN"

Like a post:

curl .../like \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "your@email.com", "media_id": "3584147232977032258"}'

Send a DM:

curl .../send-dm \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "your@email.com", "user": "zuck", "text": "Hello!"}'

Every request includes email to identify which account to use. Multiple accounts, one API.

 

Sessions

Login once. The session persists across all requests.

  • Persist across requests and restarts
  • Auto-refreshes on activity
  • Multi-account: each email gets its own isolated session
  • Check health anytime via /session-status

Sessions are tied to the proxy country you set at login. All subsequent requests for that account route through the same region.

 

Stealth: Proxy Country Routing

Instagram tracks geographic consistency. Logging in from the US, then making requests from Germany, raises flags.

Set country at login to pin all traffic to a residential proxy in that region:

{"email": "your@email.com", "password": "...", "country": "DE"}

The country code sticks with the session. Every request after login automatically routes through the same proxy region.

Supports any country available in Apify's residential proxy pool.

Rule of thumb: match the proxy country to where the account normally logs in.

 

Response Format

Every endpoint returns a consistent envelope:

{
"success": true,
"data": {
"id": "314216",
"username": "zuck",
"full_name": "Mark Zuckerberg",
"follower_count": 13200000,
"is_verified": true
},
"session": {
"status": "active",
"email": "your@email.com",
"idle_seconds": 2,
"session_age_days": 3.5,
"country": "US"
}
}

Paginated endpoints (/followers, /following, /posts, /comments, /inbox, /thread) return items with a cursor:

{
"success": true,
"data": {
"items": [ ... ],
"next_cursor": "abc123"
},
"session": { ... }
}

When next_cursor is empty, there are no more pages.

Errors include the same session object so you always know the session state:

{
"success": false,
"error": "rate_limited",
"error_code": 429,
"message": "Rate limited by Instagram, slow down",
"session": {
"status": "active",
"email": "your@email.com",
"idle_seconds": 2,
"session_age_days": 3.5,
"country": "US"
}
}

Error Codes

ErrorCodeMeaning
session_not_found404No active session, login first
login_required401Session expired, login again
account_suspended403Account has been suspended by Instagram
rate_limited429Too many requests, slow down
timeout504Request timed out, retry immediately
dm_delivery_failed422Couldn't send message to this user (DM restrictions, blocked, etc.)
ig_errorvariesInstagram rejected the request
missing_param400Required parameter missing
internal_error500Unexpected server error

Session Status

The session.status field tells you whether you need to re-login or just wait:

StatusMeaningAction
activeSession is validSafe to retry (after backoff for rate limits)
expiredSession is deadMust call /login again
not_foundNo session existsMust call /login first
pending_2faAwaiting 2FA codeSubmit code via /verify-2fa

When session.status is active on an error response (like rate_limited, timeout, or dm_delivery_failed), the session is fine. The error is temporary or specific to that action. For rate_limited, back off and retry. For timeout, retry immediately.

Pagination

Paginated endpoints accept an optional cursor query parameter. Pass the next_cursor value from a previous response to fetch the next page.

# First page
curl "https://<actor-url>/followers?email=you@email.com&user=zuck&limit=200"
# → {"data": {"items": [...], "next_cursor": "abc123"}, ...}
# Next page
curl "https://<actor-url>/followers?email=you@email.com&user=zuck&limit=200&cursor=abc123"
# → {"data": {"items": [...], "next_cursor": "def456"}, ...}
# Last page (no more results)
# → {"data": {"items": [...], "next_cursor": ""}, ...}

Each page is billed as one ig-read event ($0.001). Fetching 1,000 followers at 200 per page = 5 calls = $0.005.

Tip: When paginating large lists, deduplicate results by user/post ID on your end to ensure clean data.

 

Use Cases

Workflow Automation (n8n, Make, Zapier)

Standard HTTP request nodes. No custom code.

  • Auto-reply to DMs based on keywords
  • Like and comment on posts from a target list
  • Follow/unfollow sequences with delays
  • Forward new inbox messages to Slack

Custom Code Integration

Any language. Any framework. If it can make HTTP requests, it works.

  • Sync Instagram DMs with your helpdesk
  • Scrape profiles, then auto-follow matches
  • Track competitor posts on a schedule
  • Bulk operations across managed accounts

Scheduled Batch Runs

Not everything needs Standby. Apify's Scheduler can trigger normal Actor runs for recurring tasks:

{"action": "unfollow", "email": "your@email.com", "user": "zuck"}

Cheaper than keeping Standby alive 24/7 for infrequent jobs.

 

API Integration

Python

import requests
BASE = "https://zen-studio--instagram-automation-api.apify.actor"
HEADERS = {"Authorization": "Bearer YOUR_APIFY_TOKEN"}
# Read a profile
resp = requests.get(f"{BASE}/user-info",
params={"email": "your@email.com", "user": "zuck"},
headers=HEADERS)
print(resp.json()["data"])
# Like a post
resp = requests.post(f"{BASE}/like",
json={"email": "your@email.com", "media_id": "3584147232977032258"},
headers=HEADERS)

JavaScript

const BASE = "https://zen-studio--instagram-automation-api.apify.actor";
const headers = { Authorization: "Bearer YOUR_APIFY_TOKEN" };
// Read a profile
const resp = await fetch(
`${BASE}/user-info?email=your@email.com&user=zuck`,
{ headers }
);
const { data } = await resp.json();
// Send a DM
await fetch(`${BASE}/send-dm`, {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
email: "your@email.com",
user: "zuck",
text: "Hello!",
}),
});

 


Pricing - Pay Per Event (PPE)

You only pay for what you use. No subscriptions, no minimum spend.

EventEndpointsPer callPer 1,000
ig-readAll GET endpoints (profiles, posts, inbox, etc.)$0.001$1
ig-actionLike, follow, comment, react, etc.$0.005$5
dm-sentSend DM, send message$0.015$15
auth-actionLogin, 2FA verification$0.10$100

/session-status is always free.

Example

Look up 10 profiles, like 5 posts, send 3 DMs: 10 × $0.001 + 5 × $0.005 + 3 × $0.015 = $0.08

Reads charge per request, not per item returned. One /followers call returning 200 results = 1 read event. Paginating with cursor counts as a new request.


 

Technical Details

  • Memory: 256 MB
  • Proxy: Apify residential, per-account country routing
  • Retries: 3 attempts on transient errors
  • Sessions: KV Store, persist across runs
  • Standby: Always warm, zero cold starts

 

FAQ

Do I need an Instagram account? Yes. You authenticate via /login. The API acts on behalf of your account.

Can I manage multiple accounts? Yes. Each email gets its own session. Pass email on every request.

How long do sessions last? They auto-refresh on activity. Inactivity triggers a refresh on the next request. If the session fully expires, re-login via /login.

What about 2FA? Fully supported. /login returns "pending_2fa", then submit the code via /verify-2fa.

Is there rate limiting? No rate limits from the API itself. Instagram's own limits apply. Residential proxies help, but too many actions too fast will trigger temporary blocks. When this happens you get rate_limited (429) with session.status: "active", meaning the session is fine but you need to back off. These blocks are temporary (typically 30-60 minutes).

Rate limit persists after waiting? In rare cases, Instagram flags the session itself (not just the account). If you're still getting rate_limited after waiting, re-login via /login to get a fresh session.

What proxy country should I use? Match the account's normal login location. German account = "country": "DE". Geographic consistency avoids challenges.

Can I use this with n8n / Make / Zapier? Yes. HTTP request node + Bearer auth header + any endpoint.

/send-dm vs /send-message? /send-dm takes a user (username, URL, or ID), finds or creates the thread, sends the message. /send-message requires a thread_id you already have. Use /send-dm for convenience.

What's Standby mode? Always-on HTTP server. No queue, no cold start. Apify keeps it warm and routes requests directly.

 

Support

Have a bug to report, a feature request, or an idea for a new endpoint? Open an issue in the Issues tab. All feedback is welcome.


Disclaimer

This actor provides tools for Instagram automation. Users are responsible for complying with Instagram's Terms of Service. Use at your own risk.


Full Instagram automation through one REST API. Login, scrape, engage, message.