Marketing API Version

Ad Tags

Ad Tag API will be deprecated in Marketing API v2.4. Please use Ad Label API instead.

Overview

Ad tags provide a mechanism to organize your campaigns, ad sets, and ads. By tagging them with an identifier, you can allow your users to filter their ads by a wide variety of attributes.

Name Description Type

id

The ID of the ad tag object

long

name

The name of the ad tag object

string

adgroups

List of ad groups associated with the ad tag

array

adcampaigns

List of ad sets associated with the ad tag

array

adcampaign_groups

List of ad campaigns associated with the ad tag

array

Create Ad Tags

To create an ad tag, make an HTTP POST request as below, which will return the id of the ad tag in case of success.

CURL \
-F "name=DR" \
-F "access_token=___" \
https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adtags

To get all the ad tags created for an ad account, make an HTTP GET request as below:

https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adtags

This is how the response looks like:

{
  "data": [
    {
      "id": "6013083882034", 
      "name": "DR"
    }
  ], 
  "paging": {
    "cursors": {
      "before": "NjAxMzA4Mzg4MjAzNA==", 
      "after": "NjAxMzA4Mzg4MjAzNA=="
    }
  }
}

Update Ad Tags

To update an ad tag attribute make following HTTP POST request, which will return true in case of success.

CURL \
-F "name=DR Ecomm" \
-F "access_token=___" \
https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>

To delete an ad tag make following HTTP DELETE request, which will return true in case of success.

https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>

Deleting ad ad tag will remove all the associates it has with ad campaings and ad sets. You will no longer be able to find them with this given tag.

Associate Ad Tags

Ad Campaigns

To associate an ad tag with list of ad campaigns, make an HTTP POST request as below, which will return true upon success.

CURL \
-F "campaign_groups=[6017676778651,6018146884251]" \
-F "access_token=___" \
https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adcampaign_groups

To remove an association between an ad tag and list of ad campaigns, make an HTTP DELETE request as below, which will return true upon success.

https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adcampaign_groups?campaign_groups=[<CAMPAIGN_ID_1>,..]

Ad Sets

To associate an ad tag with list of ad sets, make an HTTP POST request as below, which will return true upon success.

CURL \
-F "campaigns=[601814688765,601814688764]" \
-F "access_token=___" \
https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adcampaigns

To remove an association between an ad tag and list of ad sets, make an HTTP DELETE request as below, which will return true upon success.

https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adcampaigns?campaigns=[<adset_id1>,..]

Ad

To associate an ad tag with list of ads, make an HTTP POST request as below, which will return true upon success.

CURL \
-F "adgroups=[6018146887112,6011234688764]" \
-F "access_token=___" \
https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adgroups

To remove an association between an ad tag and list of ad groups, make an HTTP DELETE request as below, which will return true upon success.

https://graph.facebook.com/<API_VERSION>/<AD_TAG_IDS>/adgroups?adgroups=[<AD_ID_1>,..]

You can associate multiple ad tags with one ad campaign, one ad set, or one ad group. And see all the ad campaigns, ad sets, and ad groups associated with one ad tag at a time.


Retrieving all the ad tags associated with a given ad object is not supported.

Read Ad Tags

To see the list of ad campaigns associated with an ad tag, make an HTTP GET request as below:

https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adcampaign_groups

The response would look something likes this:

{
  "data": [
    {
      "id": "6018146884251"
    }, 
    {
      "id": "6017676778651"
    }
  ], 
  "paging": {
    "cursors": {
      "before": "NjAxODE0Njg4NDI1NQ==", 
      "after": "NjAxNzY3Njc3ODY1NQ=="
    }
  }
}

To see the list of ad sets associated with an ad tag, make an HTTP GET request as below:

https://graph.facebook.com/<API_VERSION>/<AD_TAG_ID>/adcampaigns

The response would look something likes this:

{
  "data": [
      {
        "id": "601814688765"
      }
      {
        "id": "601814688764"
      }
  ], 
  "paging": {
    "cursors": {
      "before": "NjAxODE0Njg4NDI1NQ==", 
      "after": "NjAxNzY3Njc3ODY1NQ=="
    }
  }
}

Too see the list of all the ad campaigns and ad sets associated with an ad tag, make an HTTP GET request as below:

https://graph.facebook.com/<API_VERSION>/<AD_TAG_IDS>?fields=adcampaign_groups,adcampaigns

The response would look something likes this:

{
  "adcampaign_groups": {
    "data": [
      {
        "id": "6018146887451"
      }, 
      {
        "id": "6018146884251"
      }, 
      {
        "id": "6017676778651"
      }
    ], 
    "paging": {
      "cursors": {
        "before": "NjAxODE0Njg4NzQ1NQ==", 
        "after": "NjAxNzY3Njc3ODY1NQ=="
      }
    }
  }, 
  "adcampaigns": {
    "data": [
      {
        "id": "601814688765"
      }
      {
        "id": "601814688764"
      }
    ], 
    "paging": {
      "cursors": {
        "before": "NjAxODE0Njg4NzY1NQ==", 
        "after": "NjAxODE0Njg4NzY1NQ=="
      }
    }
  }, 
  "id": "6018257678655"
}