Instagram Posts API integration for AI agents

<h2>Instagram Posts API & Chase Agents</h2><h3>Manage Your Structured Content Seamlessly: Chase Agents & Instagram Posts API Integration</h3><p>Chase Agents enhances your content operations by integrating directly with Instagram Posts API. Build powerful automated agents and applications that can create, read, update, and query your structured content within Sanity—all without writing complex code, managed through Chase Agents's intuitive no-code platform. Streamline content workflows from creation to publication effortlessly.</p>

Connect Instagram Posts API to Chase Agents as an API connection, then use it in plain-English automations — on the web, in Slack, or inside ChatGPT and Claude via MCP. Chase Agents builds the workflow and deterministic code runs it.

How to connect Instagram Posts API

Add Instagram Posts API from the Chase Agents connections marketplace as API connection, provide the required credentials, and reference it in your automation steps. See plans or read the connection guide.

About Instagram Posts API

Instagram Scraper Stable API Documentation

Overview

This document provides comprehensive documentation for the Instagram Scraper Stable API endpoints available through RapidAPI. These endpoints allow you to access various Instagram data including media details, post information, comments, and user data.

Authentication

All API requests require the following headers:

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

Base URL

All endpoints are available at:

https://instagram-scraper-stable-api.p.rapidapi.com/

API Endpoints

1. Get Detailed Media Data v2 (with play_count)

Retrieves detailed media data including play count for a specific media item.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_media_data_v2.php

Parameters:

  • media_id (string, optional): The Instagram media ID
  • media_code (string, optional): The Instagram media code (shortcode). Cannot be a URL, only media code.

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_media_data_v2.php"

querystring = {"media_id":"3545109021754478328","media_code":"DJmAsFEPfNV"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

2. Get Post Likers

Retrieves the list of users who liked a specific post.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_post_likers.php

Parameters:

  • post_id (string, required): The Instagram post ID

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_post_likers.php"

querystring = {"post_id":"3543767247128255957"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

3. Get Post Title/Description

Retrieves the title and description of a post or reel.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_reel_title.php

Parameters:

  • reel_post_code_or_url (string, required): The Instagram post/reel shortcode or URL
  • type (string, required): Content type - must be either "post" or "reel"

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_reel_title.php"

querystring = {"reel_post_code_or_url":"https://www.instagram.com/p/C-OxwofssZR/","type":"post"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

4. Get Detailed Post Data

Retrieves detailed post data for a specific Instagram post.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_media_data.php

Parameters:

  • reel_post_code_or_url (string, required): The Instagram post URL or shortcode
  • type (string, required): Content type - fixed value "post" for this endpoint

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_media_data.php"

querystring = {"reel_post_code_or_url":"https://www.instagram.com/p/DE4ti3iPGuN/","type":"post"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

5. Get Reel Title/Description

Retrieves the title and description of a reel.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_reel_title.php

Parameters:

  • reel_post_code_or_url (string, required): The Instagram reel URL or shortcode
  • type (string, required): Content type - must be "reel" for this endpoint

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_reel_title.php"

querystring = {"reel_post_code_or_url":"https://www.instagram.com/reel/C-LP5xCu2OS/","type":"reel"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

6. Get Post Comments

Retrieves comments for a specific Instagram post.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_post_comments.php

Parameters:

  • post_id (string, optional): The Instagram post ID
  • media_code (string, optional): The Instagram media code (shortcode). Post Code e.g. DJmAsFEPfNV
  • pagination_token (string, optional): Token for pagination. Use to get the next list of comments. Empty for first request.
  • sort_order (string, optional): Comments sort order. Can be either "recent" or "popular". Default: "popular"

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_post_comments.php"

querystring = {"post_id":"3419633191151435614","media_code":"DJmAsFEPfNV","sort_order":"popular"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

7. Get Post/Media Comment Replies

Retrieves replies to a specific comment on a post or media.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/get_post_child_comments.php

Parameters:

  • post_id (string, required): The Instagram post ID
  • comment_id (string, required): The comment ID to get replies for

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/get_post_child_comments.php"

querystring = {"post_id":"3504112695341919073","comment_id":"18083281552545129"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

8. Get Media Code or ID

Retrieves media code or ID based on the provided parameters.

Endpoint: GET https://instagram-scraper-stable-api.p.rapidapi.com/media_data_id.php

Parameters:

  • media_code (string, optional): The Instagram media code (shortcode)
  • media_id (string, optional): The Instagram media ID

Example Request:

import requests

url = "https://instagram-scraper-stable-api.p.rapidapi.com/media_data_id.php"

querystring = {"media_code":"DJaLtEkz5vO","media_id":"3628263925600984014"}

headers = {
    "x-rapidapi-key": os.environ.get('API_KEY'),
    "x-rapidapi-host": "instagram-scraper-stable-api.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())

Parameter Types

Common Parameters

  • media_id: String - Instagram media ID (numeric string)
  • media_code: String - Instagram media shortcode (alphanumeric string)
  • post_id: String - Instagram post ID (numeric string)
  • comment_id: String - Instagram comment ID (numeric string)
  • reel_post_code_or_url: String - Instagram post/reel URL or shortcode
  • type: String - Content type ("post" or "reel")
  • pagination_token: String - Token for pagination (optional, empty for first request)
  • sort_order: String - Sort order for comments ("recent" or "popular")

Error Handling

The API may return various HTTP status codes indicating the success or failure of a request:

  • 200: Success
  • 400: Bad Request - Check your parameters
  • 401: Unauthorized - Check your API key
  • 403: Forbidden - Check your API access permissions
  • 404: Not Found - Endpoint not found
  • 429: Too Many Requests - Rate limit exceeded
  • 500: Internal Server Error - Server-side issue

It's recommended to implement proper error handling in your code to manage these potential responses.

Rate Limiting

The API may have rate limiting in place. Consult the RapidAPI dashboard for information about your specific plan's rate limits and usage.

Additional Notes

  • All string parameters should be properly URL-encoded
  • Some endpoints may have additional parameters not documented here
  • Response formats will be JSON
  • Always use HTTPS for requests
  • When using media_code, provide only the shortcode, not the full URL
  • For pagination in comments, use the pagination_token from the previous response
  • The type parameter is crucial for distinguishing between posts and reels in title/description endpoints

Official Instagram Posts API documentation