# Method: accounts.adclients.getAdcode

- [HTTP request](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#body.request_body)
- [Response body](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#body.response_body)
  - [JSON representation](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#body.AdClientAdCode.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#body.aspect)
- [Try it!](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients/getAdcode#try-it)

Gets the AdSense code for a given ad client. This returns what was previously known as the 'auto ad code'.

This is only supported for ad clients with a productCode of AFC.

For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634).

### HTTP request

`GET https://adsense.googleapis.com/v2/{name=accounts/*/adclients/*}/adcode`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. Name of the ad client for which to get the adcode. Format: accounts/{account}/adclients/{adclient} |

### Request body

The request body must be empty.

### Response body

Representation of the AdSense code for a given ad client.

For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634).

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "adCode": string, "ampHead": string, "ampBody": string } ``` |

| Fields ||
|---|---|
| `adCode` | `string` Output only. The AdSense code snippet to add to the head of an HTML page. |
| `ampHead` | `string` Output only. The AdSense code snippet to add to the head of an AMP page. |
| `ampBody` | `string` Output only. The AdSense code snippet to add to the body of an AMP page. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/adsense`
- `
  https://www.googleapis.com/auth/adsense.readonly`