Get Google Cloud Project Number using its Id
I think GCP did not provide an API to map a project ID to a project number. But they did provide a project list API, after you get the list of the projects. You can map the project number by yourself.
Not sure why they don't expose it directly, but you can do this (assuming your current configuration project corresponds to the desired project number):
gcloud projects list \
--filter="$(gcloud config get-value project)" \
--format="value(PROJECT_NUMBER)"