Search Instagram audio
curl --request GET \
--url https://api.ayrshare.com/api/media/instagram/audio/search \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/media/instagram/audio/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/media/instagram/audio/search"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/media/instagram/audio/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ayrshare.com/api/media/instagram/audio/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ayrshare.com/api/media/instagram/audio/search")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "success",
"query": "summer",
"audio": [
{
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
]
}
{
"status": "success",
"query": "asdfghjkl",
"audio": []
}
{
"status": "error",
"code": 514,
"action": "post",
"message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
"platform": "instagram"
}
Media
Search Instagram audio
Search Instagram’s licensed audio catalog for a track to attach to a Reel
GET
/
media
/
instagram
/
audio
/
search
Search Instagram audio
curl --request GET \
--url https://api.ayrshare.com/api/media/instagram/audio/search \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ayrshare.com/api/media/instagram/audio/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.ayrshare.com/api/media/instagram/audio/search"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/media/instagram/audio/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ayrshare.com/api/media/instagram/audio/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ayrshare.com/api/media/instagram/audio/search")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "success",
"query": "summer",
"audio": [
{
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
]
}
{
"status": "success",
"query": "asdfghjkl",
"audio": []
}
{
"status": "error",
"code": 514,
"action": "post",
"message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
"platform": "instagram"
}
Search Instagram’s audio catalog by keyword. Use the returned
Codes 514 to 518 are described in Instagram Reels audio errors; the rest are in the Ayrshare error reference.
audioId with instagramOptions.audioConfiguration to attach the track when you publish a Reel.
Header Parameters
Query Parameters
string
required
Keyword to search for, such as an artist or track name. An empty or whitespace-only value returns
code: 101.string
default:"music"
Which catalog to search. Either
music for licensed commercial tracks or original_sound for
audio taken from other creators’ Reels. Any other value returns code: 101.integer
Maximum number of tracks to return, from
1 to 100. Non-integer or out-of-range values return
code: 101. When omitted, Instagram’s own default applies.Response Fields
Instagram does not return every field for every track, so treat all track fields exceptaudioId as optional.
string
success when the search completed. An empty catalog match is still a success.string
The keyword that was searched, echoed back.
array
Matching tracks. An empty array means the search ran and matched nothing.
Show Track fields
Show Track fields
string
The id to pass as
audioConfiguration.audioId when publishing a Reel.string
Track title.
string
Artist name as Instagram displays it.
integer
Track length in milliseconds.
string
Cover artwork thumbnail URL.
string
Either
music or original_sound.boolean
Whether the track may be used in an ad. Licensed music is frequently unavailable for ads even
when it is available for an organic Reel.
{
"status": "success",
"query": "summer",
"audio": [
{
"audioId": "17901234567890123",
"title": "Summer Nights",
"displayArtist": "The Example Band",
"durationMs": 32000,
"thumbnailUrl": "https://scontent.example.com/cover.jpg",
"audioType": "music",
"isAdsEligible": true
}
]
}
{
"status": "success",
"query": "asdfghjkl",
"audio": []
}
{
"status": "error",
"code": 514,
"action": "post",
"message": "Adding music to a Reel requires an Instagram account connected via Facebook Login. This profile is connected with Instagram Login, which Meta does not permit for music attach, search, or lookup. Please relink Instagram using Facebook Login and grant the instagram_content_publish permission, then try again.",
"platform": "instagram"
}
Errors
| Code | Meaning |
|---|---|
| 101 | Missing or empty query, an unrecognized audioType, or a limit outside 1 to 100. |
| 156 | Instagram is not linked to this profile. |
| 161 | Instagram’s authorization expired or was revoked. Relink the account. |
| 239 | Instagram rejected the request for an account-level reason, including an unavailable track. On search this reports 239 rather than the 517 the lookup endpoint returns. |
| 258 | Instagram returned a malformed response or an unmapped failure. |
| 425 | The connection is missing a required Instagram permission. Relink and grant all permissions. |
| 435 | Instagram’s rate limit was reached. Wait before retrying. |
| 514 | Instagram is linked with Instagram Login. The Audio API requires Facebook Login. |