Marketing API Version

Offsite Pixel Adaccounts

It's possible to add more ad accounts to the authorized list of accounts that are able to use a given pixel.

Reading

Accounts associated with the pixel

Examples

You can check which ad accounts are authorized to use a given pixel:

Example

Graph API Explorer
GET /v2.11/{offsite-pixel-id}/adaccounts HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{offsite-pixel-id}/adaccounts',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{offsite-pixel-id}/adaccounts",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{offsite-pixel-id}/adaccounts",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{offsite-pixel-id}/adaccounts"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Parameters

This endpoint doesn't have any parameters.

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A list of AdAccount nodes.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
275Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects.

Creating

Examples

curl \
-F "adaccounts=[<AD_ACCOUNT_ID_TO_ADD>]" \
-F "access_token=___" \
"https://graph.facebook.com/<API_VERSION>/<PIXEL_ID>/adaccounts"

Example

You can make a POST request to adaccounts edge from the following paths:
When posting to this edge, an AdAccount will be created.

Parameters

NameDescription
adaccounts
list<string>

List of ad account IDs to add

Required

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Validation Rules

ErrorDescription
100Invalid parameter

Updating

You can't perform this operation on this endpoint.

Deleting

Examples

To remove an account from the list of authorized accounts:

curl -XDELETE \
-F "adaccounts=[<another ad account id>]" \
-F "access_token=___" \
"https://graph.facebook.com/<API_VERSION>/<PIXEL_ID>/adaccounts"

Example

You can dissociate an OffsitePixel from an OffsitePixel by making a DELETE request to /{offsite_pixel_id}/adaccounts.

Parameters

NameDescription
adaccounts
list<string>

List of ad account IDs to remove from authorized accounts

Required

Return Type

Struct {
success: bool,
}

Validation Rules

ErrorDescription
100Invalid parameter