# Method: projects.locations.namespaces.getIamPolicy

- [HTTP request](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#body.response_body)
- [Authorization Scopes](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#body.aspect)
- [Try it!](https://docs.cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces/getIamPolicy#try-it)

Gets the IAM Policy for a resource (namespace or service only).

### HTTP request

`POST https://servicedirectory.googleapis.com/v1beta1/{resource=projects/*/locations/*/namespaces/*}:getIamPolicy`

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

### Path parameters

| Parameters ||
|---|---|
| `resource` | `string` REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |

### Request body

The request body contains data with the following structure:

| JSON representation ||
|---|---|
| ``` { "options": { object (`https://docs.cloud.google.com/service-directory/docs/reference/rest/Shared.Types/GetIamPolicyRequest#GetPolicyOptions`) } } ``` |

| Fields ||
|---|---|
| `options` | ``object (`https://docs.cloud.google.com/service-directory/docs/reference/rest/Shared.Types/GetIamPolicyRequest#GetPolicyOptions`)`` OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/service-directory/docs/reference/rest/Shared.Types/Policy`.

### Authorization Scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/).