REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
Response body
If successful, the response body contains an instance of Policy.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-17 UTC."],[[["\u003cp\u003eThis endpoint is used to set the access control policy for an Identity-Aware Proxy (IAP) protected resource, replacing any existing policy.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request to set the IAP policy is a POST request to \u003ccode\u003ehttps://iap.googleapis.com/v1/{resource=**}:setIamPolicy\u003c/code\u003e, using gRPC Transcoding syntax.\u003c/p\u003e\n"],["\u003cp\u003eThe request requires a \u003ccode\u003eresource\u003c/code\u003e path parameter, which specifies the resource for which the policy is being defined.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must include a \u003ccode\u003epolicy\u003c/code\u003e object that defines the complete policy to be applied to the specified resource.\u003c/p\u003e\n"],["\u003cp\u003eTo use this API, one of the provided IAM permissions must be granted on the resource and the OAuth scope \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e is required.\u003c/p\u003e\n"]]],[],null,["# Method: setIamPolicy\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [IAM Permissions](#body.aspect_1)\n- [Try it!](#try-it)\n\nSets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: \u003chttps://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api\u003e\n\n### HTTP request\n\n`POST https://iap.googleapis.com/v1/{resource=**}:setIamPolicy`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Policy](/iap/docs/reference/rest/Shared.Types/Policy).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\n### IAM Permissions\n\nRequires **one of** the following [IAM](https://cloud.google.com/iam/docs) permissions on the `resource` resource, depending on the resource type:\n\n- `iap.gateway.setIamPolicy`\n- `iap.tunnel.setIamPolicy`\n- `iap.tunnelDestGroups.setIamPolicy`\n- `iap.tunnelInstances.setIamPolicy`\n- `iap.tunnelLocations.setIamPolicy`\n- `iap.tunnelZones.setIamPolicy`\n- `iap.web.setIamPolicy`\n- `iap.webServices.setIamPolicy`\n- `iap.webServiceVersions.setIamPolicy`\n- `iap.webTypes.setIamPolicy`\n\nFor more information, see the [IAM documentation](https://cloud.google.com/iam/docs)."]]