Get Ad Account Media
curl --request POST \
--url https://public.plai.io/meta/get_ad_account_media \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"userId": "<string>",
"type": "<string>",
"pagination": "<string>"
}
'import requests
url = "https://public.plai.io/meta/get_ad_account_media"
payload = {
"userId": "<string>",
"type": "<string>",
"pagination": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: '<string>', type: '<string>', pagination: '<string>'})
};
fetch('https://public.plai.io/meta/get_ad_account_media', 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://public.plai.io/meta/get_ad_account_media",
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([
'userId' => '<string>',
'type' => '<string>',
'pagination' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://public.plai.io/meta/get_ad_account_media"
payload := strings.NewReader("{\n \"userId\": \"<string>\",\n \"type\": \"<string>\",\n \"pagination\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://public.plai.io/meta/get_ad_account_media")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"<string>\",\n \"type\": \"<string>\",\n \"pagination\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.plai.io/meta/get_ad_account_media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"<string>\",\n \"type\": \"<string>\",\n \"pagination\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success":true,
"results":{
"success":true,
"media":[
{
"url":"https://scontent-ord5-2.xx.fbcdn.net/v/t45.1600-4/458397097_120212188508890153_5643706261073051043_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=890911&_nc_eui2=AeEb31a9FMRMAR99chReYCjZNy7E6NJ-DsU3LsTo0n4Oxa-6orXAzPLD3SUNeacQy6gdHVFFw3UMBKjcIZ7h6VEW&_nc_ohc=Vgv_WkUc4y4Q7kNvgGHEwR8&_nc_oc=AdmVeH5LXBRNcMi7xjpQPNh8t7j9lMC6c3iWMNQ5Up77fDG4QFcziAJGv9FztzMyv8cSbVifb_himrkLK5cXB2IZ&_nc_zt=1&_nc_ht=scontent-ord5-2.xx&edm=AJcBmwoEAAAA&_nc_gid=jb2uOjyDnEnPtP44f-xPUg&oh=00_AYENmPdDcrUWqDw0xdryQXMKv2RmTaPfjpgOYXD_M6B1nA&oe=67E70714",
"width":1080,
"height":1920,
"id":"3184782144999967:2ec2d87ca494ba28f676b385df9c98ca"
}
]
}
}
{
"success":true,
"results":{
"success":true,
"media":[
{
"id":"2074273929752253",
"format":[
{
"embed_html":"<iframe allow=\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\" allowfullscreen=\"true\" frameborder=\"0\" height=\"130\" scrolling=\"no\" src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F120206061579950153%2Fvideos%2F2074273929752253%2F%3Fidorvanity%3D120206061579950153&width=130\" style=\"border:none;overflow:hidden\" width=\"130\"></iframe>",
"filter":"130x130",
"height":130,
"picture":"https://scontent-ord5-2.xx.fbcdn.net/v/t15.13418-10/485495564_1004185174993501_5346987072051659935_n.jpg?stp=dst-jpg_s130x130_tt6&_nc_cat=110&ccb=1-7&_nc_sid=ace027&_nc_eui2=AeGDGk3WT3pgnbEOgYPA0qA9j0cq8_MbHGiPRyrz8xscaORB8i69mT8NjgkZsAV-1UHj81dKp8wq4f6KlO892n68&_nc_ohc=2plK7cMH8cMQ7kNvgEzzPWI&_nc_oc=AdmKLzGx1IckidCC3X0zKeKgWln8v-ypqcG7D-WCNexMZWnaIkaCay1n7_G3OAWv448D9pNaEQAgemarTjeVdQck&_nc_zt=23&_nc_ht=scontent-ord5-2.xx&edm=AM_bLsMEAAAA&_nc_gid=OXJsWsYoQ8IpbhdQuDtnFA&oh=00_AYF6Q3bszBdOiBRLnZ9Zjod5opyC0XzMA08z6HhQ6koATg&oe=67E6E01D",
"width":130
}
]
}
]
}
}
Media
Get Ad Account Media
This endpoint is used to fetch media assets (both images and videos) associated with a user’s Facebook Ad Account. It provides access to the creative library that can be used in ad campaigns, allowing users to browse and select previously uploaded media for their advertisements.
POST
/
meta
/
get_ad_account_media
Get Ad Account Media
curl --request POST \
--url https://public.plai.io/meta/get_ad_account_media \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"userId": "<string>",
"type": "<string>",
"pagination": "<string>"
}
'import requests
url = "https://public.plai.io/meta/get_ad_account_media"
payload = {
"userId": "<string>",
"type": "<string>",
"pagination": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: '<string>', type: '<string>', pagination: '<string>'})
};
fetch('https://public.plai.io/meta/get_ad_account_media', 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://public.plai.io/meta/get_ad_account_media",
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([
'userId' => '<string>',
'type' => '<string>',
'pagination' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://public.plai.io/meta/get_ad_account_media"
payload := strings.NewReader("{\n \"userId\": \"<string>\",\n \"type\": \"<string>\",\n \"pagination\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://public.plai.io/meta/get_ad_account_media")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"<string>\",\n \"type\": \"<string>\",\n \"pagination\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.plai.io/meta/get_ad_account_media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"<string>\",\n \"type\": \"<string>\",\n \"pagination\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success":true,
"results":{
"success":true,
"media":[
{
"url":"https://scontent-ord5-2.xx.fbcdn.net/v/t45.1600-4/458397097_120212188508890153_5643706261073051043_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=890911&_nc_eui2=AeEb31a9FMRMAR99chReYCjZNy7E6NJ-DsU3LsTo0n4Oxa-6orXAzPLD3SUNeacQy6gdHVFFw3UMBKjcIZ7h6VEW&_nc_ohc=Vgv_WkUc4y4Q7kNvgGHEwR8&_nc_oc=AdmVeH5LXBRNcMi7xjpQPNh8t7j9lMC6c3iWMNQ5Up77fDG4QFcziAJGv9FztzMyv8cSbVifb_himrkLK5cXB2IZ&_nc_zt=1&_nc_ht=scontent-ord5-2.xx&edm=AJcBmwoEAAAA&_nc_gid=jb2uOjyDnEnPtP44f-xPUg&oh=00_AYENmPdDcrUWqDw0xdryQXMKv2RmTaPfjpgOYXD_M6B1nA&oe=67E70714",
"width":1080,
"height":1920,
"id":"3184782144999967:2ec2d87ca494ba28f676b385df9c98ca"
}
]
}
}
{
"success":true,
"results":{
"success":true,
"media":[
{
"id":"2074273929752253",
"format":[
{
"embed_html":"<iframe allow=\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\" allowfullscreen=\"true\" frameborder=\"0\" height=\"130\" scrolling=\"no\" src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F120206061579950153%2Fvideos%2F2074273929752253%2F%3Fidorvanity%3D120206061579950153&width=130\" style=\"border:none;overflow:hidden\" width=\"130\"></iframe>",
"filter":"130x130",
"height":130,
"picture":"https://scontent-ord5-2.xx.fbcdn.net/v/t15.13418-10/485495564_1004185174993501_5346987072051659935_n.jpg?stp=dst-jpg_s130x130_tt6&_nc_cat=110&ccb=1-7&_nc_sid=ace027&_nc_eui2=AeGDGk3WT3pgnbEOgYPA0qA9j0cq8_MbHGiPRyrz8xscaORB8i69mT8NjgkZsAV-1UHj81dKp8wq4f6KlO892n68&_nc_ohc=2plK7cMH8cMQ7kNvgEzzPWI&_nc_oc=AdmKLzGx1IckidCC3X0zKeKgWln8v-ypqcG7D-WCNexMZWnaIkaCay1n7_G3OAWv448D9pNaEQAgemarTjeVdQck&_nc_zt=23&_nc_ht=scontent-ord5-2.xx&edm=AM_bLsMEAAAA&_nc_gid=OXJsWsYoQ8IpbhdQuDtnFA&oh=00_AYF6Q3bszBdOiBRLnZ9Zjod5opyC0XzMA08z6HhQ6koATg&oe=67E6E01D",
"width":130
}
]
}
]
}
}
Request Body
string
required
User ID, If not already created, make a user on create user
page first. If already created,
retrieve the user ID from get profile
page.
string
required
Media Type, Values:
IMAGE or VIDEOstring
default:""
If the number of results exceeds the page limit, the response will include
pagination links (
next and previous) to help you navigate through the
result setResponse
- Images Response
- Videos Response
boolean
Indicates that the HTTP response was successful (status code 200 OK).
object
Show Results Object
Show Results Object
boolean
Indicates whether the API request was successful
object
Show Results Object
Show Results Object
boolean
Indicates whether the specific operation or API action was successful.
object[]
string
Error string if something went wrong
{
"success":true,
"results":{
"success":true,
"media":[
{
"url":"https://scontent-ord5-2.xx.fbcdn.net/v/t45.1600-4/458397097_120212188508890153_5643706261073051043_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=890911&_nc_eui2=AeEb31a9FMRMAR99chReYCjZNy7E6NJ-DsU3LsTo0n4Oxa-6orXAzPLD3SUNeacQy6gdHVFFw3UMBKjcIZ7h6VEW&_nc_ohc=Vgv_WkUc4y4Q7kNvgGHEwR8&_nc_oc=AdmVeH5LXBRNcMi7xjpQPNh8t7j9lMC6c3iWMNQ5Up77fDG4QFcziAJGv9FztzMyv8cSbVifb_himrkLK5cXB2IZ&_nc_zt=1&_nc_ht=scontent-ord5-2.xx&edm=AJcBmwoEAAAA&_nc_gid=jb2uOjyDnEnPtP44f-xPUg&oh=00_AYENmPdDcrUWqDw0xdryQXMKv2RmTaPfjpgOYXD_M6B1nA&oe=67E70714",
"width":1080,
"height":1920,
"id":"3184782144999967:2ec2d87ca494ba28f676b385df9c98ca"
}
]
}
}
{
"success":true,
"results":{
"success":true,
"media":[
{
"id":"2074273929752253",
"format":[
{
"embed_html":"<iframe allow=\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\" allowfullscreen=\"true\" frameborder=\"0\" height=\"130\" scrolling=\"no\" src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F120206061579950153%2Fvideos%2F2074273929752253%2F%3Fidorvanity%3D120206061579950153&width=130\" style=\"border:none;overflow:hidden\" width=\"130\"></iframe>",
"filter":"130x130",
"height":130,
"picture":"https://scontent-ord5-2.xx.fbcdn.net/v/t15.13418-10/485495564_1004185174993501_5346987072051659935_n.jpg?stp=dst-jpg_s130x130_tt6&_nc_cat=110&ccb=1-7&_nc_sid=ace027&_nc_eui2=AeGDGk3WT3pgnbEOgYPA0qA9j0cq8_MbHGiPRyrz8xscaORB8i69mT8NjgkZsAV-1UHj81dKp8wq4f6KlO892n68&_nc_ohc=2plK7cMH8cMQ7kNvgEzzPWI&_nc_oc=AdmKLzGx1IckidCC3X0zKeKgWln8v-ypqcG7D-WCNexMZWnaIkaCay1n7_G3OAWv448D9pNaEQAgemarTjeVdQck&_nc_zt=23&_nc_ht=scontent-ord5-2.xx&edm=AM_bLsMEAAAA&_nc_gid=OXJsWsYoQ8IpbhdQuDtnFA&oh=00_AYF6Q3bszBdOiBRLnZ9Zjod5opyC0XzMA08z6HhQ6koATg&oe=67E6E01D",
"width":130
}
]
}
]
}
}