> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Interests

> Search Instagram ad targeting interests by keyword and get audience size estimates. Use returned interest IDs in the interests array to boost posts.

Search for available Instagram ad targeting interests by keyword.
Required for the [Boost Post](https://www.ayrshare.com/docs/apis/ads/instagram/boost-post.md) endpoint.

This endpoint helps you discover interest-based targeting options for your Instagram ads, along with audience size estimates.

<ul>
  <li>Interest IDs can be used in the `interests` array when boosting posts.</li>
  <li>Results are cached for 10 minutes.</li>
  <li>Use specific, relevant search terms for best results.</li>
  <li>Instagram may return different results based on your ad account's industry and region.</li>

  <li>
    The `audienceSizeLowerBound` and `audienceSizeUpperBound` fields in the JSON response provide an
    estimated range of audience size for the interest and it is useful for targeting.
  </li>
</ul>

## Header Parameters

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## Query Parameters

**search** `string` *required*

The search query to retrieve Instagram ad interests.

Don't forget to escape the search query, for example `Rhythm%20and%20blues%20music`.

**limit** `number` (default: 100)

Limit the number of ad interests returned.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music", {
      method: "GET",
      headers: {
        "Authorization": `Bearer ${API_KEY}`
      }
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

```python Python theme={"system"}
import requests

headers = {'Authorization': 'Bearer API_KEY'}

r = requests.get('https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music', headers=headers)

print(r.json())
```

```php PHP theme={"system"}
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer API_KEY"
  ],
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
?>
```

```csharp C# theme={"system"}
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");

        var response = await client.GetAsync("https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music");
        var content = await response.Content.ReadAsStringAsync();

        Console.WriteLine(content);
    }
}
```

```go Go theme={"system"}
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music", nil)
    req.Header.Add("Authorization", "Bearer API_KEY")

    resp, _ := client.Do(req)
    body, _ := ioutil.ReadAll(resp.Body)

    fmt.Println(string(body))
}
```

```java Java theme={"system"}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class GetAdInterests {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music"))
                .header("Authorization", "Bearer API_KEY")
                .GET()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

```ruby Ruby theme={"system"}
require 'net/http'
require 'json'

uri = URI('https://api.ayrshare.com/api/ads/instagram/interests?search=Rhythm%20and%20blues%20music')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer API_KEY'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
  http.request(req)
}

puts res.body
```

```json 200: Success theme={"system"}
{
    "status": "success",
    "interests": [
        {
            "id": "6003195554098",
            "name": "Rhythm and blues music",
            "topic": "News and entertainment",
            "audienceSizeLowerBound": 669180255,
            "audienceSizeUpperBound": 786955980
        },
        {
            "id": "6003470511564",
            "name": "Do it yourself (DIY)",
            "topic": "Hobbies and activities",
            "audienceSizeLowerBound": 418387661,
            "audienceSizeUpperBound": 492023890
        },
        {
            "id": "6002926036121",
            "name": "Italy",
            "topic": "Travel, places and events",
            "audienceSizeLowerBound": 279313350,
            "audienceSizeUpperBound": 328472500
        }
    ],
    "count": 3,
    "lastUpdated": "2025-03-27T01:01:38.547Z",
    "nextUpdate": "2025-03-27T01:12:38.547Z"
}
```

```json 400: Ad interests error theme={"system"}
{
  "action": "get ad interests",
  "status": "error",
  "code": 368,
  "message": "Error getting ad interests. Please try again or contact us if the issue persists."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.