View and update projects

This page explains how to retrieve project metadata and modify existing project settings. You can also search for specific projects within your resource hierarchy based on their state or display names.

Find the project name, number, and ID

To interact with Google Cloud resources, you must provide the identifying project information for every request. A project is identified by its project ID and project number.

Console

  1. Go to the Welcome page in the Google Cloud console.

    Go to Welcome

  2. From the project picker at the top of the page, select your project.

    The project name, project number, and project ID appear after the Welcome heading.

gcloud

To find the project number, ID, or name, use the gcloud projects describe command:

gcloud projects describe PROJECT_ID

To retrieve only the project number as a value, use the --format flag:

gcloud projects describe PROJECT_ID --format="value(projectNumber)"

Get an existing project

To get the detailed metadata of a specific Google Cloud project, such as the project's lifecycle state, creation time, and parent resource, use the Google Cloud CLI or the API.

You must have Project Owner status or the permissions of the Browser role (roles/browser) to access project details.

gcloud

Before using any of the command data below, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud projects describe PROJECT_ID

Windows (PowerShell)

gcloud projects describe PROJECT_ID

Windows (cmd.exe)

gcloud projects describe PROJECT_ID

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID

HTTP method and URL:

GET https://cloudresourcemanager.googleapis.com/v3/projects/PROJECT_ID

Request JSON body:

{}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://cloudresourcemanager.googleapis.com/v3/projects/PROJECT_ID"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://cloudresourcemanager.googleapis.com/v3/projects/PROJECT_ID" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
    "projectNumber": "464036093014",
    "projectId": "our-project-123",
    "lifecycleState": "ACTIVE",
    "name": "my project",
    "labels": {
        "mylabel": "prod"
    },
    "createTime": "2016-01-07T21:59:43.314Z"
}

List all projects under a resource

To list all projects that are direct children of a resource, use the v3 projects.list method and specify the parent resource in the query:

REST

Before using any of the request data, make the following replacements:

  • FOLDER_ID: the Google Cloud folder ID

HTTP method and URL:

GET https://cloudresourcemanager.googleapis.com/v3/projects

Request JSON body:

{
    "parent": "folders/662951040570"
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://cloudresourcemanager.googleapis.com/v3/projects"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://cloudresourcemanager.googleapis.com/v3/projects" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
    "projectNumber": "464036093014",
    "projectId": "our-project-123",
    "lifecycleState": "ACTIVE",
    "name": "my project",
    "labels": {
        "mylabel": "prod"
    },
    "createTime": "2016-01-07T21:59:43.314Z"
}

Search for projects

To find projects that match specific criteria, such as a display name prefix or a specific lifecycle state, use the projects.search method or the gcloud alpha resource-manager projects search command.

The scope of the search includes all projects for which you have the resourcemanager.projects.get permission.

Query syntax

You can filter your search using the --query flag (gcloud) or the query parameter (API). Common search filters include the following:

  • displayName: the user-friendly name of the project.
  • state: the lifecycle state of the project, for example, ACTIVE or DELETE_REQUESTED
  • parent.type and parent.id: filters results by a specific organization or folder.

Permissions

If you specify a parent in the query (for example, parent:folders/123), you must have resourcemanager.projects.list permissions on that parent. If you have this permission, all projects under the parent are returned after the remaining filters have been applied.

If you lack this permission, all projects for which you have the resourcemanager.projects.get permission are returned after remaining filters have been applied.

If you don't specify a parent, the results include all projects where you have resourcemanager.projects.get permissions.

Console

You can search for projects from the Manage resources page:

  1. In the Google Cloud console, go to the Manage resources page. Go to Manage resources
  2. In the Filter box, enter the property you want to search by, such as name or ID.
  3. Select the property from the drop-down list and enter the value you want to search for.

gcloud

Before using any of the command data below, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud alpha projects search --query="name:z*"

Windows (PowerShell)

gcloud alpha projects search --query="name:z*"

Windows (cmd.exe)

gcloud alpha projects search --query="name:z*"

You should receive a response similar to the following:

The response contains the projects with names starting with 'z'

REST

HTTP method and URL:

GET https://cloudresourcemanager.googleapis.com/v3/projects:search?query=displayName%3ATokyo%2BRain

Request JSON body:

{}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://cloudresourcemanager.googleapis.com/v3/projects:search?query=displayName%3ATokyo%2BRain"

PowerShell