Social media data for AI agents
Language models do not know what a creator posted this morning. Expose a few IGramAPI endpoints as tools and your agent can look up profiles, read recent posts and comments, and answer with current, cited numbers.
How it fits together
Resolve
Turn a name the user typed into the right account before anything else.
Ground
Fetch follower counts, bio and verification so the model quotes real figures.
Read
Give the model recent posts with captions, likes and timestamps to summarise.
Compare
Check the same creator on TikTok with the same key.
Give the model tools, not pasted pages
Describe each endpoint as a function your model can call: a name, one or two parameters and what it returns. The OpenAPI file has every path, parameter and response schema, so you can generate tool definitions instead of writing them by hand.
Keep the key on your server. The model asks for a tool call, your code runs the HTTP request with the key, and only the JSON goes back into the conversation.
Keep context small and costs predictable
Send the model only the fields it needs: counts, captions, timestamps and links, not every thumbnail URL. Fetch one page at a time and stop when the model has enough. Each tool call costs a known number of credits, so an agent run has a known price: a profile plus one page of posts is 2 credits.
Tell the model what the data cannot answer. Demographics, reach and private information are not available, and an agent should say so instead of guessing.
Example request: Search API
The first step above, as you would call it. Replace YOUR_API_KEY with your key. This call costs 3 credits.
curl "https://api.igramapi.com/v1/search?q=example" \
-H "Authorization: Bearer YOUR_API_KEY" import requests
response = requests.get(
"https://api.igramapi.com/v1/search?q=example",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
response.raise_for_status()
print(response.json()) const response = await fetch("https://api.igramapi.com/v1/search?q=example", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
});
if (!response.ok) throw new Error((await response.json()).error.message);
console.log(await response.json()); <?php
$ch = curl_init("https://api.igramapi.com/v1/search?q=example");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data); {
"query": "example",
"users": [
{
"pk": "1234567890",
"username": "example_creator",
"full_name": "Example Creator",
"profile_picture_url": "https://scontent.cdninstagram.com/v/example/avatar.jpg",
"is_verified": true,
"is_private": false,
"follower_count": 182400,
"social_context": "182K followers",
"has_story": true
}
],
"hashtags": [
{
"id": "17843000000000000",
"name": "example",
"media_count": 1250000,
"subtitle": "1.2M posts",
"profile_picture_url": ""
}
],
"places": [
{
"pk": "213000000",
"name": "Example Square",
"address": "1 Main Street",
"city": "Lisbon",
"lat": 38.7139,
"lng": -9.1394
}
],
"cached": false
} Full Search API reference · Try endpoints in the playground
APIs used
- Instagram Search API: Instagram search API: search Instagram users, hashtags and places by keyword from one endpoint, with verified status, follower counts and story flags. No login.
- Instagram Profile API & Profile Scraper: Instagram profile and stats API: get any public account's followers, bio, business category, public contacts, bio links and verification as JSON. 1 credit.
- Instagram Posts API and Posts Scraper: Fetch the latest Instagram posts of any public profile with captions, likes, comments and media links. Cursor pagination, 1 credit per page.
- TikTok Profile API and Profile Scraper: Get any public TikTok profile as JSON: followers, following, total likes, video count, bio and verification. One request, 1 credit. Start free.
- Facebook Page & Profile API: Get public Facebook profile and page details as JSON: name, category, bio, verified status, follower counts, avatar and cover photo. 1 credit per lookup.
Questions
Is there an MCP server?
Not an official one yet. The OpenAPI file works with tool generators and with any framework that supports function calling.
Can the agent see private accounts?
No. Only public data is returned. Build your prompts so the agent reports when an account is private or missing (HTTP 403 or 404).
How do I stop an agent from burning credits?
Give each run a call budget in your own code, cache answers for repeated questions, and use the X-Credits-Remaining header to stop early.
Guides for this use case
Get your free API key
100 credits every month, no credit card.