Qubibyte API

The Qubibyte API

Everything the simulator does, from your own code: run circuits and sweeps, read the state as the Data Analysis tab shows it, keep projects of Qubi files, draw, put your work on your profile, and ask QubiAI. The same engine as the simulator, one HTTP call away.

# A Bell pair
curl https://api.qubibyte.org/v1/simulate \
  -H "Authorization: Bearer qb_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "source": "H 0; CX [0,1]" }'
{
  "qubits": 2,
  "gates": 2,
  "probabilities": { "00": 0.5, "11": 0.5 },
  "elapsedMs": 1,
  "cost": "0.000021000"
}

The base URL is https://api.qubibyte.org/v1. Every response is JSON except where you ask for an image.

Every endpoint below has a Try it panel that sends a real request and shows the real answer, with what it will cost worked out as you type. Signed in to Qubibyte, it uses your own key with nothing to set up; API Key at the top right switches to a different one.

The API is part of Plus and Pro, each with a monthly allowance of usage. Your key is on your account page.

Authentication

Send your key as a bearer token on every request.

Authorization: Bearer qb_live_x9f2...

Each account has one key, made for it the first time it is needed. You can show it and copy it from your account page whenever you like. If it may have leaked, Replace Key makes a new one and the old one stops working at that moment.

A key answers as the account that made it. Its plan is checked on every request, so a key stops working the day a subscription lapses and works again the day it comes back, with nothing to reissue.

There are no cookies on this API and nothing from the website's session is honoured here. A page cannot make API calls on your behalf by accident, and a key cannot be used to sign in to the site.

Rate limits

BucketLimitApplies to
General1,200 / minuteEvery endpoint, per key
Simulation300 / minutePOST /simulate and POST /sweep, on top of the general bucket
Sign-in20 / minuteRequests with a wrong or missing key, per address. Past that the address is blocked from trying for a minute, and for twice as long each time it happens again within a day, up to a day ("code": "blocked"). A valid key from the same address still works.

Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (a Unix timestamp). Past the limit you get 429 with a Retry-After header in seconds. Windows are fixed minutes, so the count resets on the minute rather than sliding.

Spend limits

On top of the allowance, every account has a safety limit on what the API may spend in a rolling hour and a rolling day: $2.00 an hour and $10.00 a day unless you set your own, from $0.01 to $1,000, on your account page under API. A request that would pass the limit is refused with 429 and "code": "spend_cap", saying which limit, what was spent and what the request would have cost, before any of it runs or is charged. The point is a script in a loop: it stops at the limit you chose rather than at your credit. GET /v1/usage does not show the limits; the site's account page does.

Pricing and usage

Requests are paid for from a monthly allowance that comes with the plan, down to the billionth of a dollar. Most cost a few millionths: a Bell pair is $0.000021, so the Plus allowance covers over two hundred thousand of them a month.

PlanAllowanceResets
Plus$5.00 / monthEvery month, on your billing day
Pro$20.00 / monthEvery month, on your billing day

Past the allowance, requests are paid from surplus credits, bought in $1, $5, $10 or $100 on your account page. Surplus credits are used only once the allowance runs out, and they never expire or reset. On yearly billing the allowance still resets every month. A request that costs more than is left of both is refused with 402 usage_exhausted before it runs.

What each request costs

