Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/21 (UTC).
[null,null,["Dernière mise à jour le 2025/08/21 (UTC)."],[[["\u003cp\u003eCreates a new ad unit under a specified AdMob account using an HTTP POST request.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing the account's resource name as a path parameter and an \u003ccode\u003eAdUnit\u003c/code\u003e object in the request body.\u003c/p\u003e\n"],["\u003cp\u003eReturns the newly created \u003ccode\u003eAdUnit\u003c/code\u003e object in the response body if successful.\u003c/p\u003e\n"],["\u003cp\u003eNeeds \u003ccode\u003eadmob.monetization\u003c/code\u003e OAuth scope for authorization and might have limited access requiring account manager approval.\u003c/p\u003e\n"]]],["This document details the process for creating an ad unit within an AdMob account. It uses a `POST` HTTP request to `https://admob.googleapis.com/v1beta/{parent=accounts/*}/adUnits`, where `parent` specifies the account. The request body requires an `AdUnit` instance, and a successful request returns a new `AdUnit` instance in the response body. Authorization requires the `https://www.googleapis.com/auth/admob.monetization` OAuth scope. Access is limited, potentially requiring account manager intervention for permission.\n"],null,["# Method: accounts.adUnits.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Examples](#examples)\n- [Try it!](#try-it)\n\nCreates an ad unit under the specified AdMob account.\n\n\u003cbr /\u003e\n\n| This method has limited access. If you see a 403 permission denied error, please reach out to your account manager for access.\n\n\u003cbr /\u003e\n\n### HTTP request\n\n`POST https://admob.googleapis.com/v1beta/{parent=accounts/*}/adUnits`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. Resource name of the account to create the specified ad unit for. Example: accounts/pub-9876543210987654 |\n\n### Request body\n\nThe request body contains an instance of [AdUnit](/admob/api/reference/rest/v1beta/accounts.adUnits#AdUnit).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [AdUnit](/admob/api/reference/rest/v1beta/accounts.adUnits#AdUnit).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/admob.monetization`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2)."]]