15

Many of the Directory API calls require a customer parameter referred to as the "Immutable id of the Google Apps account. (string)".

e.g. GET https://www.googleapis.com/admin/directory/v1/customer/customer/domains

I have no idea how to find/generate this for my Google Apps account. I am an admin.

Can someone point me in the right direction please?

Gary Prendergast
  • 151
  • 1
  • 1
  • 4
  • 2
    You can call the method Users.get with your own account, at the end of the response you can find the customerId. – Gerardo Nov 06 '15 at 02:08

5 Answers5

16

I was able to find the customerId as follows

  1. Go to admin.google.com
  2. Security -> Set up single sign-on (SSO)

You will see URLs like this:

https://accounts.google.com/o/saml2/idp?idpid=Cxxxxxxxx

That Cxxxxxxxx is your customerId

rsmoorthy
  • 2,284
  • 1
  • 24
  • 27
6

Had the same question, so I had to contact their chat support.

The official answer was:
There are no any web interface to look up this information - as I would expect for example in "organisation admin panel". The only way to get this information is from the code.

You have to write extra code to request information about any existing user:
(Link to API Docs - GET: https://www.googleapis.com/admin/directory/v1/users)
And in the response, you can find field customerId which is the same for each user in the company across all domains.

That is the only way to find your organisation customerId...

Not user-friendly, so I will submit "Feature Request" right now to Google.

Bryksin
  • 2,322
  • 3
  • 19
  • 31
  • 3
    This method required the customer id which left me puzzled. I later found that 'my_customer' can be used in place of the customer id and indeed the actual customer id is included in the response. – g . Sep 18 '16 at 15:23
3

The easiest way I found was to use the APIs Explorer at the bottom of the documentation for the Customers: get method on the Directory API (Admin SDK). Enter 'my_customer' for the customerKey on the form and hit the 'Authorize and Execute' button.

The response will include the CustomerId (e.g. Cxxxxxxxx) as the "id". The entire response will look something like this:

{
  "kind": "admin#directory#customer",
  "id": string,
  "etag": etag,
  "customerDomain": string,
  "alternateEmail": string,
  "postalAddress": {
    "organizationName": string,
    "countryCode": string,
  },
  "language": string,
  "customerCreationTime": datetime
}
g .
  • 8,110
  • 5
  • 38
  • 48
3

If you are part of an organization, you can find it here as Organization ID: https://play.google.com/work/adminsettings?pli=1

It works for G Suite accounts and Gmail accounts that are associated with an organization, but not for individual Gmail accounts.

Henrik Solgaard
  • 154
  • 2
  • 9
0

I found something simpler: gcloud organizations list. It will give you DISPLAY_NAME, ID and DIRECTORY_CUSTOMER_ID (this is what your are looking for) for all you organizations.

laurent
  • 674
  • 9
  • 14