link icon
Ask The Community

Do you want to enjoy the new TeamViewer user interface for Windows?

Download the new version and let us know what you think about it! 👉 Please click here 👈

Trying to add new device to teamviewer from code

Hello all, using the following Python code to add a device to Teamviewer, this is

{'error': 'invalid_token', 'error_description': 'Access token does not have the required permissions for this function.', 'error_code': 2}

How do I resolve this?


import requests
from requests.auth import HTTPDigestAuth
import json
from import json_normalize
def createNewDevice():

remoteID = input("Enter Remote ID:")
groupID = input("Enter Group ID:")
descr = input("Enter Description;")
alias = input("Enter Alias:")
pword = input("Enter Password:")
#Go by Usernam

#oAuth2 syntax for Bearer Token appears to be correct....
headers = {"content-type": "application/json", "Authorization": "Bearer xxxxxx-xxxxxxxxxxx"}

#need data
data = {"remotecontrol_id": remoteID, "groupid" : groupID, "description" : descr, "alias" : alias, "password" : pword}
r =, headers=headers,json=data)


Best Answer


  • RlS
    RlS Posts: 15

    Thanks, I changes it around. So Now its givimg me

    {'error': 'invalid_request', 'error_description': 'RemoteControl Id is invalid.', 'error_code': 1}

     Im using r**Please do not post TeamViewer IDs**

    What should I use, also the groupID is like g545456...Is this correct, or should I use something different.

    Thanks Again

  • Yuri_T
    Yuri_T Posts: 2,257 [Former Staff]

    Hi @RlS,

    Thanks for posting.

    Just a heads up, I can help with the API, but I am not fluent in python sorry, so anyone else - feel free to jump in if there are any code errors!

    TeamViewer ID's do not need an "r" in front of them.
    When posting to the API, I would recommend that you first make a request for data from the API, then return the data in JSON format matching the output data you received to make sure your entries match the convention,

    I hope this helps,

    Former Japanese Community Moderator