Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/itsubaki/qasm-playground/llms.txt

Use this file to discover all available pages before exploring further.

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

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

Response

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

Errors

StatusMeaning
400The code field is missing, or the simulator rejected the program as invalid OpenQASM.
503The quasar backend service is unavailable.
500The GOOGLE_CLOUD_SERVICE_URL environment variable is not set, or an unexpected server error occurred.
curl --request POST \
  --url https://your-deployment.vercel.app/api/simulate \
  --header 'Content-Type: application/json' \
  --data '{
    "code": "OPENQASM 3.0;\ngate h q { U(pi/2.0, 0, pi) q; }\ngate cx c, t { ctrl @ U(pi, 0, pi) c, t; }\nqubit[2] q;\nreset q;\nh q[0];\ncx q[0], q[1];"
  }'

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

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

Response

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

Errors

StatusMeaning
400The code field is missing from the request body.
500The GOOGLE_CLOUD_SERVICE_URL environment variable is not set, or an unexpected server error occurred.
curl --request POST \
  --url https://your-deployment.vercel.app/api/share \
  --header 'Content-Type: application/json' \
  --data '{
    "code": "OPENQASM 3.0;\ngate h q { U(pi/2.0, 0, pi) q; }\nqubit q;\nreset q;\nh q;"
  }'

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

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

Response

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

Errors

StatusMeaning
400The id field is missing from the request body.
500The GOOGLE_CLOUD_SERVICE_URL environment variable is not set, the snippet was not found, or an unexpected server error occurred.
curl --request POST \
  --url https://your-deployment.vercel.app/api/edit \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "abc123xyz"
  }'

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

code
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

StatusMeaning
400The code field is missing, or the program contains a syntax error detected by the validator. The response body includes the error message from the simulator.
500The GOOGLE_CLOUD_SERVICE_URL environment variable is not set, or an unexpected server error occurred.
curl --request POST \
  --url https://your-deployment.vercel.app/api/validate \
  --header 'Content-Type: application/json' \
  --data '{
    "code": "OPENQASM 3.0;\nqubit q;\nreset q;\nh q;"
  }'

Build docs developers (and LLMs) love