Access and Authentication

Access to IonQ's API requires an API key. This can be obtained on from the IonQ Console at

For those accounts without console access, contact to obtain a key.


An API key is required to access IonQ via Cirq. You will pass this key to an instance of a cirq_ionq.Service, which can then be used to interact with IonQ computers.

Here is an example of this pattern:

import cirq_ionq as ionq

service = ionq.Service(api_key='tomyheart')

Alternatively, you can use environment variables to set this value. This environment variable for the API key is IONQ_API_KEY. Details of how to set environment variables vary by operating system. For example, in bash:

export IONQ_API_KEY=tomyheart

Once this variable is set, the ionq.Service() will look for it automatically in the environment:

import cirq_ionq as ionq

service = ionq.Service()

The advantage of doing things this way is that you do not have to store the API key in source code, which might accidentally get uploaded to a version control system, and hence leak the API key.

Next steps

Learn how to run jobs against the service

Learn how to build circuits for the API

How to use the service API

Get information about QPUs from IonQ calibrations