4

Am trying to figure out the API. Were in the web interface can, as an administrator, find the "content owner id" of my managed accounts?

All I see is this:

"To retrieve a content owner report, call the API's reports.query method and set the ids parameter value in the API request to contentOwner==OWNER_NAME, where OWNER_NAME specifies the content owner's ID. Ask your partner manager if you are unsure of the value."

Surely I don't have to call Google to get this value?

Chris Harrington
  • 1,238
  • 2
  • 15
  • 28

2 Answers2

5

If you want to know the content owner id of only one account, you can check the URI.

There are various ways to retrieve the id from the URI:

  • Log in on https://studio.youtube.com/ and switch the account to the
    one you're trying to get the id of (on the top right click on the
    account logo, then on "Switch account"). When you've switched to the new account, the content owner id should be in the URL in the part that follows https://studio.youtube.com/owner/.
  • Go to https://www.youtube.com/analytics and switch to the desired account. The content owner id is what follows https://www.youtube.com/analytics?o= and before &ar.
  • The second option should also work for other sections in the Youtube creator studio.

If you want to retrieve a list of all content owner IDs linked to your admin account, it's much easier to do it via the API. If you don't want to write a script for that, you can just use the Google API explorer (on the right) here: https://developers.google.com/youtube/partner/docs/v1/contentOwners/list Just set fetchMine to true and sign in to your account. The output below should give you a list of the content owner names, IDs and other info.

To retrieve the content owner IDs via the API, samples can also be found here: https://developers.google.com/youtube/partner/code_samples/ (check the docs "Retrieve a content owner's managed channels (channels.list)" in your language).

c.gumuljo
  • 51
  • 1
  • 1
4

You may refer with this SO answer on how to get the content owner id.

Assuming you have an OAuth 2 token with access to the https://www.googleapis.com/auth/youtubepartner scope, you can make an API call to youtubePartner.contentOwners.list(fetchMine=true) to get back a list of YouTube content owners associated with the current OAuth 2 token. (There will normally only be one item returned.) You can then get the content owner id value from the id property of each item in the items list that's returned. This is the value that you can use when making content owner YouTube Analytics API reports, or using the onBehalfOfContentOwner delegation parameter in the YouTube Data API v3.

You need to query youtubePartner.contentOwners.list(fetchMine=true) to obtain the content owner info. Also make sure that you have this API available in your console or ask your partner manager if you are eligible for this API.

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59
  • I understand that I can get it via the API. I was hoping to find a non-API mechanisms, given that the docs say: "Ask your partner manager if you are unsure of the value." – Chris Harrington Jan 23 '17 at 15:17
  • I guess "Ask your partner manager if you are unsure of the value." means that you need to ask your partner manager if you are eligible for this API to get this ID. – abielita Jan 24 '17 at 07:38
  • I did end up querying for a list of content owners. And the returned IDs I was able to use in other queries. – Chris Harrington Jan 28 '17 at 22:43
  • @ChrisHarrington, how did you manage to invoke that API? Do you have the YouTube Content ID API enabled? If so, what did you do to get it? Thanks! – Ricky Chau Feb 24 '22 at 15:03
  • That was some time ago. But I think it was available based on the company being a Youtube Partner. – Chris Harrington Feb 24 '22 at 20:08