Search Instagram posts and reels
curl --request POST \
--url https://api.stophy.dev/v1/instagram/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "street food",
"limit": 5
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'street food', limit: 5})
};
fetch('https://api.stophy.dev/v1/instagram/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/instagram/search"
payload = {
"query": "street food",
"limit": 5
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"posts": [
{
"url": "<string>",
"type": "photo",
"isPinned": true,
"isPaidPartnership": true,
"id": "<string>",
"code": "<string>",
"text": "<string>",
"hashtags": [
"<string>"
],
"mentions": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"likes": 0,
"comments": 0,
"views": 0,
"width": 0,
"height": 0,
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"videos": [
{
"url": "<string>"
}
],
"imageDescription": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"taggedUsers": [
"<string>"
],
"coauthors": [
"<string>"
],
"audio": {
"isOriginal": true,
"title": "<string>",
"artist": "<string>"
},
"sponsors": [
"<string>"
]
}
]
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}Instagram
Instagram search API
Call the Instagram search API to get code, text, hashtags, mentions, created at and likes, as JSON or markdown. 3 credits per 10 items, at least 3 credits.
POST
/
v1
/
instagram
/
search
Search Instagram posts and reels
curl --request POST \
--url https://api.stophy.dev/v1/instagram/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "street food",
"limit": 5
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'street food', limit: 5})
};
fetch('https://api.stophy.dev/v1/instagram/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/instagram/search"
payload = {
"query": "street food",
"limit": 5
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"posts": [
{
"url": "<string>",
"type": "photo",
"isPinned": true,
"isPaidPartnership": true,
"id": "<string>",
"code": "<string>",
"text": "<string>",
"hashtags": [
"<string>"
],
"mentions": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"likes": 0,
"comments": 0,
"views": 0,
"width": 0,
"height": 0,
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"videos": [
{
"url": "<string>"
}
],
"imageDescription": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"taggedUsers": [
"<string>"
],
"coauthors": [
"<string>"
],
"audio": {
"isOriginal": true,
"title": "<string>",
"artist": "<string>"
},
"sponsors": [
"<string>"
]
}
]
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}- Endpoint:
instagram.search - Returns:
datahasposts. - Cost: 3 credits per 10 items, at least 3 credits. Failed calls cost nothing.
- Paging: No.
Example
import { Stophy } from "stophy";
const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
const result = await stophy.instagram.search({ query: "street food", limit: 5 });
console.log(result.data.posts);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.instagram.search(query="street food", limit=5)
print(result["data"]["posts"])
curl -X POST https://api.stophy.dev/v1/instagram/search \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"query":"street food","limit":5}'
stophy instagram search "street food" --limit 5
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json