NativePort
← All use cases

Collect public Instagram profiles and posts

Turn public Instagram pages into records your agent can compare and summarize.

The problem

Instagram may show your agent a login screen or only part of a page instead of the public posts you want it to read. The agent cannot fill in the missing captions or profile details on its own. It needs a tool that can collect the public information available.

How NativePort helps

NativePort connects to Instagram through a collection tool on Apify and brings back available information from public profiles and posts. Your agent can use the captions and profile details to summarize content or compare accounts. Share a public profile link with your agent and explain what you want to explore.

Let your agent build it

You don’t need to write this code yourself. Copy the prompt and paste it into your agent. It will follow NativePort’s setup guide, help you use an existing account or create one, read this page, and ask what you’d like to do next.

View prompt
Help me use NativePort for this use case.

1. Read https://nativeport.ai/SKILL.md and follow its instructions to learn how to use NativePort. Save or update the skill if your environment supports it.

2. Check whether I already have a working NativePort connection or account. Reuse it if available. Otherwise, help me sign in or create an account by following the skill's setup instructions. Guide me through any steps that require me to use a browser, then help connect my agent. Keep credentials private.

3. Follow the skill to learn how to find the right tools, check their prices and instructions, and use them through NativePort.

4. Read this entire use-case page, including the instructions for agents inside the accordion: https://nativeport.ai/use-cases/extract-instagram-data/

Once setup is complete and you have read the page, briefly explain what you can help me do and ask me what I would like to do next. Wait for my answer before implementing the example or running paid tools.
Instructions for the agents - You don't need to read this

Technical implementation

Use Python 3 with requests installed (python -m pip install requests). Set NATIVEPORT_API_KEY in your environment to your NativePort key. Run the snippets on your server, where your key stays private.

Set INSTAGRAM_URL to a public profile URL. This run collects up to five posts: it waits up to a minute for the Actor to finish, then reads the dataset it produced.

python
import os
import requests

BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}

TERMINAL = {"SUCCEEDED", "FAILED", "TIMED-OUT", "ABORTED"}


def call(method, path, **kwargs):
    response = requests.request(method, BASE + path, headers=HEADERS, timeout=90, **kwargs)
    response.raise_for_status()
    return response.json()


run = call(
    "POST",
    "/apify/v2/acts/apify~instagram-scraper/runs",
    params={"waitForFinish": 60},
    json={"directUrls": [os.environ["INSTAGRAM_URL"]],
          "resultsType": "posts", "resultsLimit": 5},
)["data"]
while run["status"] not in TERMINAL:
    run = call("GET", f"/apify/v2/actor-runs/{run['id']}", params={"waitForFinish": 60})["data"]
posts = call("GET", f"/apify/v2/datasets/{run['defaultDatasetId']}/items")
print(posts)

For profile metadata, send a separate request with resultsType: "details". Inputs follow the Instagram Actor schema. Test your target profiles before scheduling collection: availability and fields depend on Instagram and the Actor. A run that needs more than a minute keeps being polled; the Apify reference covers aborting one.

Tool costs

Tool used in the examplePrice per call
Apify — Instagram scraper Priced from Apify's reported cost for the request or run (usage-based)

Prices in USD. Usage-based tools have no fixed per-call price. View pricing.