Skip to main content
The playground exposes four HTTP endpoints under /api. Every endpoint accepts JSON and returns JSON. All four endpoints proxy requests to the quasar service running on Google Cloud Run, using the GOOGLE_CLOUD_SERVICE_URL environment variable.

POST /api/simulate

Submit OpenQASM 3.0 source code and receive the quantum state vector produced by the simulator. The response lists every basis state with nonzero probability, along with its probability and complex amplitude.

Request

string
required
The full OpenQASM 3.0 program to simulate, including the OPENQASM 3.0; version declaration.

Response

State[]
required
Array of quantum basis states with nonzero probability after simulation.

Errors


POST /api/share

Save an OpenQASM program and receive a shareable snippet ID. The returned ID can be passed to /api/edit to retrieve the program later.

Request

string
required
The OpenQASM 3.0 program to save. The full source is stored as-is.

Response

string
required
Unique identifier for the saved snippet. Use this ID to retrieve the snippet via /api/edit.
string
required
The program source that was saved.
string
required
ISO 8601 timestamp of when the snippet was created.

Errors


POST /api/edit

Retrieve a previously saved snippet by its ID. This is used by the playground to load shared programs from a URL.

Request

string
required
The snippet ID returned by a prior call to /api/share.

Response

string
required
The snippet ID.
string
required
The saved OpenQASM program source.
string
required
ISO 8601 timestamp of when the snippet was originally created.

Errors


POST /api/validate

Check whether an OpenQASM program is syntactically valid without running a full simulation. Returns the validation result from the simulator backend.

Request

string
required
The OpenQASM 3.0 program to validate.

Response

The response body is the raw validation result returned by the quasar service. A successful validation returns an HTTP 200 with a JSON body indicating the program is valid.

Errors