RequestCost
POST /simulate$0.000020000, plus $0.02 per billion amplitude updates: gates × 2qubits, once for each measurement branch. Bloch vectors, expectation values and the density matrix add the amplitude updates they take, at the same rate.
POST /sweepThe /simulate price of every combination, added up
POST /unitary$0.000020000, plus $0.02 per billion matrix-entry updates: gates × 4qubits
POST /render$0.000015000, plus $0.000000500 per gate
POST /parse$0.000010000, plus $0.000000200 per gate
POST /qubiai$0.000005000 when the request is a known recipe. Otherwise by the tokens it used (QubiAI's instructions, your prompt and context in; the plan and any reasoning out) at the prices of its model and effort (Pauli 2.1 or 2.0 Nano, Medium or Deep, Pauli 1.0, Fermi 1.1 or Fermi 1.0), which GET /pricing lists with each entry's model and effort; Nano is usually a fraction of a cent
POST /assistantBy the tokens the answer used (the assistant's instructions, up to five passages of the site and your conversation in; the answer, any reasoning and a circuit repair out) at the same prices as QubiAI's modes, at least $0.000100000. A first question answered before comes from the cache, free
PUT a file$0.000005000, plus $0.000001000 per KB
Other changes: POST, PATCH, PUT, DELETE$0.000002000
Every GET$0.000002000
/usage, /usage/history, /pricing, /estimateFree

Charges are rounded up to the next millionth of a dollar, as they always were; the finer unit is for the rates. A request that fails, whether it has a mistake in it or it was refused, costs nothing.

SimulatingCosts
A Bell pair: 2 qubits, 2 gates$0.000021000
10 qubits, 200 gates$0.000025000
16 qubits, 1,000 gates$0.001331000
21 qubits, 953 gates, the most one request can do at 21 qubits$0.039992000

Every charged answer says what it cost, in dollars to nine places. A JSON answer carries it in its body:

{
  "probabilities": { "00": 0.5, "11": 0.5 },
  ...
  "cost": "0.000021000"
}

and every answer, an SVG image included, carries it in a header, next to what is left:

X-Usage-Cost: 0.000021000
X-Usage-Remaining: 4.999979
POST /estimate prices a request without running it, for free. For a circuit with measurements the final figure depends on how many branches it splits into, so the estimate gives the lowest and the most it could be.

Describing a circuit

Every endpoint that takes a circuit accepts it in either of two forms, or as a file in one of your projects. Use whichever you already have.

As Qubi

{
  "source": "Grover(0b101)"
}

Any Qubi program, run by the simulator's own engine: the whole language, standard library included. The register is as wide as the highest qubit used; pass "qubits" for a wider one.

As a gate list

{
  "qubits": 2,
  "gates": [
    { "type": "H",  "target": 0 },
    { "type": "CX", "target": 1, "controls": [0] },
    { "type": "RZ", "target": 1, "angle": 1.5708 }
  ]
}

Angles here are radians. Swaps take "swapWith" instead of controls.

A gate object

FieldTypeMeaning
typeREQUIREDstringA name from GET /gates. Case does not matter.
targetREQUIREDintegerThe qubit the gate acts on, from 0.
controlsinteger[]Control qubits. Any gate can be given extra controls: X with one control is a CNOT, with two a Toffoli.
swapWithintegerThe other qubit, for the swap family only.
anglenumberRadians. Required for RX, RY, RZ, P and their controlled forms; refused elsewhere.

From a project

{ "project": "4c1e...", "file": "main.qubi" }

Runs a file from one of your projects, and lets it #include the project's other files, the way the editor does: #include lib/oracles.qubi from the project root, or relative to the including file. Send "source" instead of "file" to run a program that is not saved but still includes the project's files.

Limits: 21 qubits; 250,000 gates, counted as they run, so a loop of 10 around 3 gates is 30; 2 billion amplitude updates in one request, which is gates × 2qubits over every measurement branch: at 21 qubits that is 953 gates, at 16 qubits 30,517, and below 13 qubits every gate the gate limit allows; /parse and /render list or draw up to 20,000 gates; request bodies up to 256 KB. A circuit past any of these is refused with a message that says which, and how many would fit, before any of it runs. Answers list up to 4,096 outcomes, the likeliest, and say how many were left out.

Writing Qubi

"source" takes the whole language, run by the same engine as the circuit builder, so a program means exactly what it means there. Functions, variables, loops, conditions, gate definitions and the standard library the editor includes by default all work.

// The standard library is already included: call it by name.
Grover(0b101)                     amplitude amplification for 101
QFT(0..3)                         the quantum Fourier transform on qubits 0 to 3
GHZ(0..2)

// Your own functions, with parameters
function Prep(a, b) {
    H a
    CX [a, b]
}
Prep(0, 2)

// Variables and loops, counted or while-style
n = 3
LOOP n { T 0 }
i = 0
LOOP (i < 3) {
    X 1
    i++
}

// Conditions on what a measurement saw
H 0
MEASURE 0
if (c[0] == 1) {
    X 1
}

// Gates of your own, by matrix
gate NOTG {
    matrix: [0 1; 1 0]
}
NOTG 2

H 0; CX [0, 1]                    a semicolon ends a statement, the same as a new line

The standard library is the simulator's standard/ folder: Grover, QFT, IQFT, QPE, Shor, Deutsch, BV, Bell, GHZ, W, Teleport, Superdense, SwapTest, PhaseOracle, StatePreparation and more. #include standard/Grover.qubi works as it does in the editor, and in a project so does including your own files.

A semicolon only ends a statement at the top level. Inside brackets it belongs to what is there, as in a matrix row, and inside a comment or a string it is text.

Errors come from the editor's own checks and name the line they were found on, and on a line holding several statements, which one: line 1, statement 2. When there is more than one problem, all of them come back in "problems".

Use POST /parse to see exactly what a program comes to: every function, loop and library call expanded into the gates it runs, in order.

Conventions

  • Qubit ordering. Qubit q is bit q of the basis-state index. Outcome labels are written most significant bit first, so q0 is the rightmost character: in "1101" on four qubits, q0 = 1, q1 = 0, q2 = 1, q3 = 1. This is what the simulator prints.
  • Rotations. RX(t) = exp(-i t X / 2), and likewise RY and RZ. P(t) = diag(1, e^{it}). T is a phase of pi/4, S of pi/2.
  • Angles in Qubi. A bare number is always in units of pi, so RY 0 0.5 is a quarter turn. That holds for variables and sweeps alike: t = <0, 0.5, 1> and t = <0..1> mean the same angles for the same numbers. Write pi, deg or rad to say otherwise: RY 0 1.5708rad and RY 0 90deg are the same quarter turn. Programs written for the old #settings CodeAngleUnit line still run: the line is removed and their angles get the matching suffix.
  • Exact results. This is a simulator, so the answer is the state itself: "probabilities" are exact, not estimated from repeated runs. There are no shots and nothing is random, so the same request always gets the same answer. A request that sends "shots" or "seed" is refused rather than quietly ignored.
  • Measurement. MEASURE is followed down every outcome, the way the simulator does it. Each outcome is a branch, a reality, with its exact probability, its collapsed state, and the record of what was measured, which later if (c[i] == 1) conditions read. "probabilities" is then the overall distribution across all of them.

Methods and status codes

The API is REST: a path names a thing, and the method says what to do with it.

MethodDoesAnswers
GET, HEADRead. HEAD is GET without the body.200
POSTMake something, or work something out201 with a Location header for something new; 200 for a result
PUTReplace the whole thing at that path, making it if it is not there201 when made, 200 when replaced
PATCHChange only the fields sent200
DELETERemove it204, with no body
  • A known path asked with a method it does not take answers 405 with an Allow header listing the ones it does.
  • Bodies are JSON with Content-Type: application/json; anything else is 415. The one exception is a file, which can also be sent as its own text.
  • Files carry an ETag. Send it back in If-Match to change a file only if nobody else has since (412 if they have), If-None-Match: * to make a file only if it is not there yet, or If-None-Match with the ETag on a GET to get 304 when it has not changed.
  • Answers are never cached by a shared cache (Cache-Control: no-store). A trailing slash names the same thing as without one.
POST/v1/simulate

Run a circuit on the state-vector engine and return what came out.

FieldTypeMeaning
source, gates or projectREQUIREDThe circuit, in any of its forms.
amplitudesbooleanAlso return complex amplitudes. With measurements there is no single state, so each reality carries its own.
thresholdnumberStates with probability at or below this are left out. Default 1e-9.
blochbooleanEach qubit's Bloch vector: x, y, z, its length (1 when the qubit is pure, less when it is entangled or measured), and the angles theta and phi in radians.
expectationsstring[]Expectation values of Pauli strings, written like outcome labels with qubit 0 last: ["ZZ", "XI", "Y"]. Up to 64.
densityMatrixbooleanThe density matrix, rows and columns in basis-state order, and its purity. Up to 6 qubits.

With measurements, bloch, expectations and densityMatrix describe the whole mixture, every branch weighted by its probability, as the simulator's Data Analysis tab does.

curl https://api.qubibyte.org/v1/simulate \
  -H "Authorization: Bearer $QUBIBYTE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "source": "H 0\nCX [0,1]\nCX [1,2]", "amplitudes": true }'
{
  "qubits": 3,
  "gates": 3,
  "probabilities": { "000": 0.5, "111": 0.5 },
  "amplitudes": {
    "000": { "re": 0.7071067812, "im": 0 },
    "111": { "re": 0.7071067812, "im": 0 }
  },
  "elapsedMs": 0
}

With measurements

{ "source": "H 0\nMEASURE 0\nif (c[0] == 1) {\n  X 1\n}" }
{
  "qubits": 2,
  "gates": 3,
  "probabilities": { "00": 0.5, "11": 0.5 },
  "realities": [
    { "probability": 0.5, "measured": { "0": 0 }, "probabilities": { "00": 1 } },
    { "probability": 0.5, "measured": { "0": 1 }, "probabilities": { "11": 1 } }
  ],
  "elapsedMs": 4
}

Each reality says what was measured, by qubit, and the state that outcome leaves. Up to 256 are listed; when there are more, "realitiesTotal" says how many, and the overall "probabilities" still account for every one of them.

Reading the state

{ "source": "H 0; CX [0,1]", "bloch": true, "expectations": ["ZZ", "XX", "YY"] }
{
  ...
  "bloch": [
    { "qubit": 0, "x": 0, "y": 0, "z": 0, "length": 0, ... },
    { "qubit": 1, "x": 0, "y": 0, "z": 0, "length": 0, ... }
  ],
  "expectations": { "ZZ": 1, "XX": 1, "YY": -1 }
}

A Bell pair: each qubit on its own is at the centre of its sphere, and the correlations are all in the pair.

POST/v1/sweep

Run every combination of a parametric sweep, as the Parametric Sweep tab does. Give variables sets of values with <>: theta = <0.(0.25).1>, g = <H,X,Y>, LOOP <1..5> { }. Several sweeps multiply.

FieldTypeMeaning
source or projectREQUIREDQubi with at least one sweep in it.
statestringA target like "101" or "1x" (x is either): each combination then reports its probability, and the full distributions are left out unless probabilities is true.
probabilitiesbooleanEvery combination's full distribution. On by default without state.
thresholdnumberAs for /simulate.
{ "source": "theta = <0, 0.5, 1>\nRY 0 theta", "state": "1" }
{
  "dimensions": [ { "name": "theta", "values": [0, 0.5, 1] } ],
  "combinations": 3,
  "points": [
    { "values": { "theta": 0 },   "probability": 0 },
    { "values": { "theta": 0.5 }, "probability": 0.5 },
    { "values": { "theta": 1 },   "probability": 1 }
  ]
}

Up to 256 combinations per request. The whole sweep is priced before any of it runs.

POST/v1/unitary

The circuit's matrix, as the Data Analysis tab's Matrices view shows it: column k is what the circuit makes from basis state |k⟩, rows and columns in basis-state order, entries {"re", "im"}. Up to 7 qubits. A circuit with MEASURE has no single unitary and is refused.

{ "source": "H 0" }
{ "qubits": 1, "gates": 1, "unitary": [
  [ { "re": 0.7071067812, "im": 0 }, { "re": 0.7071067812, "im": 0 } ],
  [ { "re": 0.7071067812, "im": 0 }, { "re": -0.7071067812, "im": 0 } ]
] }
POST/v1/parse

Turn a Qubi program into the gates it runs, without running it: every function, loop and library call expanded, in order. Useful for seeing exactly what a program means, or for converting it once into the JSON form.

{ "source": "LOOP 2 { T 0 }\nCP [0,1] 0.5\nMEASURE 0\nif (c[0] == 1) {\n  X 1\n}" }
{
  "qubits": 2,
  "gates": [
    { "type": "T",  "target": 0 },
    { "type": "T",  "target": 0 },
    { "type": "CP", "target": 1, "controls": [0], "angle": 1.5707963268 },
    { "type": "MEASURE", "target": 0 },
    { "type": "X",  "target": 1, "condition": "c[0] == 1" }
  ]
}

Angles are radians. A gate inside an if on a measurement carries the "condition" it runs under; in an else, the condition is negated. Gates you define yourself keep their own names.

POST/v1/render

Draw a circuit as an SVG, in the same style as the circuit builder: coloured tiles on wires, lettered control discs, the qubit index down the left. Drop it into a README, a notebook or a slide.

FieldTypeMeaning
source or gatesREQUIREDThe circuit.
maxColumnsintegerCut the drawing after this many columns, marked with an ellipsis. 1 to 200.
transparentbooleanLeave out the dark background.
formatstring"svg" to get the image itself. Sending Accept: image/svg+xml does the same.
# Straight to a file
curl https://api.qubibyte.org/v1/render \
  -H "Authorization: Bearer $QUBIBYTE_KEY" -H "Accept: image/svg+xml" \
  -H "Content-Type: application/json" -d '{ "source": "H 0\nCX [0,1]" }' -o bell.svg

Without an image request the answer is JSON with the SVG in a "svg" field.

GET/v1/gates

The gate catalogue for the gate list form: every name it accepts, how many controls the name implies, whether it takes an angle, plus the limits and conventions. Qubi source is not limited to these; it takes anything the language does.

{
  "gates": [
    { "name": "H",   "description": "Hadamard.", "controls": 0, "takesAngle": false, ... },
    { "name": "CX",  "description": "Controlled X.", "controls": 1, ... },
    { "name": "RZ",  "takesAngle": true, ... },
    ...
  ],
  "limits": { "qubits": 16, "gates": 5000, "appliedGates": 5000 },
  "conventions": { ... }
}
GET/v1/users/{username}

A public profile: name, handle, bio, links, badge, plan, and follower and following counts, with the profile's "layout" and its "shows": the circuits, Graphics documents, 3D models and Chemistry workspaces the person has put on their profile. Private profiles answer 404, the same as a profile that does not exist.

{
  "profile": { "username": "trent", "displayName": "Trent Rosenthal", ...,
    "badges": [ { "key": "qubi-certified", "kind": "badge", "name": "Certificate of Proficiency", "image": "/images/badges/qubi-certified.svg", ... },
                { "key": "flag-us", "kind": "flag", "name": "Flag of United States of America", "image": "/images/flags/us.svg", ... } ] },
  "layout": { "order": ["forum", "circuits", "graphics", "models", "molecules", "articles", "series", "videos"], "hidden": [] },
  "shows": {
    "circuits": [ { "id": "p_...", "app": "simulator", "title": "Grover Search", "description": "...",
                   "url": "/share/<token>", "qubits": 4, "gateCount": 24, "diagram": { "q": 4, "g": [ ... ] } } ],
    "graphics": [ { "id": "p_...", "app": "graphics", "title": "Lorenz", "url": "/graphics/?share=...", "view": "/graphics/view.html?share=..." } ],
    "models": [ { "id": "p_...", "app": "3d", "title": "Bell pair, printable", "url": "/3d/?share=...", "view": "/3d/view.html?share=..." } ],
    "molecules": [ { "id": "p_...", "app": "molecule", "title": "Water ground state", "url": "/chemistry/?share=...", "view": "/chemistry/view.html?share=..." } ]
  }
}

"badges" are what the person wears under "Member since", in their order: badges earned or given (the Certificate of Proficiency comes from passing the Qubi Certification) and at most one country flag. "image" is a path on qubibyte.org.

Everything in "shows" is a cloud project behind a view-only share link, and "url" is that link, so anything you see you can open. The sections are forum, circuits, graphics, models, molecules, articles, series and videos; "layout" says the order the owner chose and which they hid. A hidden section, or one with nothing in it, is not shown on the page; the API still lists what a hidden section holds.

GET/v1/users/{username}/{section}

One section of a profile, as data. section is one of:

SectionItems
forumTopics started and replies, newest first, with counts (topics, replies, solutions, likes) and more; page with ?before=<at> and ?limit= (up to 50)
circuitsSimulator projects on show, each with its diagram and the share link it opens with (also under circuits, for older clients)
graphicsGraphics documents on show, with url (the link) and view (the page that draws it)
models3D models on show, the same way
moleculesQubibyte Chemistry workspaces on show, the same way
articlesArticles published on Qubibyte under the account: title, url, thumbnail, date, views
seriesSeries, the same way
videosVideos, the same way
followersPeople following the account, up to 20, with total
followingPeople the account follows, the same way
{ "section": "articles", "items": [ { "kind": "article", "title": "...", "url": "/blog/...", "dateLabel": "Sep 2026", "views": 1204 } ] }

Every section is public data: what the profile page shows, whether or not its owner hid the section (see "layout" on the profile). A private profile answers 404.

PUT/v1/users/{username}/follow

Follow someone, as the key's account. Idempotent: following again changes nothing. Answers { "youFollow": true, "followers", "following" } with their counts. Your own account answers 400; more than thirty new follows in a minute, 429.

DELETE/v1/users/{username}/follow

Unfollow. Idempotent too: { "youFollow": false, ... } either way.

GET/v1/me

The account behind the key, as the account page sees it, with the key's id and prefix attached so a script can confirm which key it is holding.

PATCH/v1/me

Change the account. Send any of the fields; the rest are left alone. The rules are the account page's, run by the same code, and a refusal names the field.

{
  "displayName": "Trent Rosenthal",
  "bio": "Building Qubibyte.",
  "username": "trent",
  "links": { "website": "https://qubibyte.org", "github": "https://github.com/trent", "linkedin": "" },
  "avatarId": 7,
  "profilePublic": true,
  "profileLayout": { "order": ["circuits", "forum"], "hidden": [] },
  "apiSpendCaps": { "hour": "5", "day": null }
}
FieldRule
displayNameup to 50 characters: letters, digits, spaces, ' . -; empty clears it
bioup to 400 characters of plain text, newlines allowed; empty clears it
username3 to 20 letters, digits and underscores, unique; 409 if taken. Your profile moves to /user/<new>
linksup to 50 characters each, http(s) only; github must be on github.com, linkedin on linkedin.com; empty clears one
avatarIdone of the sixteen presets, 1 to 16; choosing one removes an uploaded picture
profilePublicfalse hides the whole profile (it answers 404 to everyone but you)
profileLayoutthe sections' order and which are hidden, as on PATCH /me/profile
apiSpendCapsthe safety limits, dollars per hour and per day, $0.01 to $1,000; null is the default

Answers { "user": ... } as GET /me does.

PUT/v1/me/avatar

Your own picture: send the image bytes as the body, with its Content-Type. PNG, JPEG, GIF or WebP, up to 2 MB; the bytes are sniffed, not trusted. Custom pictures come with Plus and Pro (and are open to employees and verified accounts); everyone else has the presets, chosen with avatarId on PATCH /me (403 otherwise). Priced as a file write. Answers the account, whose avatarUrl now points at the new picture.

No Try it panel here: the body is the file's bytes, not JSON. With curl: curl -X PUT -H "Authorization: Bearer $QB_KEY" -H "Content-Type: image/png" --data-binary @me.png https://api.qubibyte.org/v1/me/avatar.

DELETE/v1/me/avatar

Back to the chosen preset. The uploaded picture is deleted.

GET/v1/me/profile

Your profile's "layout" and everything you have put on it, including what is not showing right now and why: a project stays marked when its link is turned off, set to editing or limited to signed-in people, and comes back when the link is view-only for anyone again. Each such item carries a "problem".

PATCH/v1/me/profile

Reorder the sections, or hide some. Send the whole layout; sections left out of "order" go to the end in their default order.

{ "layout": { "order": ["circuits", "models", "forum"], "hidden": ["videos"] } }
GET/v1/me/profile/shows/{section}

Which of your projects could go in circuits, graphics, models or molecules: every project of that app, with its link's state, whether it is already on the profile, and, when it could not be shown as it is, the "problem".

PUT/v1/me/profile/shows/{projectId}

Put one of your projects on your profile. The only way onto a profile is a share link that is view-only and works for anyone, so the project needs one: send { "share": true } to turn a link that is off on that way. A link set to editing or to signed-in people is left alone and refused with 409, so nobody's access is quietly changed. Answers with the section it went in and your "shows".

Needs
circuits, models, moleculesPlus or Pro (sharing a simulator project, a 3D model or a Chemistry workspace)
graphicsPro (sharing a Graphics document)

A profile shows up to twelve in each section. The thirteenth is refused with 409 until one is removed.

DELETE/v1/me/profile/shows/{projectId}

Take a project off your profile: 204. Its share link is left exactly as it was. A project that is not on your profile answers 404.

POST/v1/qubiai

Ask QubiAI (Pauli, its model), as you would in the simulator, and get back its plan: a message and the actions the simulator would carry out. The actions are data, for your own code to act on: set_code with Qubi to put in the editor, load_algorithm, append_gates, run_circuit, switch_tab and the rest.

{ "prompt": "Grover search for 101 on 3 qubits", "context": { "code": "H 0" }, "model": "pauli-2.0", "effort": "deep" }
{
  "message": "Grover |101⟩",
  "actions": [ { "op": "load_algorithm", "name": "grovers", "params": { "numQubits": 3, "target": "101" } } ],
  "via": "recipe",
  "mode": "high",
  "modeName": "Pauli 2.0 Deep",
  "model": "pauli-2.0",
  "effort": "deep",
  "cost": "0.000005000"
}

"context" is optional: the code it should work with, errors, and so on. "model" picks the model and "effort" how hard it thinks (below). qubibyte.org/ai has more on each. "via" says how the plan was made: recipe (a known request, planned without a model) or built-in. Requests are up to 600 characters. Before a request that needs a model, your account must have the most it could cost in its model and effort on hand; it is then charged what it actually used.

modeleffortWho can use it
pauli-2.1nano (the default: fast, and known requests are free recipes), medium or deep (they reason longer, for harder requests, at higher per-token prices). Pauli 2.1 checks its own code with the simulator's engine and repairs itEveryone. The default model
pauli-2.0nano (the default: fast, and known requests are free recipes), medium or deep (both reason first, for harder requests, at higher per-token prices)Everyone
pauli-1.0None: leave effort outEveryone. The first QubiAI
fermi-1.1None: leave effort outEveryone. Our own model, newest release, formally Llama-Fermi 1.1, built with Llama; a request it cannot plan is handed to Pauli 2.1 Nano
fermi-1.0None: leave effort outEveryone. Our own model, formally Llama-Fermi 1.0, built with Llama; a request it cannot plan is handed to Pauli 2.1 Nano

Leave out model and effort for Pauli 2.1 Nano. A pauli-2.1 or pauli-2.0 request without effort gets nano; effort on its own means Pauli 2.1. An unknown model or effort, or an effort for pauli-1.0, fermi-1.1 or fermi-1.0, is 400 invalid_request. Answers name both, with "effort": null for a model without efforts. The older "mode" still works as it did: low21 (the default), medium21 and high21 are Pauli 2.1 Nano, Medium and Deep, low, medium and high are Pauli 2.0's, pauli1 is Pauli 1.0, fermi11 is Fermi 1.1 and fermi is Fermi 1.0; a request without one is Pauli 2.1 Nano. Send mode together with model/effort only if they name the same thing; otherwise it is 400. Answers keep mode and modeName as well.

POST/v1/assistant

Ask the Qubibyte Virtual Assistant, the chat on qubibyte.org, powered by Pauli. It answers questions about Qubibyte and quantum computing, finds the right page, writes code in Qubi and other languages, and builds circuits. Answers are Markdown. It reads the public pages of the site before answering, and every circuit it writes is compiled by the simulator's own engine before you get it. It knows only what the public site says and what you tell it: nothing about your account or anyone else's.

{
  "messages": [
    { "role": "user", "content": "What is a GHZ state?" },
    { "role": "assistant", "content": "A GHZ state is ..." },
    { "role": "user", "content": "Build one on 3 qubits" }
  ],
  "model": "pauli-2.0",
  "effort": "medium",
  "stream": false
}
FieldWhat it is
messagesThe conversation, oldest first, ending with your question ("role": "user"). Roles are user and assistant only. Your question is up to 2,000 characters; up to 12,000 characters of history may come before it, in up to 40 messages. Long conversations are trimmed on the server: the first question and the newest messages are kept.
model, effortThe same as QubiAI's, all open to everyone: pauli-2.1 (the default) or pauli-2.0 with effort nano (the default), medium or deep; pauli-1.0, fermi-1.1 or fermi-1.0 (a chat model writes and Fermi builds the circuits) with no effort. Leave both out for Pauli 2.1 Nano. Anything else is 400.
modeLegacy, still accepted: low21 (the default), medium21, high21 (Pauli 2.1 Nano, Medium, Deep), low, medium, high (Pauli 2.0 Nano, Medium, Deep), pauli1 or fermi. If sent with model/effort they must agree, or it is 400.
streamtrue (the default): server-sent events as the answer is written. false: one JSON object when it is done.
pageOptional: { "path": "/pricing/", "title": "Pricing" }, the page your user is on, as a hint.
conversationIdOptional: your own id for the conversation, up to 100 letters, digits, - and _. Given back in the answer; one is made when you leave it out.

Streamed answers

With "stream": true the answer is text/event-stream. Each event has a name and one line of JSON. Lines that start with : are keep-alives while a model reasons; skip them.

event: meta
data: {"conversationId":"7c0e...","mode":"medium","modeName":"Pauli 2.0 Medium","model":"pauli-2.0","effort":"medium"}

event: delta
data: {"text":"A GHZ state puts every qubit "}

event: delta
data: {"text":"in one shared superposition:\n```qubi\nH 0\nCX [0,1]\nCX [1,2]\n```"}

event: done
data: {"text":"A GHZ state puts every qubit ...","navigate":null,"circuits":[{"qubi":"H 0\nCX [0,1]\nCX [1,2]","valid":true,"error":null,"qubits":3,"diagram":{"q":3,"g":[...]}}],"sources":[{"url":"/qubi/examples/ghz-state/","title":"GHZ State"}],"costNanos":1416000,"cost":"0.001416000","ms":2310,"cached":false}
EventData
metaFirst: conversationId, mode, modeName, model, effort.
deltatext: Markdown to append, as it is written.
doneLast: the finished answer (below). Show its text in place of the deltas you joined: it is the checked version, with links and circuits made safe and any repaired circuit put in.
error{ "error", "code" }, in place of done, when the answer could not be finished (model_unavailable, assistant_interrupted). It costs nothing, or no more than the flat $0.003 when an answer stopped part way.

The finished answer

With "stream": false you get this as one object, with conversationId, mode, modeName, model and effort beside it:

{
  "conversationId": "7c0e...", "mode": "medium", "modeName": "Pauli 2.0 Medium", "model": "pauli-2.0", "effort": "medium",
  "text": "A GHZ state ...\n```qubi\nH 0\nCX [0,1]\nCX [1,2]\n```",
  "navigate": null,
  "circuits": [ { "qubi": "H 0\nCX [0,1]\nCX [1,2]", "valid": true, "error": null, "qubits": 3, "diagram": { "q": 3, "g": [ ... ] } } ],
  "sources": [ { "url": "/qubi/examples/ghz-state/", "title": "GHZ State" } ],
  "costNanos": 1416000, "cost": "0.001416000",
  "ms": 2310, "cached": false
}
FieldWhat it is
textThe answer in Markdown. Links are to pages of qubibyte.org only, as site paths (/pricing/); an outside address you asked for is plain text.
circuitsEvery ```qubi block, compiled by the simulator's engine: valid, the engine's error when it does not build, qubits, and for a valid one its diagram (the drawing the Forum's circuit embeds use: q qubits and gates g with type, column, target and controls). A circuit that does not build is repaired once by the same model; "repaired": true marks one that was.
navigate{ "path", "title", "auto": true } when the question asked to be taken to a page ("take me to pricing"), otherwise null. Always a public page of qubibyte.org; the site's chat goes there by itself.
sourcesThe pages of the site the answer was based on, up to three.
cost, costNanosWhat the answer was charged, in dollars (nine places) and billionths.
cachedtrue when a first question (no history) had been answered in this mode before and the answer came from the cache, for free. Cached answers are kept for a day.
truncatedPresent and true when the answer reached its mode's length limit.

Pricing and limits

Charged by the tokens the answer used, at the same per-token prices as QubiAI's modes, at least $0.0001: the assistant's instructions (about 1,700 tokens), up to five passages of the site (up to about 1,800) and your conversation in; the answer, any reasoning and a circuit repair out; and the look-up of the site's pages, a few billionths of a dollar. A short answer in Nano is usually about a tenth of a cent. Before it starts, your account must have the most the request could cost on hand (both models, full-length answers and a repair). That is held while the answer is written and settled to the real cost at the end, so an answer you stop reading early is still charged only for what was used. GET /pricing lists each mode's prices and limits under assistant, and POST /estimate with "endpoint": "assistant" gives the most a request could cost.

ModeLongest answer (reasoning included)
low211,200 tokens
medium213,000 tokens
high215,000 tokens
low700 tokens
medium2,500 tokens
high4,000 tokens
pauli1700 tokens
fermi1,200 tokens

Up to 20 requests a minute per account, on top of your key's own limit, shared with the chat on the site; and a daily ceiling shared with QubiAI. The usage history lists each answer as POST /v1/assistant · Pauli 2.0 Medium (the mode), never with what was asked.

StatusCodeWhen
400invalid_requestMessages missing or too long, a role other than user and assistant, the last message not yours, an unknown mode
402payment_requiredLess on hand than the most the request could cost. Try a lower effort or Pauli 2.0 Nano (which needs much less), or buy surplus credits
413too_largeA body over 64 KB
429rate_limitedMore than 20 a minute (or your key's limit); see Retry-After
429spend_capYour account's API safety limit
429qubiai_daily_limitThe daily or monthly ceiling shared with QubiAI
503assistant_unavailableThe assistant could not be reached; nothing was charged
curl -N https://api.qubibyte.org/v1/assistant \
  -H "Authorization: Bearer $QUBIBYTE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Make a Bell pair and explain it"}],"model":"pauli-2.0","effort":"nano"}'
const res = await fetch('https://api.qubibyte.org/v1/assistant', {
  method: 'POST',
  headers: { Authorization: `Bearer ${key}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ messages: [{ role: 'user', content: 'What is Qubi?' }], stream: false }),
});
const answer = await res.json();   // answer.text, answer.circuits, answer.cost
GET/v1/me/cloud

