Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to get image URL from the image hash ID of a Facebook Ad

Is there any way to use the Facebook API (or other method) to get the image URL for my ad images? I have a list of image hashes, but how can I get their URLs?

Alternatively, is there another way to get the URL of my ad images without relying on the hash? I am trying to download them all systematically.

like image 891
Geoff Avatar asked Jan 25 '26 23:01

Geoff


1 Answers

Yes! Get the permalink_url of an image using the /adimages edge off the adaccount node. You can also return the hash value and filter the query by a list of specific hashes:

https://graph.facebook.com/v13/act_<AD_ACCOUNT_ID>/adimages?
    fields=id,permalink_url, 
    hash&hashes=["<IMAGE_HASH_1>","<IMAGE_HASH_2>"]

This returns:

{
  "data": [
    {
      "id": "<AD_IMAGE_ID>",
      "permalink_url": "https://www.facebook.com/ads/image/?d=<UNIQUE_NUMBER>",
      "hash": "<IMAGE_HASH_1>"
    },
    {
      "id": "<AD_IMAGE_ID>",
      "permalink_url": "https://www.facebook.com/ads/image/?d=<UNIQUE_NUMBER>",
      "hash": "<IMAGE_HASH_2>"
    },
  ],
  "paging": {
    "cursors": {
      "before": "<VALUE>",
      "after": "<VALUE>"
    }
  }
}
like image 187
Meli Avatar answered Jan 28 '26 10:01

Meli