How can I update my API token, or add new tokens, to the Leap IDE?

 There are a few reasons you may want to update or add a new token to the Leap IDE. 

  1. You upgraded your account to get more time and, as a result, have a new token
  2. You reset your token on the Dashboard
  3. You have multiple tokens

The Leap IDE automatically loads your API token into its environment variables the first time you log in. Any time you submit a problem to a solver, the solver will look in the environment variables for your token. If you don't have the correct token you won't be able to submit problems. 

To change or add to your environment variables go to your IDE Workspaces. Click on your name in the top right of the page and select Settings.


You will notice that in the Environment Variables section there are two default variables: DWAVE_API_TOKEN and DWAVE_API_SOLVER. Copy your new token from the Dashboard and paste it into the DWAVE_API_TOKEN value field. Make sure to save it. If you have any running workspaces you will need to stop and restart them for the changes to take affect. 


To add a new variable click on the Add Variable button. You need to give it a name and fill in the value with your other API token.


If you want to submit problems with a second token you will need to import it into your python code and submit it to the sampler you use. Here's a small example

from dwave.system import DWaveSampler
import os

second_token = os.getenv("SECOND_API_TOKEN")
sampler = DWaveSampler(token=second_token)



Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.