Qubibyte Cloud is your account's storage, shared by everything you keep on the site. It is one allowance with a folder for each app, as qubibyte.org/cloud shows it: qcs (the simulator's projects), graphics (Qubibyte Graphics documents), 3d (Qubibyte 3D models), molecule (Qubibyte Chemistry workspaces) and items (Other files). Each folder says what it holds and how much of the allowance it takes.

{ "cloud": {
    "plan": "pro", "used": 184320, "quota": 104857600, "writable": true, "readable": true,
    "folders": {
      "qcs":      { "label": "QCS",         "unit": "project",  "bytes": 122880, "count": 7 },
      "graphics": { "label": "Graphics",    "unit": "document", "bytes": 40960,  "count": 3 },
      "3d":       { "label": "3D",          "unit": "model",    "bytes": 20480,  "count": 2 },
      "molecule": { "label": "Chemistry",   "unit": "workspace", "bytes": 1024,   "count": 1 },
      "items":    { "label": "Other files", "unit": "file",     "bytes": 0,      "count": 0 }
    }
} }
PlanQubibyte Cloud
Plus25 MB
Pro100 MB

writable is false on Free and in the week after a paid plan ends; then everything is still readable (and deletable) until deletedAfter, a Unix time, and emptied after it. Subscribing again within the week keeps it all.

