v1.4 of the AdSense Management API is now deprecated. This version will stop returning data on October 12, 2021. Please migrate to v2 as soon as possible.

Migrating from an older version

The latest version of the AdSense Management API is v2. All previous versions are currently deprecated and will sunset on October 12, 2021.

In order to upgrade to v2, be sure to first check the release notes. Since this is a major version change, there are breaking changes. Once you're prepared to make the necessary changes, select one of the get started options below based on how you access the API.

If you're using a dynamic programming language

If you're using the client library for one of the dynamic programming languages we support, such as Ruby or Python, all it should take is updating the version string in your code.

For example, for Python:

http = httplib2.Http()
service = build("adsense", "v2", http=http)

or for Ruby:

client = Google::APIClient.new
adsense = client.discovered_api('adsense', 'v2')

If you're using a static programming language

If you're using the client library for one of the static programming languages we support, such as Java, PHP or C#/.NET, you'll need to update the AdSense Management API-specific module.

Note: there have been several changes to the core client libraries over time, so updating these modules may require you to update the core client library as well, which could mean further changes to your code. Please consult the documentation for your client library if that's the case.

Java

Make sure you have the latest AdSense Management API library and replace your project dependencies.

PHP

Make sure you update to the latest version of the full PHP client library. This should include the latest version of the AdSense Management API module, as well as all other APIs.

C#/.NET

Make sure you have the latest AdSense Management API library and replace your project dependencies.

If you're not using the client libraries

If you're not using one of our client libraries, all you need to do is update the base URL you're using in your requests. For example:

https://www.googleapis.com/adsense/v1.4/

becomes:

https://adsense.googleapis.com/v2/