curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/facebook/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);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music', headers=headers)
print(r.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
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/facebook/interests?search=Rhythm%20and%20blues%20music");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/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))
}
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/facebook/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());
}
}
require 'net/http'
require 'json'
uri = URI('https://api.ayrshare.com/api/ads/facebook/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
{
"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"
}
{
"status": "success",
"interests": [
{
"id": "6003269553527",
"name": "Nursing",
"audienceSizeLowerBound": 91340120,
"audienceSizeUpperBound": 107420310
},
{
"id": "6003204427551",
"name": "Health care",
"audienceSizeLowerBound": 412880440,
"audienceSizeUpperBound": 485610770
}
],
"count": 2,
"specialAdCategories": ["EMPLOYMENT"],
"lastUpdated": "2026-09-11T01:01:38.547Z",
"nextUpdate": "2026-09-11T01:12:38.547Z"
}
{
"action": "get ad interests",
"status": "error",
"code": 368,
"message": "Error getting ad interests. Please try again or contact us if the issue persists."
}
Facebook Ads
兴趣
获取 Facebook 广告兴趣
GET
/
ads
/
facebook
/
interests
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/facebook/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);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music', headers=headers)
print(r.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
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/facebook/interests?search=Rhythm%20and%20blues%20music");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/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))
}
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/facebook/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());
}
}
require 'net/http'
require 'json'
uri = URI('https://api.ayrshare.com/api/ads/facebook/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
{
"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"
}
{
"status": "success",
"interests": [
{
"id": "6003269553527",
"name": "Nursing",
"audienceSizeLowerBound": 91340120,
"audienceSizeUpperBound": 107420310
},
{
"id": "6003204427551",
"name": "Health care",
"audienceSizeLowerBound": 412880440,
"audienceSizeUpperBound": 485610770
}
],
"count": 2,
"specialAdCategories": ["EMPLOYMENT"],
"lastUpdated": "2026-09-11T01:01:38.547Z",
"nextUpdate": "2026-09-11T01:12:38.547Z"
}
{
"action": "get ad interests",
"status": "error",
"code": 368,
"message": "Error getting ad interests. Please try again or contact us if the issue persists."
}
按关键字搜索可用的 Facebook 广告定位兴趣。
使用此端点为 Boost Post 端点查找兴趣 ID。
此端点可帮助您发现 Facebook 广告的基于兴趣的定位选项,并附带受众规模的估算。
- 推广帖子时,兴趣 ID 可用于
interests数组中。 - 结果缓存 10 分钟。
- 为获得最佳结果,请使用具体且相关的搜索关键词。
- Facebook 可能会根据您广告账户所在的行业与地区返回不同的结果。
- JSON 响应中的
audienceSizeLowerBound和audienceSizeUpperBound字段提供了 该兴趣的受众规模估算范围,可用于定位参考。 - 使用
specialAdCategories可以只返回 Meta 允许 特殊广告类别 活动使用的兴趣。带过滤的请求还需要提供accountId。
请求头参数
查询参数
string
必填
用于获取 Facebook 广告兴趣的搜索查询。请务必对搜索查询进行转义,例如
Rhythm%20and%20blues%20music。array
将结果限制为 Meta 允许 特殊广告类别 活动定位的兴趣。在推广住房、就业、金融或政治类帖子之前使用它,以便选出广告实际能够获得批准的兴趣 ID。支持以下取值,与 Boost Post 中的同名参数一致:
housingemploymentfinancial_product_services——financial_products_services和credit会作为 等价写法被接受,并解析为同一类别issues_elections_politicsnone—— 为与 Boost Post 保持对称而接受,在那里它表示”不属于任何特殊广告类别”。它会以regulated_categories=["NONE"]的形式发送给 Meta:此时accountId为必填,成功的响应会回显["NONE"]。这并不保证与不带过滤的搜索结果相同;Meta 拒绝时会返回code: 368。如果您想要普通的不带过滤的搜索,请完全省略specialAdCategories,而不要发送none。
400 及 code: 101,并列出可接受的取值。该信息采用 Meta 的大写形式书写,并且也会列出上文提到的替代拼写,因此其内容为 NONE, HOUSING, FINANCIAL_PRODUCTS_SERVICES, EMPLOYMENT, ISSUES_ELECTIONS_POLITICS, FINANCIAL_PRODUCT_SERVICES, CREDIT——与此处列出的类别相同,并非额外的类别。Boost Post 会返回完全相同的信息。空值(如 ?specialAdCategories=)会以同样的方式被拒绝。要传递多个类别,请重复该参数,例如 ?search=nursing&specialAdCategories=employment&specialAdCategories=housing。带方括号的形式 ?specialAdCategories[]=employment&specialAdCategories[]=housing 同样有效。逗号分隔的字符串(如 ?specialAdCategories=employment,housing)不受支持,会被拒绝并返回 400 及 code: 101。所有请求的类别会在一次搜索中一并发送给 Meta。Ayrshare 返回的是 Meta 的结果,不会计算或保证各自独立符合条件的兴趣之间的交集。重复某个类别,或发送同一类别的两种拼写,都会合并为单个类别。当您提供多个类别时,响应中回显的 specialAdCategories 字段会按字母顺序排序,而不是按您发送的顺序返回。完全省略 specialAdCategories 时,此端点的行为与以前完全相同:不带过滤的搜索、无需 accountId,响应结构也保持不变。string
当提供了
specialAdCategories 时必填,否则会被忽略。要在其上搜索兴趣的 Facebook
广告账户 ID,不带 act_ 前缀——与 Boost Post
使用的值相同。可从 广告账户端点 获取。
它必须为数字;开头的 act_ 会被接受并去除,其他任何形式都会被拒绝并返回
400 及 code: 101。Meta 只在广告账户上提供按类别过滤的兴趣搜索,因此提供了
specialAdCategories 但未提供
accountId 的请求会在执行任何搜索之前被拒绝,返回 400 及 code: 101。不带
specialAdCategories 的请求保持不变,仍然无需 accountId。number
默认值:100
限制返回的广告兴趣数量。
带过滤的响应会在
specialAdCategories 字段中回显所应用的类别,方便您确认结果是依据
哪些类别收窄的。不带过滤的响应会完全省略该字段,而不是返回空字段。带过滤的结果还会
省略每个兴趣上的 topic 字段,因为 Meta 的按类别搜索不会返回它——请改为读取 name。
没有符合条件的兴趣的搜索会返回 200、空的 interests 数组和 count: 0,而不是错误;
带过滤的搜索绝不会回退为不带过滤的结果。curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/facebook/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);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music', headers=headers)
print(r.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
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/facebook/interests?search=Rhythm%20and%20blues%20music");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/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))
}
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/facebook/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());
}
}
require 'net/http'
require 'json'
uri = URI('https://api.ayrshare.com/api/ads/facebook/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
{
"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"
}
{
"status": "success",
"interests": [
{
"id": "6003269553527",
"name": "Nursing",
"audienceSizeLowerBound": 91340120,
"audienceSizeUpperBound": 107420310
},
{
"id": "6003204427551",
"name": "Health care",
"audienceSizeLowerBound": 412880440,
"audienceSizeUpperBound": 485610770
}
],
"count": 2,
"specialAdCategories": ["EMPLOYMENT"],
"lastUpdated": "2026-09-11T01:01:38.547Z",
"nextUpdate": "2026-09-11T01:12:38.547Z"
}
{
"action": "get ad interests",
"status": "error",
"code": 368,
"message": "Error getting ad interests. Please try again or contact us if the issue persists."
}