GET/v1/me/projects

Your projects: named sets of files kept in Qubibyte Cloud. Every app on the site keeps its work as projects, each in its own folder, and ?app= picks the folder:

appFolderWhat a project holds
simulatorQCSWhat the simulator syncs (the default, so older clients see what they always saw): Qubi code, notes, and the spreadsheets, slides and videos kept with it (.qsp, .qsl, .qvid, as JSON). A file written here shows up in the simulator on every device, and the other way round.
graphicsGraphicsOne Qubibyte Graphics document: document.qgfx. See Graphics documents.
3d3DOne Qubibyte 3D model: model.q3d. See 3D models.
moleculeChemistryOne Qubibyte Chemistry workspace: workspace.qmol. See Chemistry workspaces.
allEvery project, with its "app".
{ "projects": [ { "id": "4c1e...", "app": "simulator", "name": "Grover experiments", "files": 3, "size": 2048, "revision": 12, ... } ],
  "storage": { "used": 184320, "quota": 104857600, "folders": { ... } }, "limits": { ... } }

Up to 200 projects of up to 500 files; a file is up to 8 MB. Paths use / for folders; names cannot start with a dot. standard/ is the built-in library and cannot be written to. Each project has a "revision" that goes up with every change, so you can tell whether it moved since you last read it.

Qubibyte Cloud is shared by everything you keep in it across the site; projects are part of it. If a paid plan ends, it stays readable (and deletable) for one week, then it is emptied. Subscribing again within the week keeps them. Copies in the simulator stay in the browser either way.
POST/v1/me/projects

Make a project: 201 with its Location. "app" says which folder it belongs to (simulator when left out). Without "files" it starts with an empty main.qubi, as a new simulator project does.

{
  "name": "Grover experiments",
  "files": [
    { "path": "main.qubi", "content": "#include lib/oracle.qubi\nOracle(0)" },
    { "path": "lib/oracle.qubi", "content": "function Oracle(q) {\n    Z q\n}" }
  ]
}

A model for Qubibyte 3D, which then opens at qubibyte.org/3d/?doc={project} and is listed under 3D on qubibyte.org/cloud:

{
  "app": "3d",
  "name": "Bell pair",
  "files": [ { "path": "model.q3d", "content": "{ \"format\": \"qubibyte-3d\", \"version\": 1, \"objects\": [ ... ] }" } ]
}
GET/v1/me/projects/{project}

One project and its file list: each file's path, size and ETag. GET /v1/me/projects/{project}/files is the list alone.

PATCH/v1/me/projects/{project}

Rename a project or change its description.

{ "name": "Grover, tuned", "description": "Iterations against success probability." }
DELETE/v1/me/projects/{project}

Delete a project and every file in it: 204. A copy you have opened in a simulator stays in that browser.

GET/v1/me/projects/{project}/files/{path}

One file, as JSON with its "content", or the text itself when asked for with Accept: text/plain. Either way the ETag header says which version it is.

curl https://api.qubibyte.org/v1/me/projects/$PROJECT/files/lib/oracle.qubi \
  -H "Authorization: Bearer $QUBIBYTE_KEY" -H "Accept: text/plain"
PUT/v1/me/projects/{project}/files/{path}

Write a file, whole: 201 when it is new, 200 when it replaced one. Send { "content": "..." }, or the text itself with Content-Type: text/plain. Folders in the path are made as needed.

# Upload a file from disk, only if nobody changed it since you read it
curl -X PUT https://api.qubibyte.org/v1/me/projects/$PROJECT/files/main.qubi \
  -H "Authorization: Bearer $QUBIBYTE_KEY" -H "Content-Type: text/plain" \
  -H 'If-Match: "3f2a9c..."' --data-binary @main.qubi
DELETE/v1/me/projects/{project}/files/{path}

Delete a file: 204. Takes If-Match as PUT does.

Graphics documents

A project with "app": "graphics" is one Qubibyte Graphics document: the file document.qgfx, the JSON that qubibyte.org/graphics saves (its blocks, wires and keyframes). Write it through PUT .../files/document.qgfx and Graphics opens the new version on every device; a document made in Graphics can be read back the same way. Graphics keeps its own copy in the browser too, and when both change it keeps both rather than losing either. The document's meta.title is what Graphics names it; the project's name follows it.

3D models

A project with "app": "3d" is one Qubibyte 3D model: the file model.q3d, the JSON that qubibyte.org/3d edits. Write it and the model opens at /3d/?doc={project}; models made in the editor read back the same way, so a script can build or change a scene and a person can carry on from there. Anything the file leaves out takes its default, and anything out of range is brought back into range when it opens; the editor writes it back in this exact form (one object a line).

{
  "format": "qubibyte-3d", "version": 1,
  "meta":   { "title": "Bell pair", "description": "" },
  "scene":  { "background": "theme", "shading": "flat", "edges": true, "grid": true, "axes": false, "ambient": 0.9, "sun": 1.6 },
  "camera": { "position": [7, 6, 9], "target": [0, 0.5, 0], "fov": 45 },
  "objects": [
    { "id": "g1", "type": "group", "name": "Circuit" },
    { "id": "w0", "type": "wire", "parent": "g1", "position": [2, 1.3, 0], "params": { "length": 4 } },
    { "id": "h",  "type": "gate", "parent": "g1", "position": [1.5, 1.3, 0], "color": "#a855f7", "params": { "glyph": "H" } },
    { "id": "q",  "type": "qubit", "position": [-2, 1, 0], "params": { "theta": 90, "phi": 0 } }
  ]
}

Every object has id (letters, digits, _ and -, up to 32, unique), type, name, parent (another object's id, or null; an object's position, rotation and scale are relative to its parent), position in scene units (a gate is about 1 across), rotation in degrees, scale, color (#rrggbb), opacity (0 to 1), visible, locked, wireframe, metalness and roughness (0 to 1), glow (0 to 2), and params for its type:

typeparams (defaults)
groupnone: a collection that holds other objects (they move, hide and lock with it)
boxwidth 1, height 1, depth 1
sphereradius 0.5
cylinderradiusTop 0.5, radiusBottom 0.5, height 1, segments 32
coneradius 0.5, height 1, segments 32
torusradius 0.6, tube 0.2, arc 360
planewidth 2, height 2
texttext "Label", size 0.5, billboard true, align center|left|right
qubitradius 0.6, theta 0, phi 0 (degrees on the Bloch sphere), axes true, arrowColor "#f97316"
gateglyph "H" (up to 12 characters), size 0.8, depth 0.8
wirelength 6, radius 0.04 (along x)
controlradius 0.14, rod 0 (a rod of this length along y), rodRadius 0.03
targetradius 0.32, tube 0.05 (the ⊕ of a CNOT)
measuresize 0.8, depth 0.8
ionradius 0.18, glowSize 2.2
circuitA whole circuit from a Qubi program, built by the simulator's own 3D previewer (Export → 3MF in the simulator), in printed millimetres: source (the program, up to 60,000 characters; the standard library is built in), includes (files it may #include, as a JSON object of path to text), and the previewer's options: plate, qubitLines, labels, functionHeaders, annotations, connectAuxiliaries, extendLinesPastGates, multiColor (true), showWireEnds, bevelGates, separateGates (false), fitTolerancePct 3, gateSize 8, scale 1, scaleZ 1, fontFamily "Sans", fontScale 1, extrude 0.9, labelGap 4.5, annotGap 8.5, fnGap 1.2. The editor exports it as a 3MF with a colour per part.

A model holds up to 3,000 objects; names are up to 80 characters, text up to 200, the title up to 120. scene.background is "theme" (the site's light or dark) or a colour; scene.shading is "flat" (solid colours with edge lines, as the simulator's previewer draws) or "lit", and scene.edges turns the edge lines off. Share links (/3d/?share=…, made in the editor: view with Plus, edit together with Pro) show the model turning when pasted into a Forum post. The endpoints that take a circuit do not read models; to build a circuit as a model, give the editor's Build from Qubi the program (pasted, from a QCS project, or from a file).

Chemistry workspaces

A project with "app": "molecule" is one Qubibyte Chemistry workspace: the file workspace.qmol, the JSON that qubibyte.org/chemistry saves. Write it and the workspace opens at /chemistry/?doc={project}, listed under Chemistry on qubibyte.org/cloud. A workspace names what it is about (a molecule, a protein, a peptide or an element), how it is shown, the settings of each tab, and the results of the last runs, so a shared workspace opens with its charts filled. It never holds a state vector.

{
"format":"qubibyte-molecule","v":1,
"meta":{"title":"Water ground state","notes":""},
"subject":{"kind":"molecule","ref":"pc962"},
"view":{"mode":"3d","tab":"ground","style":"ballstick","labels":"none","hydrogens":"implicit","camera":null},
"hamiltonian":{"basis":"STO-3G","mapping":"jw","taper":true,"active":{"orbitals":[1,2,3,4,5,6],"electrons":8},"charge":null,"multiplicity":1,"bond":null},
"vqe":{"ansatz":"excitations","optimizer":"lbfgs","maxIter":300,"tol":0.000001,"layers":1,"qubi":null,"result":{"energy":-75.0121,"params":[...],"history":[...],"iterations":212,"ms":18400,"at":"2026-10-20T14:02:11Z"},"curve":null},
"dynamics":{"method":"trotter2","dt":0.05,"steps":200,"start":"hf","quench":0.5,"reference":null,"result":null},
"fold":{"seq":"APRLRFY","model":"tetra","table":"mj","alpha":0.25,"layers":2,"maxIter":300,"restarts":3,"seed":1,"init":"random","result":null},
"drug":{"complex":null,"selectedResidues":[],"radius":4,"fragment":null},
"measurements":[{"atoms":[0,1],"kind":"distance","value":0.9572}]
}

The page writes one top-level section a line, in this order, so two people editing different sections live never touch the same line. Any section or field may be left out and takes its default (a new workspace is water on the Structure tab, with L-BFGS, Trotter 2 from the Hartree-Fock state, and a 4 angstrom contact radius). Unlike a 3D model, a value out of range is not brought back into range: the file is refused with a message that names the field, such as vqe.maxIter must be a whole number from 1 to 100000.

FieldValues
metatitle up to 120 characters, notes up to 4,000
subject{"kind":"molecule","ref":"pc962"} (a molecule from the library, by id: pc and its PubChem CID), {"kind":"pdb","id":"1HSG"} (a protein from the PDB), {"kind":"peptide","seq":"APRLRFY"} (up to 40 one-letter amino acids), {"kind":"element","symbol":"O"}, or {"kind":"inline", ...}: your own molecule of up to 5,000 atoms with name, atoms (element symbols), coordinates in angstrom (3D xyz, 2D xy, or both), bonds as [atom, atom, order 1 to 3], charges as [atom, formal charge] and the total charge
viewmode 2d or 3d, tab structure, hamiltonian, ground, dynamics, folding or drug, style ballstick, sticks, spacefill, wire, cartoon, tube or atoms, labels none, element or index, hydrogens implicit or all, camera up to 16 numbers or null
hamiltonianbasis STO-3G, 6-31G or cc-pVDZ, mapping jw (Jordan-Wigner), parity or bk (Bravyi-Kitaev), taper true or false, active null (chosen for you) or {orbitals, electrons, frozen} where orbitals is a list of orbital indices or a count, charge -20 to 20, or null for the molecule's own charge (the default), multiplicity 1 to 9, bond null (the record's own geometry, the default) or a bond length r in angstrom from the molecule's PennyLane bond-length series
vqeansatz excitations, hea or ops (your own circuit, from qubi: a Qubi program of up to 60,000 characters), optimizer lbfgs (L-BFGS, the default), adam, spsa, nelder-mead or cobyla, maxIter 1 to 100,000, tol 1e-14 to 1, layers 1 to 50, result, curve null or the dissociation curve of a bond-length series, an object of plain lists with one entry per bond length (r, vqe, hf, exact) and the series it came from
dynamicsmethod trotter1, trotter2 or exact, dt 0.0001 to 10 (atomic units of time), steps 1 to 5,000, start hf (the Hartree-Fock state, the default), excite (Hartree-Fock with the HOMO's alpha electron moved to the LUMO), vqe (the ansatz at the stored VQE parameters), quench (Hartree-Fock evolved under the Hamiltonian with its two-electron integrals scaled by quench) or a bit string of up to 30 bits such as "0011" (qubit 0 rightmost), quench -5 to 5 (default 0.5), reference true or false to compare with the exact evolution, or null (the default) to compare up to 12 qubits, result
foldseq up to 40 one-letter amino acids, model tetra (the tetrahedral lattice of Robert et al. 2021) or hp2d, table mj (Miyazawa-Jernigan) or hp, alpha 0 to 100, layers 1 to 8, maxIter 1 to 5,000, restarts 1 to 20, seed 0 to 2,147,483,647, init random or plus, result
drugcomplex a PDB ID or null, selectedResidues up to 500 residue numbers, radius the contact distance in angstrom, 2 to 8 (default 4), fragment
measurementsUp to 200, each of 2 atoms (a distance in angstrom), 3 (an angle in degrees) or 4 (a dihedral), with its value

A result is plain data: objects, lists, numbers, short text, true, false and null, at most six levels deep. Energies are in hartree. A list called history keeps its last 2,000 points, rounded to 1e-9. A workspace is up to 1,000,000 characters; the page warns at 600,000. Share links (/chemistry/?share=…, made on the page: view with Plus, edit together with Pro) show the molecule and its stored results when pasted into a Forum post.

GET/v1/forum

The Forum as your account sees it: every category with its topic and post counts, its three most recent topics, and whether you may start topics in it (canPost), plus the latest topics across the Forum. Also GET /v1/forum/latest (?sort=latest|new|top, ?page=) and GET /v1/forum/search?q=, which takes category, author, solved=yes|no and sort.

The API posts as your account under the Forum's own rules, run by the same code as the site: who may post where, closed topics, the restricted words, and the same posting pace as the site. Going faster answers 429 with code: "slow_down" and a Retry-After header.

GET/v1/forum/categories/{slug}

A category's topics, 25 a page. ?sort=latest|new|top, ?filter=solved|unsolved|open, ?page=. Categories: announcements, general, simulators, tools, quantum-computing, bugs-features.

GET/v1/forum/topics/{id}

A topic, its replies in order, the solution if one is marked, and what your account may do with it (can.reply, can.close, can.markSolution). Reading through the API does not count as a view. GET /v1/forum/users/{username} is someone's Forum activity, newest first.

POST/v1/forum/categories/{slug}/topics

Start a topic: 201 with the topic. Posts use a small Markdown: **bold**, *italic*, `code`, fenced blocks (```qubi for Qubi), quotes, lists and links. A line [circuit:{id}] embeds a circuit (see embeds).

{
  "title": "Grover on three qubits",
  "body": "Here it is:
[circuit:3f9a1c0e7b2d4a61]",
  "closed": false
}
FieldLimit
title6 to 120 characters
bodyup to 10,000 characters
closedoptional; true starts the topic with replies turned off
POST/v1/forum/topics/{id}/replies

Reply: {"body": "...", "replyTo": "<post id>"}, where replyTo is optional. 201 with the new reply's id and the topic. PATCH /v1/forum/posts/{id} edits your reply ({"body"}) and DELETE removes it.

PATCH/v1/forum/topics/{id}

Change your topic. Send any of: title and body; closed (true or false) to turn replies off or on; solutionPostId to mark a reply as the solution, or null to unmark it, in categories that have solutions. A solution is a reply from someone else. DELETE removes the topic and its replies.

PUT/v1/forum/likes/{target}

Like a topic (t:{id}) or a reply (p:{id}); DELETE unlikes. Answers {"liked", "likes"}. Your own posts cannot be liked.

POST/v1/forum/embeds

Turn a Qubi program into a circuit to embed: {"title": "Bell pair", "source": "H 0 CX [0,1]"}. The program is run by the simulator's engine and the circuit drawn from it; the answer's circuit.id goes in a post as [circuit:{id}]. The same program twice is the same embed. GET /v1/forum/circuits/{id} reads one back, source included.

POST/v1/forum/uploads?name=shot.png

No Try it panel here: the body is the file's bytes, not JSON. The curl line under any other panel shows the shape; send the file with --data-binary @shot.png and Content-Type set to its type.

Attach a file: send its raw bytes as the body. PNG, JPEG, GIF, WebP, PDF, and text files such as .qubi, .txt, .json and .csv. A file over the size allowed answers 413, and too much in a day 429. The answer's url goes in a post as ![name](url) for an image or [name](url) for a file. Attachments not used in a post within a day are removed.

GET/v1/me/notifications

Your unread notifications, newest first: follows, likes, replies, mentions (@you in a post), solutions and announcements, grouped so one busy post is one item (actor and others). POST /v1/me/notifications/{id}/read reads one; POST /v1/me/notifications/dismiss dismisses them all.

GET/v1/usage

This period's allowance, what is used of it, the surplus credits on the account, and when the allowance resets. Free.

{
  "plan": "plus",
  "usage": {
    "period": { "start": 1790273617, "end": 1792865617 },
    "allowance": "5.000000000", "used": "3.050000000", "allowanceRemaining": "1.950000",
    "surplus": "10.000000000", "available": "11.950000000",
    "nanos": { "allowance": 5000000000, "used": 3050000000, ... },
    "micros": { "allowance": 5000000, ... }
  }
}

Amounts are dollars as strings to nine places, and again as whole billionths under "nanos" for arithmetic ("micros", millionths, is kept for older clients). "surplus" is the surplus credits.

GET/v1/usage/history

What each request cost, newest first, 50 at a time: QubiAI requests by mode, charged API calls by endpoint (its route pattern, never ids or anything sent), and credit coming in, such as surplus credits you buy. The same list as See Usage History on your account page. Free.

{
  "items": [
    { "at": 1791260000, "kind": "qubiai", "label": "Pauli 2.0 Medium", "amount": "-0.001814000", "nanos": -1814000 },
    { "at": 1791259000, "kind": "api", "label": "POST /v1/simulate", "amount": "-0.000021000", "nanos": -21000 },
    { "at": 1791250000, "kind": "credit", "label": "Credit purchase", "amount": "5.000000000", "nanos": 5000000000 }
  ],
  "next": 1791240001
}

"kind" is qubiai, api or credit. Amounts are negative for what was spent and positive for credit. For the next page, send ?before= with the "next" you were given; "next" is null at the end. History is kept for about 13 months.

Requests made since October 2026 also carry "meta", how they were answered and priced: "source" (simulator, assistant or api), and for QubiAI and the assistant the "model" and "effort", "via" (model, recipe, fallback, salvaged, cached…), "calls" (each Workers AI model called, with its prompt and completion tokens, neurons and raw cost in "rawNanos"), the totals "neurons" and "rawNanos", the "markup" applied, "costNanos", "chargedNanos", "minimum" (the $0.0001 minimum applied), "ms" and "requestId". Workers AI bills $0.011 per 1,000 neurons. Never what was asked or answered. Older rows have no "meta".

GET/v1/pricing

The prices above, as data: every rate in billionths of a dollar (and in millionths, for older clients), the plan allowances, the credit packs and worked examples. Free.

POST/v1/estimate

What a request would cost, without running it or charging for it. Send "endpoint" with the body you would send there.

{ "endpoint": "simulate", "source": "H (0..11); LOOP 200 { T 0 }; MEASURE (0, 1, 2)" }
{
  "endpoint": "simulate",
  "qubits": 12, "gates": 215,
  "cost": "0.000038000", "costNanos": 38000,
  "upTo": "0.000161000", "upToNanos": 161000,
  "available": "4.999979",
  "affordable": true
}

"endpoint" is "simulate", "sweep", "unitary", "render", "parse", "qubiai" or "assistant" (with its messages and model/effort; for "qubiai" its prompt and model/effort; the answer names the mode, model and effort it priced). "upTo" appears only when the price can come out higher (measurement branches, or QubiAI needing a model); the charge is never more than it.

Errors

Every error is JSON with the same two fields, and the message is written to be read: it names the gate, the line, or the limit.

{ "error": "gates[3]: control 1 is also the target", "code": "invalid_circuit" }
StatusCodeWhen
400invalid_jsonThe body is not JSON.
400invalid_requestA field is missing or out of range.
400invalid_circuitA gate is wrong: unknown name, bad qubit, missing angle, too many of something.
400qubi_errorThe Qubi could not be run. Includes "line", "statement" when the line holds several, and "problems" when there is more than one.
401unauthorizedNo key, an unknown key, or one that has been replaced.
402plan_requiredThe key's account is on the Free plan.
402usage_exhaustedThe request costs more than is left of this period's allowance and your surplus credits. The message says both amounts and when the allowance resets.
400invalid_pathA file path with .., characters a path cannot have, or an extension a project cannot hold.
403read_onlyA write to standard/, the built-in library.
404not_foundNo such profile, circuit, project, file or endpoint.
405method_not_allowedThe path exists but does not take that method. See Allow.
409limit_reachedTwelve circuits already published, or as many projects or files as an account or project holds.
409conflictA project or circuit by that name already exists.
409live_sessionThe project is shared and open in a live session in the simulator, which saves it while people edit it together. Its files cannot be changed from outside until everyone has closed it; renaming and deleting still work. liveUntil says when the session's hold lapses if it is not renewed.
403cloud_read_onlyThe plan has ended: cloud projects can be read and deleted for a week, not changed. The message gives the date they are deleted.
412precondition_failedIf-Match or If-None-Match did not hold: the file changed, or already exists.
413too_largeA body over 256 KB (8 MB for a file), or a file past 8 MB.
413quota_exceededThe write would take the account past its Qubibyte Cloud storage: 25 MB on Plus, 100 MB on Pro. The message says how much is left.
415unsupported_media_typeA body that is not JSON.
429rate_limitedOver the per-minute limit, or QubiAI's built-in model asked more than once in 10 seconds. See Retry-After.
500internalOur fault. The message never includes internal detail.

Versioning

The version is in the path. Fields and endpoints are added without notice; nothing already documented is removed or renamed within /v1. Every response carries the exact build in an X-API-Version header. 1.1 added projects and files, sweeps, unitaries, state analysis, QubiAI and the REST conventions above; DELETE now answers 204 with no body.

Treat your key like a password. It is never sent anywhere but the Authorization header, over HTTPS, and if it ends up in a repository, use Replace Key on your account page: the old key stops working at once.