A group for managing access to Facebook ad accounts, as represented in the Graph API.
Before using this object, see Ads on the Graph API.
See below for information about how to use this object.
The adaccountgroup object replaces legacy calls involving account groups.
The adaccountgroup object is a connection of the following objects:
To read an adaccountgroup you need the following permissions: ads_management and, for use anytime, offline_access.
Retrieve the information for an account group:
https://graph.facebook.com/AccountGroupID?access_token=___
| Name | Description | Permissions | Returns |
|---|---|---|---|
id |
The account group ID, required for updating an account group | ads_management |
long |
name |
Name for the account group, and required when creating an account group; need not be unique; can be changed | ads_management |
string |
status |
Determines whether the account has a status of active (1) or deleted (2) | ads_management |
int |
users |
Users and roles in an account group | ads_management |
array |
accounts |
The accounts in an account group in which the users have access | ads_management |
array |
The adaccountgroup object has the following connections.
| Name | Description | Permissions | Returns |
|---|---|---|---|
| adaccounts | The Ad Accounts in the ad account group | ads_management |
array of adaccount objects |
| user | The user who owns the ad account group. | ads_management |
array of user objects |
Specify an ad account group ID, or /me/adaccountgroups, to retrieve the basic data for ad account groups.
Thus, a basic example for getting account group data is the following, if the ad account group ID is 368121234:
https://graph.facebook.com/368121234?access_token=_____
The result could be similar to the following:
{
"id" : "368121234",
"name" : "Awesome ad account group",
"status" : "1",
"users" : [ { "uid" : 9876554, "role" : 1001 } ],
"accounts" : [ { "account_id" : 333444555, "status" : 2 } ]
}
To create an ad account group, specify the data for the ad account group in a request to the following URL:
https://graph.facebook.com/me/adaccountgroups
For example, if you specify a request similar to the following
curl -F "name=Test ad account group"
"https://graph.facebook.com/me/adaccountgroups?access_token=___"
The result could be similar to the following:
{"id":88736453}
To update an ad account group, specify the data for the ad account group in a request to the following URL:
https://graph.facebook.com/AdAccountGroupID
You could specify an update to an ad account group's name by specifying a request similar to the following:
curl -F "name=Even better name!"
"https://graph.facebook.com/986237642?access_token=___"
The result could be similar to the following:
true
To delete an ad account group, use the HTTP DELETE method to delete an object, for example:
curl -XDELETE "https://graph.facebook.com/635356536?access_token=___"
The result could be similar to the following:
true
To retrieve the list of users in an ad account group, issue a get to the endpoint
https://graph.facebook.com/AdAccountGroupId/users
The result could be similar to the following:
{
"users" : [
{ "uid" : 98277244, "role" : 1001 },
{ "uid" : 38738963, "role" : 1001 }
],
}
To add a user to an ad account group, specify the data for the user in a request to the following URL:
https://graph.facebook.com/AdAccountGroupID/users
You could specify an update to an ad account group's users by specifying a request similar to the following:
curl -d "account_group_roles=[{'uid' : 24243234, 'role' : 1001 }]"
"https://graph.facebook.com/986237642/users?access_token=___"
The result could be similar to the following:
true
After you create an account group, you use related calls to update the account group and give users the desired access to the ad accounts in the account group.
Account groups enable you to give a user a specific level of access to an entire set of accounts.
If a user is a member of an account group, they have the given level of access to all the accounts contained in the account group. A user is given the highest level of permission she has for any account in the group. For example, if Mary has reports-only access to Account ABC, but general-user access to an account group that contains Account ABC, Mary has the higher of the two permission levels. In this example, Mary's permission for all accounts in the account group will be general-user.
The levels of permission, also known as roles, are the following:
To delete a user from an ad account group, use the HTTP DELETE method to delete an object, for example:
curl -XDELETE
"https://graph.facebook.com/635356536/users/12323434?access_token=___"
The result could be similar to the following:
true
To retrieve the list of accounts in an ad account group, issue a get to the endpoint
https://graph.facebook.com/AdAccountGroupId/adaccounts
The result could be similar to the following:
{
"accounts" : [
{ "account_id" : 98277244, "status" : 2 },
{ "account_id" : 38738963, "status" : 2 }
],
}
To add an ad account to an ad account group, specify the data for the ad account in a request to the following URL:
https://graph.facebook.com/AdAccountGroupID/adaccounts
The calling user must own the existing account group and have admin access to the ads account intended to be added. You could specify an update to an ad account group's ad accounts by specifying a request similar to the following:
curl -d "account_ids=[ 123212214 ]"
"https://graph.facebook.com/986237642/adaccounts?access_token=___"
The result could be similar to the following:
true
To delete an ad account from an ad account group, use the HTTP DELETE method to delete an object, for example:
curl -XDELETE
"https://graph.facebook.com/635356536/adaccounts/12323434?access_token=___"
The result could be similar to the following:
true