Loading ads through the REST API

Advanced Ads Pro allows you to load ads using the REST API. This is especially useful if you want to access your ads on non-WordPress websites or mobile apps.

Once you enable the REST API module in Advanced Ads > Settings > Pro, you have access to the following endpoints:

/wp-json/advanced-ads/v1/ads /wp-json/advanced-ads/v1/ads/{id:\d} /wp-json/advanced-ads/v1/groups /wp-json/advanced-ads/v1/groups/{id:\d}

These endpoints return the appropriate data and information in JSON format. To make this format more readable, you can use a JSON Formatter.

You can use the ?page and ?per_page parameters for pagination. For examples, please see the WordPress REST API handbook.

The content returned by the ads endpoints is already processed for display.

If you are using Tracking, an ad impression is counted when you call the /wp-json/advanced-ads/v1/ads/{id:\d} endpoint. The API does not check if an ad retrieved through the API was ever displayed or visible by a human.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.