API Reference v4.2

Aṇu Astra Integration Guide

Welcome to the official developer documentation for Aṇu Astra. This guide comprehensively covers the integration of our 1024-Qubit Virtual Quantum Processor (VQP) into your enterprise logic.

Aṇu Astra operates exclusively over standard REST APIs, allowing developers to inject Quantum Randomness (QRNG), execute deep-shallowed Quantum Circuits (OpenQASM/JSON), and generate Post-Quantum Cryptographic keys (Kyber/Dilithium) without requiring specialized client-side hardware or cryogenic cooling systems.

Security & Authentication

Every request to the Aṇu Astra API cluster must be cryptographically authenticated using an API Key. You can generate and rotate your keys within the Developer Dashboard.

Header Injection:
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxx

Quantum Random Number Generation (QRNG)

The cornerstone of unconditional cryptographic security is perfect entropy. Traditional PRNGs (Pseudo-Random Number Generators) rely on deterministic algorithms (like Mersenne Twister) which are theoretically predictable if the seed state is compromised or reverse-engineered.

Aṇu Astra's QRNG harnesses simulated superposition collapse. By placing a virtual qubit array into perfect superposition |ψ⟩ = (1/√2)(|0⟩ + |1⟩) and forcing an immediate measurement over entire blocks concurrently, we extract high bit-rate, theoretically perfect minimum entropy (H_min ≈ 7.99 bits/byte) that is non-deterministic and cryptographically flawless.

QRNG REST Endpoints

Retrieve raw entropy across multiple data structures using exactly one master endpoint.

POST /api/v1/quantum/qrng

Returns theoretically perfect quantum entropy based on the requested output type.

JSON Body Parameters

ParameterTypeDescription
type * string Must be one of: bytes, int, float, bits.
size integer Required for bytes and bits. Defaults to 32. Max 1024.
min integer Required for int. The minimum bound (inclusive).
max integer Required for int. The maximum bound (inclusive).

QRNG Implementation Examples

Using the official Aṇu Astra Native SDKs is the recommended pattern for production.

from anuastra import Client

astra = Client(api_key='sk_live_YourAstraKeyHere')

# Native Python wrappers cleanly format API telemetry under the hood
hex_seed = astra.qrng.get_random_bytes(length=32)
unbiased_int = astra.qrng.get_random_int(min=100, max=1000)
pure_float = astra.qrng.get_random_float()
bit_string = astra.qrng.get_random_bits(size=256)

print("Hexadecimal Seed:", hex_seed['entropy'])
print("Float Probability [0,1):", pure_float['entropy'])
import { AṇuAstra } from 'anuastra';

const astra = new AṇuAstra({ apiKey: 'sk_live_YourAstraKeyHere' });

async function generateEntropy() {
    // Strictly typed Promises for all QRNG forms
    const byteRes = await astra.qrng.getRandomBytes(64);
    const bitsRes = await astra.qrng.getRandomBits(1024);
    const intRes = await astra.qrng.getRandomInt(1, 10);
    const fRes = await astra.qrng.getRandomFloat();

    console.log(`Quantum Coin Toss: ${intRes.data.entropy === 1 ? 'Heads' : 'Tails'}`);
}
curl -X POST "https://astra.cryptopix.in/api/v1/quantum/qrng" \
  -H "Authorization: Bearer sk_live_YourAstraKey" \
  -H "Content-Type: application/json" \
  -d '{"type": "float"}'

Quantum Circuit Execution

The Aṇu Astra cluster supports highly complex unitary evolution algorithms locally on edge. Below is the mathematically rigorous dictionary of physical gates supported by the VQP state vector.

Category Supported Gates (JSON / SDK) Parameters Required
Pauli & Basic H, X, Y, Z, ID Target Qubit
Phase & S/T S, SDG, T, TDG, P Target Qubit (P requires Lambda float)
Axis Rotations RX, RY, RZ Target Qubit, Theta (radians)
Square Root SX, SXDG Target Qubit
General Unitary U1, U2, U3, U Target Qubit, Angles (θ, φ, λ)
2-Qubit (Controlled) CX (CNOT), CY, CZ, CH Control Qubit, Target Qubit
2-Qubit (Advanced) SWAP, ISWAP, ECR, DCX Qubit 1, Qubit 2
2-Qubit (Rotations) CRX, CRY, CRZ, CP, CU Control, Target, Angles
2-Qubit (Ising/XX) RXX, RYY, RZZ, RZX Qubit 1, Qubit 2, Theta
3+ Qubit (Multi-Controlled) CCX (Toffoli), CCZ, CSWAP (Fredkin)
C3X, C4X
Multiple Controls, Multiple Targets

Standard JSON Payload Execution

POST /api/v1/quantum/execute

Submit a strongly-typed JSON array detailing your circuit's chronological evolution string.

const payload = {
    "qubits": 2,
    "circuit": [
        { "gate": "H", "target": [0] },                     // Superposition Q0
        { "gate": "CX", "target": [0, 1] },                 // Entangle Q0 to Q1
        { "gate": "RY", "target": [1], "param": 1.5708 }    // Rotate Q1 by π/2
    ]
};

// Dispatch utilizing Node fetch or Python requests to /execute endpoint

OpenQASM 2.0 Integration

POST /api/v1/quantum/qasm

For research portability, Astra supports raw OpenQASM 2.0 string ingestion. This allows circuits compiled natively out of IBM Qiskit or Pennylane to execute directly on our VQP.

const payload = {
    "qasm": `OPENQASM 2.0;
             include "qelib1.inc";
             qreg q[2];
             creg c[2];
             h q[0];
             cx q[0],q[1];
             measure q -> c;`
};

Post-Quantum Cryptography (PQC)

Traditional RSA and ECC encryption schemes are mathematically vulnerable to Shor's Algorithm executed on mature Quantum Computers. Aṇu Astra provides immediate FIPS 203 & 204 compliant drops-ins for Post-Quantum generation architectures.

POST /api/v1/quantum/pqc/keygen

Example Generation Script (Python)

import requests

payload = {
    "algorithm": "kyber",          # 'kyber' (KEM) or 'dilithium' (DSA)
    "security_level": 768          # Equivalencies: 512, 768, 1024
}

response = requests.post(
    "https://astra.cryptopix.in/api/v1/quantum/pqc/keygen",
    json=payload,
    headers={"Authorization": "Bearer sk_live_xxx"}
)

keys = response.json()["data"]
print("Post-Quantum Public Key:", keys["public_key"])
print("Military-Grade Private Key:", keys["private_key"])

Telemetry & Error Handling

Aṇu Astra returns standard JSON envelopes. On failure, status will be mapped to "error".

HTTP CodeSystem DesignationMeaning
401 Auth Failure The Bearer Token is missing, completely invalid, or has been forcefully revoked.
402 Quota Exceeded The account has critically depleted its Quantum Credits. Upgrade tier or await monthly chronological refresh.
400 Vector Out of Bounds Bad JSON array syntax, calling a gate parameter that does not exist, or requesting > 1024 qubits.