Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
    • Graph API
    • FQL
    • Open Graph
    • Dialogs
    • Chat
    • Internationalization
    • Ads
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
  • PHP
  • More SDKs
  • Best Practices
    • Batch Requests
    • Using ETags
  • Reference
    • Cost Per Action (CPA) Ads
    • Currencies
    • Introduction to Action Spec
    • Introduction to Sponsored Stories
    • Mobile App Install Ads
    • Optimized CPM
    • Real Time Bidded Exchange protocol
    • Sponsored Results
    • Thrift file for Real Time Bidded Exchange protocol
  • Specs
    • Conversion Specs
    • Creative Specs
    • Defining Action Specs
    • Targeting Specs
    • Tracking Specs
  • Advanced Targeting
    • Action Spec Targeting
    • Conversion pixels
    • Custom Audience targeting
    • Topic Targeting
    • ZIP Code Targeting
  • Queries
    • Action Estimate
    • Action Spec Ad Previews
    • Ad Statistics
    • Autocomplete Data
    • Broad Target Categories
    • Connection Objects
    • Conversion Stats
    • Keyword Stats
    • Partner Categories
    • Reach estimate
    • Targeting Description
  • Objects
    • Ad account
    • Ad account group
    • Ad campaign
    • Ad creative
    • Ad group
    • Ad image
    • Ad user

Ad account group

Facebook APIs › Ads › Ad account group

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:

  • user

To read an adaccountgroup you need the following permissions: ads_management and, for use anytime, offline_access.

Example

Retrieve the information for an account group:

https://graph.facebook.com/AccountGroupID?access_token=___

Fields

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

Connections

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

Using adaccountgroup objects

Retrieving an ad account group

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 } ]
}

Creating an ad account group

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}

Updating and deleting an ad account group

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

Deleting an ad account group

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

Retrieving users of an ad account group

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 }
   ],
}

Modifying users in an ad account group

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

Account group roles

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:

  • Level 1001, administrator access
  • Level 1002, general-user access
  • Level 1003, reports-only access

Removing users from an ad account group

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

Retrieving ad accounts from an ad account group

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 }
   ],
}

Modifying ad accounts in an ad account group

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

Removing ad accounts from an ad account group

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
Updated over a year ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy