API

Run quantum DSL circuits over HTTP.

This page documents the existing quantum circuit simulator API shape. It does not add a new API surface.

Endpoint

POST /api/runSimulation accepts quantum DSL and shot count, then returns probabilities, counts, Bloch sphere visualization data, and a circuit diagram when available.

Request

{
  "circuit": "qubits 2\nH 0\nCX 0 1\nMEASURE 0\nMEASURE 1",
  "shots": 1024
}

Response shape

{
  "probabilities": [{ "state": "00", "probability": 0.5 }],
  "counts": { "00": 512, "11": 512 },
  "blochVectors": [{ "x": 0, "y": 0, "z": 0 }],
  "circuitDiagram": "data:image/svg+xml;base64,..."
}

Quantum DSL basics

Use qubits N, one gate per line, and MEASURE i for output counts.

Supported gates

H, X, Y, Z, S, T, CX, and CNOT are supported by the current simulator.

OpenQASM export

Use the simulator toolbar to copy OpenQASM export for supported quantum DSL gates.

Limits

Keep examples small. Statevector simulation grows exponentially with qubit count.