If you manage ad accounts outside of a Business Manager with the "Admin" role, you can claim them for your business. This is a one-time procedure. Once claimed, you can only manage the ad accounts in that Business Manager.
cURL NodeJS - Axios PHP - cURL
Copy curl --location --request GET 'https://us-central1-appgregator.cloudfunctions.net/facebook/adaccounts/claim-accounts?name=ft-4&connection_name=fbads-01&business_id=404745734937629&adaccount_id=404745734937629' \
--header 'x-api-key: U2Fsd...'
Copy var axios = require('axios');
var config = {
method: 'get',
url: 'https://us-central1-appgregator.cloudfunctions.net/facebook/adaccounts/claim-accounts?name=ft-4&connection_name=fbads-01&business_id=404745734937629&adaccount_id=404745734937629',
headers: {
'x-api-key': 'U2Fsd...'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Copy <?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/facebook/adaccounts/claim-accounts?name=ft-4&connection_name=fbads-01&business_id=404745734937629&adaccount_id=404745734937629',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-api-key: U2Fsd...'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;