# Method: accounts.adclients.adunits.getAdcode

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

Gets the ad unit code for a given ad unit.

For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634) and [Where to place the ad code in your HTML](https://support.google.com/adsense/answer/9190028).

### HTTP request

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

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

### Path parameters

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

### Request body

The request body must be empty.

### Response body

Representation of the ad unit code for a given ad unit.

For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634) and [Where to place the ad code in your HTML](https://support.google.com/adsense/answer/9190028).

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

| JSON representation |
|---|
| ``` { "adCode": string } ``` |

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

### Authorization scopes

Requires one of the following OAuth scopes:

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