How to get iTunes connect Team ID and Team name?

28,490

Solution 1

You can get it directly from Spaceship (See the "Login" section) (https://github.com/fastlane/fastlane/blob/master/spaceship/docs/iTunesConnect.md)

Basically just type the following in a shell:

$ irb
irb> require "spaceship"
irb> Spaceship::Tunes.login("iTunesConnect_username", "iTunesConnect_password")
irb> Spaceship::Tunes.select_team

You'll be presented with a list of teams your account belongs to, along with the numerical representation for that team.

Solution 2

If you are not on your Mac, you can get it through the iTunes connect website.

Source: https://github.com/fastlane/fastlane/issues/4301#issuecomment-253461017

Solution 3

Instead of trying to get it manually, just run fastlane without specifying the team ID. Once the selection is required, fastlane will list all the available iTunes Connect teams and their IDs, and you can then store this number.

Solution 4

Add below lane code to your fastlane Fastfile and run fastlane getTeamNames

 lane :getTeamNames do
  require "spaceship" 
  clientTunes = Spaceship::Tunes.login("{appleID}", "{applePassword}")
  client = Spaceship::Portal.login("{appleID}", "{applePassword}")

  strClientTunes = "" 
  clientTunes.teams.each do |team|
      UI.message "#{team['contentProvider']['name']} (#{team['contentProvider']['contentProviderId']})"
      strClientTunes << "#{team['contentProvider']['name']} (#{team['contentProvider']['contentProviderId']})||"
  end 
  File.write('ItunesTeamNames', strClientTunes[0..-3])

  strDevPortal = "" 
  client.teams.each do |team|
      UI.message "#{team['name']} (#{team['teamId']})"
      strDevPortal << "#{team['name']} (#{team['teamId']})||"
  end
  File.write('DevTeamNames', strDevPortal[0..-3])

end

Get iTunes connect Team ID and Team name from ItunesTeamNames and DevTeamNames files in fastlane folder

Note:- Replace {appleID} and {applePassword} with your apple id and password

Solution 5

Easiest way

fastlane produce

if you are in multiple teams it will show

[16:36:43]: Your Apple ID Username: [email protected]
Available session is not valid any more. Continuing with normal login.
Multiple teams found on the Developer Portal, please enter the number of the team you want to use: 
1) 89******8K "B******d Incorporated" (Company/Organization)
2) B8******ZP "Sultanmyrza Kasymbekov" (Individual)

you should choose one after it will as you again

[16:38:19]: [DevCenter] App 'co.brainfood.brainfood' already exists, nothing to do on the Dev Center
Available session is not valid any more. Continuing with normal login.
Multiple App Store Connect teams found, please enter the number of the team you want to use: 
Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile:
Alternatively you can pass the team name or team ID using the `FASTLANE_ITC_TEAM_ID` or `FASTLANE_ITC_TEAM_NAME` environment variable

  itc_team_id "1******12"

or

  itc_team_name "B******d Incorporated"

1) "B******d Incorporated" (1*******2)
2) "Sultanmyrza Kasymbekov" (1******7)
Share:
28,490
Calvin Ferrando
Author by

Calvin Ferrando

BY DAY: I spend my time sleeping. BY NIGHT: I code 'til my hands bleed. FOR FUN: I want to learn new stuff or just enhance my coding skills.

Updated on January 27, 2022

Comments

  • Calvin Ferrando
    Calvin Ferrando about 2 years

    I'm writing down an Appfile for fastlane, my problem is I already have the team_name and team_id in Apple Dev Center but I can't get the iTunes Connect ID/itc_team_id. I'm working with different team. How do I get it? Any guide would be great. Thanks

  • Calvin Ferrando
    Calvin Ferrando about 7 years
    I've done that before and actually saw the itc_team_id for different teams but I'm building a NodeJS application where I run a shell command fastlane there. Basically, it is an automation build process where I don't need to answer/select the itc_team_id by just overwritting the Appfile and place the itc_team_id there. By the way, nice software you have.
  • green0range
    green0range over 6 years
    If you are using fastlane deliver for example, do "fastlane deliver -u <account_user_name>" and it will show the list of team ids for iTunes Connect
  • Kelsey
    Kelsey about 5 years
    Is there any way to get the App Store Connect ID (not team id) without going through fastlane? I have an operations team that is not going to be running a cli to determine build parameters. I've scoured the internet for an answer to this.. no avail. Maybe you can shed some light @KrauseFx ?
  • Edgar Froes
    Edgar Froes over 3 years
    Works 2021. Should only rename itunes store connect to appstore connect so you stay up to date with Apple's naming.
  • thinklinux
    thinklinux about 3 years
    That's the best answer. Also works in 2021. Especially if you have 2fa enabled. Probably fastlane and apple will make it easier in the future.
  • KSR
    KSR about 2 years
    Best answer. THANKS.