# Method: projects.getAncestry

- [HTTP request](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#body.request_body)
- [Response body](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#body.GetAncestryResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#body.aspect)
- [Ancestor](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#Ancestor)
  - [JSON representation](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#Ancestor.SCHEMA_REPRESENTATION)
- [Try it!](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#try-it)

Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `projectId` (for example, `my-project-123`).

The caller must have read permissions for this Project.

### HTTP request

`POST https://cloudresourcemanager.googleapis.com/v1/projects/{projectId}:getAncestry`

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

### Path parameters

| Parameters ||
|---|---|
| `projectId` | `string` Required. The Project ID (for example, `my-project-123`). Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `projectId`: - `resourcemanager.projects.get` |

### Request body

The request body must be empty.

### Response body

Response from the `https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#google.cloudresourcemanager.v1.Projects.GetAncestry` method.

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

| JSON representation |
|---|
| ``` { "ancestor": [ { object (`https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#Ancestor`) } ] } ``` |

| Fields ||
|---|---|
| `ancestor[]` | ``object (`https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects/getAncestry#Ancestor`)`` Ancestors are ordered from bottom to top of the resource hierarchy. The first ancestor is the project itself, followed by the project's parent, etc.. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/cloud-platform.read-only`
- `https://www.googleapis.com/auth/cloudplatformprojects`
- `https://www.googleapis.com/auth/cloudplatformprojects.readonly`

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

## Ancestor

Identifying information for a single ancestor of a project.

| JSON representation |
|---|
| ``` { "resourceId": { object (`https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects#ResourceId`) } } ``` |

| Fields ||
|---|---|
| `resourceId` | ``object (`https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects#ResourceId`)`` Resource id of the ancestor. |