Skip to main content
POST
/
api
/
facebook
/
advertisers
/
ads
/facebook/advertisers/ads
curl --request POST \
  --url https://api.anysite.io/api/facebook/advertisers/ads \
  --header 'Content-Type: application/json' \
  --header 'access-token: <api-key>' \
  --data '
{
  "advertiser": "<string>",
  "count": 2,
  "timeout": 300,
  "active_status": "all",
  "ad_type": "all",
  "media_type": "all"
}
'
import requests

url = "https://api.anysite.io/api/facebook/advertisers/ads"

payload = {
"advertiser": "<string>",
"count": 2,
"timeout": 300,
"active_status": "all",
"ad_type": "all",
"media_type": "all"
}
headers = {
"access-token": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
advertiser: '<string>',
count: 2,
timeout: 300,
active_status: 'all',
ad_type: 'all',
media_type: 'all'
})
};

fetch('https://api.anysite.io/api/facebook/advertisers/ads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anysite.io/api/facebook/advertisers/ads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'advertiser' => '<string>',
'count' => 2,
'timeout' => 300,
'active_status' => 'all',
'ad_type' => 'all',
'media_type' => 'all'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access-token: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.anysite.io/api/facebook/advertisers/ads"

payload := strings.NewReader("{\n \"advertiser\": \"<string>\",\n \"count\": 2,\n \"timeout\": 300,\n \"active_status\": \"all\",\n \"ad_type\": \"all\",\n \"media_type\": \"all\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.anysite.io/api/facebook/advertisers/ads")
.header("access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"advertiser\": \"<string>\",\n \"count\": 2,\n \"timeout\": 300,\n \"active_status\": \"all\",\n \"ad_type\": \"all\",\n \"media_type\": \"all\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.anysite.io/api/facebook/advertisers/ads")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"advertiser\": \"<string>\",\n \"count\": 2,\n \"timeout\": 300,\n \"active_status\": \"all\",\n \"ad_type\": \"all\",\n \"media_type\": \"all\"\n}"

response = http.request(request)
puts response.read_body
[
  {
    "id": "<string>",
    "url": "<string>",
    "@type": "FacebookAd",
    "is_active": false,
    "started_at": 123,
    "ended_at": 123,
    "platforms": [],
    "country": "<string>",
    "categories": [],
    "collation_count": 123,
    "advertiser": {
      "id": "<string>",
      "@type": "FacebookAdvertiser",
      "name": "<string>",
      "alias": "<string>",
      "image": "<string>",
      "categories": [],
      "like_count": 123,
      "byline": "<string>",
      "is_deleted": false
    },
    "creatives": [],
    "text": "<string>",
    "caption": "<string>",
    "cta_text": "<string>",
    "cta_type": "<string>",
    "link_url": "<string>",
    "link_description": "<string>",
    "display_format": "<string>",
    "is_reshared": false,
    "contains_sensitive_content": false,
    "total_active_time": 123,
    "branded_content": {},
    "additional_info": {},
    "currency": "<string>",
    "spend_range": "<string>",
    "reach_estimate": "<string>",
    "impressions_range": "<string>",
    "disclaimer_label": "<string>",
    "fev_info": {
      "@type": "FacebookAdFevInfo",
      "authorized_entity_text": "<string>",
      "submitted_on": "<string>",
      "phone": "<string>",
      "email": "<string>",
      "website": "<string>",
      "address": "<string>",
      "additional_info": {}
    }
  }
]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

access-token
string
header
required

API token from the dashboard

Headers

access-token
string
required

Body

application/json
advertiser
string
required
Minimum string length: 1
count
integer
required
Required range: x >= 1
timeout
integer
default:300
Required range: 20 <= x <= 1500
active_status
enum<string>
default:all
Available options:
active,
inactive,
all
ad_type
enum<string>
default:all
Available options:
all,
political_and_issue_ads
media_type
enum<string>
default:all
Available options:
all,
image,
video,
meme,
none

Response

Successful Response

id
string
required
url
string
required
@type
string
default:FacebookAd
is_active
boolean
default:false
started_at
integer | null
ended_at
integer | null
platforms
string[]
country
string | null
categories
string[]
collation_count
integer | null
advertiser
object | null
creatives
object[]
text
string | null
caption
string | null
cta_text
string | null
cta_type
string | null
display_format
string | null
is_reshared
boolean
default:false
contains_sensitive_content
boolean
default:false
total_active_time
integer | null
branded_content
object | null
additional_info
object | null
currency
string | null
spend_range
string | null
reach_estimate
string | null
impressions_range
string | null
disclaimer_label
string | null
fev_info
object | null