Title: API Documentation
Last modified: February 4, 2019

---

# API Documentation

 *  Resolved [Will Stocks](https://wordpress.org/support/users/willstockstech/)
 * (@willstockstech)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/)
 * Hi guys,
    Is there any API documentation anywhere? I’m trying to work out how
   I can call `w3tc_CdnEngine_S3_Cf_invalidate` (not even sure if this is right!)
   from my theme/plugin based on when I update a particular file/image.
 * Is `w3tc_CdnEngine_S3_Cf_invalidate(array('\wp-content\myimages\image1.jpg));`
   along the correct lines?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Will Stocks](https://wordpress.org/support/users/willstockstech/)
 * (@willstockstech)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/#post-11165864)
 * Or should that be: `W3TC\CdnEngine_S3_Cf->invalidate(array(‘\wp-content\myimages\
   image1.jpg’));
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/#post-11167654)
 * Hello,
 * You can use `w3tc_cdn_purge_files` (deprecated but works)
 *  Thread Starter [Will Stocks](https://wordpress.org/support/users/willstockstech/)
 * (@willstockstech)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/#post-11170484)
 * Thanks [@vmarko](https://wordpress.org/support/users/vmarko/) – can you confirm
   that this would only invalidate the file/URL in Cloudfront and not PURGE the 
   file?
    I only want to call the invalidate path, when an image is updated (it 
   would have the exact same URL). An example of what I’m trying to do: [https://cdn.willstocks.com/wp-content/uploads/optimum-gravatar-cache/avatar/2.jpg?d=thb95k](https://cdn.willstocks.com/wp-content/uploads/optimum-gravatar-cache/avatar/2.jpg?d=thb95k)
   This image is a user/commenter/author avatar. A daily check occurs to see whether
   a Gravatar has updated (using [@jomisica](https://wordpress.org/support/users/jomisica/)’
   s OGC plugin) and I use W3TC to push those images up to my CDN (AWS S3 + Cloudfront,
   where I store all of my other image assets). If an image is updated, it gets 
   a new query string on the end, to denote the datetime of the change. However,
   I saw yesterday that regardless of this query string, Cloudfront was still caching
   2.jpg as the _old_ image until I invalidated that specific URL.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/#post-11170658)
 * Hello [@willstockstech](https://wordpress.org/support/users/willstockstech/),
 * Yes, it only sends an invalidation request to CDN.
    It’s also possible to configure
   CloudFront so that it will respect query strings via “Query String Forwarding
   and Caching” parameter, so invalidation will not be required.
 *  Thread Starter [Will Stocks](https://wordpress.org/support/users/willstockstech/)
 * (@willstockstech)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/#post-11170947)
 * Nice one – thanks [@vmarko](https://wordpress.org/support/users/vmarko/). I thought
   I had the query string forwarding enabled, however I will triple check this!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘API Documentation’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * 5 replies
 * 2 participants
 * Last reply from: [Will Stocks](https://wordpress.org/support/users/willstockstech/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/api-documentation-6/#post-11170947)
 * Status: resolved