FoundryProductsTechnologyCompanyInvestor relationsResource libraryNews
Contact us
Resource library
    Introduction to uQRNG home
    QRNG API Quickstart Guide
    uQRNG whitepaper
    uQRNG spec sheet

Couldn’t find what you are looking for? Reach out to technical support.

Contact support
Privacy PolicyCookie PolicyTerms of UseForward Looking StatementsAccessibility Statement
Terms and Conditions of SaleEnd User License Agreement

© 2018-2026 Quantum Computing Inc.

Default

QRNG API Quickstart Guide

Introduction

We are providing API access to our uQRNG service free of charge to users during our initial launch. Users can access up to 1 billion bits from the uQRNG service per month with a maximum requests size of 1 million QRNs.Need more QRNs, please contact us at support@quantumcomputinginc.com.

Obtaining an Access Token

To run jobs using the uQRNG device, you will need an active account and an API token from QCI. Request a QCI user account and token below:

Request an account

You will receive an email response with an API access token and instructions on how to get started. Using your access token, you’ll authenticate with the QRNG service (standard OAuth 2.0 authentication) and use the refresh token obtained from the authentication process in subsequent requests to the QRNG service. Examples of authenticating and making QRNG requests are shown below using the curl, Python, and R programming languages:

Access Token

  • ACCESS_TOKEN=`curl -X "POST" \
  • -H "Content-Type: application/json" \
  • -d "{ \"refresh_token\": \"API_TOKEN\" }" \
  • https://api.qci-prod.com/auth/v1/access-tokens | jq -r ".access_token"`
  • import requests
  • api_token = "API_TOKEN"
  • qrng_url = "https://api.qci-prod.com"
  • json_data = {
  • "refresh_token": f"{api_token}",
  • }
  • headers = {
  • "accept": "application/json",
  • "Content-Type": "application/json",
  • }
  • response=requests.post(
  • f"{qrng_url}/auth/v1/access-tokens",
  • headers=headers,
  • json=json_data)
  • response_json = response.json()
  • print(response_json)
  • access_token = response.json().get("access_token")
  • require(httr)
  • api_token = "API_TOKEN"
  • qrng_url = "https://api.qci-prod.com"
  • headers = c(`Content-Type` = "application/json")
  • data = list(refresh_token = api_token)
  • response <- httr::POST(
  • url = paste(qrng_url, "auth/v1/access-tokens", sep="/"),
  • httr::add_headers(.headers=headers),
  • encode = "json",
  • body = data)
  • auth_resp = content(response,as="parsed")
  • print(auth_resp)

Output

  • { "access_token":"user-Bearer-Token", "expires_in":1680287957, "scope":"access_token", "token_type":"bearer" }

Making calls

Once the user has obtained the Bearer token calls can be made to the QRNG-API as follows:

  • QRNS=`curl -X 'POST' \
  • -H "accept: application/json" \
  • -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  • -H "Content-Type: application/json" \
  • -d '{ "distribution": "uniform_discrete", "output_type": "decimal", "n_samples": 5, "n_bits": 16 }' \
  • https://api.qci-prod.com/qrng/random_numbers`
  • echo ${QRNS}
  • headers = {
  • "accept": "application/json",
  • "Authorization": f"Bearer {access_token}",
  • "Content-Type": "application/json",
  • }
  • json_data = {
  • "distribution": "uniform_discrete",
  • "output_type": "decimal",
  • "n_samples": 5,
  • "n_bits": 16
  • }
  • response = requests.post(
  • f"{qrng_url}/qrng/random_numbers",
  • headers=headers,
  • json=json_data)
  • print(response.json())
  • require(jsonlite)
  • # BEARER_TOKEN is taken from access_token in authorize response
  • BEARER_TOKEN = auth_resp$access_token
  • headers = c(
  • `Authorization` = paste("Bearer", BEARER_TOKEN, sep = " "),
  • `Content-Type` = "application/json"
  • )
  • data = list(distribution ="uniform_discrete",
  • n_samples=5,
  • n_bits=16,
  • output_type="decimal")
  • response <- httr::POST(
  • url =paste(qrng_url, "qrng", "random_numbers", sep="/"),
  • httr::add_headers(.headers=headers),
  • body = data,
  • encode="json")
  • numbers_resp = fromJSON(content(response, as="text", encoding = "ISO-8859-1"))

Output

  • [5845, 7686, 2788, 7021, 1913]

Usage statistics

To check QRNG service usage statistics (reported as the number of bits of QRN data consumed for a given time period:

  • USAGE=`curl -X 'POST' \
  • -H "Accept: application/json" \
  • -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  • -H "Content-Type: application/json" \
  • -d '{ "start_date": "2023-04-14", "end_date": "2023-04-15" }' \
  • https://api.qci-prod.com/qrng/usage`
  • echo ${USAGE}
  • headers = {
  • "Accept": "application/json",
  • "Authorization": f"Bearer {access_token}",
  • "Content-Type": "application/json",
  • }
  • json_data = {
  • "start_date": "2023-04-15",
  • "end_date": "2023-04-16"
  • }
  • response = requests.post(
  • f"{qrng_url}/qrng/usage",
  • headers=headers,
  • json=json_data)
  • print(response.json())
  • # BEARER_TOKEN is taken from access_token in authorize response
  • BEARER_TOKEN = auth_resp$access_token
  • headers = c(
  • `Authorization` = paste("Bearer", BEARER_TOKEN, sep = " "),
  • `Content-Type` = "application/json"
  • )
  • data = list(start_date ="2023-04-14",
  • end_date= "2023-04-15")
  • response <- httr::POST(
  • url = paste(qrng_url, "qrng", "usage", sep="/"),
  • httr::add_headers(.headers=headers),
  • body = data,
  • encode = "json")
  • usage_resp = content(response,as="parsed")

Output

  • { "n_bits": 48077040 }

Resources

For further information on features and usage of API see full API reference guide here.

Open API specification is available at https://api.qci-prod.com/qrng/docs

Next page

Content

  • QRNG API Quickstart Guide
  • Introduction
  • Obtaining an Access Token
  • Access Token
  • Output
  • Making calls
  • Output
  • Usage statistics
  • Output
  • Resources