from qiskit import IBMQ

IBMQ.save_account(token='MY_API_TOKEN')
provider = IBMQ.load_account() # loads saved account from disk

from qiskit_ibm_provider import IBMProvider

IBMProvider.save_account(token='MY_API_TOKEN')
provider = IBMProvider() # loads default saved account from disk

IBMProvider.save_account(token='MY_API_TOKEN_2', name="personal")
provider = IBMProvider(name="personal") # loads saved account from disk named "personal"

from qiskit import IBMQ

IBMQ.stored_account() # get saved account from qiskitrc file

from qiskit_ibm_provider import IBMProvider

IBMProvider.saved_accounts() # get saved accounts from qiskit-ibm.json file

# export QE_TOKEN='MY_API_TOKEN' (bash command)

from qiskit import IBMQ

provider = IBMQ.load_account() # loads account from env variables

# export QISKIT_IBM_TOKEN='MY_API_TOKEN' (bash command)

from qiskit_ibm_provider import IBMProvider

provider = IBMProvider() # loads account from env variables

from qiskit import IBMQ

provider = IBMQ.enable_account(token='MY_API_TOKEN') # enable account for current session

from qiskit_ibm_provider import IBMProvider

provider = IBMProvider(token='MY_API_TOKEN') # enable account for current session

from qiskit import IBMQ
provider = IBMQ.load_account() # load saved account

IBMQ.active_account() # check active account

from qiskit_ibm_provider import IBMProvider
provider = IBMProvider() # load saved account

provider.active_account() # check active account

from qiskit import IBMQ

IBMQ.delete_account() # delete saved account from qiskitrc file

from qiskit_ibm_provider import IBMProvider

IBMProvider.delete_account() # delete saved account from saved credentials

provider.backends()

backend = provider.get_backend("ibmq_manila")
print(backend)

from qiskit import QuantumCircuit

# Bell state circuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()

qc.draw()

from qiskit import transpile
qc = transpile(qc, backend)

job = backend.run(circuits=qc, shots=1024)
result = job.result()
print(result)

from qiskit.visualization import plot_histogram
    
plot_histogram(result.get_counts())

from qiskit.providers.ibmq.managed import IBMQJobManager

job_manager = IBMQJobManager()
job_set = job_manager.run(long_list_of_circuits, backend=backend)
results = job_set.results()

job = backend.run(long_list_of_circuits) # returns IBMCompositeJob
result = job.result()

provider.jobs()

job = provider.job(job_id="627c7cb57c918115bb9a73fe")
print(job)