{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roroquantum-com/json-schema/roroquantum-com-run-request-schema.json",
  "title": "RunRequest",
  "description": "The body of `POST /v1/runs` and `POST /v1/runs/quote`, and each item of `POST /v1/runs/batch`.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roroquantum-com-openapi.yml#/components/schemas/RunRequest",
  "type": "object",
  "required": [
    "machineTargetId",
    "shots",
    "qasm"
  ],
  "properties": {
    "machineTargetId": {
      "type": "string",
      "description": "The target's `targetId` (codename). `targetId` below is an accepted alias; send one or the other (both only if they agree)."
    },
    "targetId": {
      "type": "string",
      "description": "Alias for `machineTargetId` — same meaning, same value."
    },
    "shots": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000000,
      "default": 1024,
      "description": "Also bounded by the machine's own `minShots`..`maxShots` (see properties)."
    },
    "qasm": {
      "type": "string",
      "minLength": 1,
      "description": "OpenQASM 2.0 source for the circuit. A run must carry a circuit: omitting the field is not\nrejected server-side (the simulators execute a demo Bell circuit and charge for it), which is\nwhy every SDK refuses to submit without one.\n"
    },
    "tags": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional origin labels for an application submitting on behalf of its own users (opaque ids\nonly, e.g. `{\"user\": \"u_42\", \"job\": \"nightly\"}`). Stored for the operator view, never billed on,\nnever used for authorisation, and never echoed back — a run's `tags` cannot be read from the API.\nInvalid entries are dropped, not rejected; a label can never fail a paid run.\n"
    },
    "resilience": {
      "nullable": true,
      "allOf": [
        {
          "$ref": "#/$defs/Resilience"
        }
      ],
      "description": "Optional error mitigation for this run. Absent (or level 0 with nothing explicit) is a plain run at the plain price."
    }
  },
  "$defs": {
    "Resilience": {
      "type": "object",
      "description": "Error mitigation requested for a run. `level` is sugar — `1` = `{readout: true}`, `2` = `{readout: true,\nzne: {scales: [1,3,5], extrapolator: linear}}` — and explicit fields override it. Level 1 is TENSORED\nper-qubit readout mitigation (not TREX); level 2 adds zero-noise extrapolation by global unitary folding.\nA request a machine does not offer is refused (quote `validationError` == submit 400, byte for byte).\nUnknown fields are refused with a 400, not ignored: a misspelled field would silently change the price.\n",
      "additionalProperties": false,
      "properties": {
        "level": {
          "type": "integer",
          "enum": [
            0,
            1,
            2
          ]
        },
        "readout": {
          "type": "boolean",
          "description": "Two calibration circuits (all-zero and all-one) measured in the same run, on the same classical bits."
        },
        "zne": {
          "$ref": "#/$defs/Zne"
        },
        "dd": {
          "type": [
            "string",
            "null"
          ],
          "description": "Provider-executed dynamical decoupling. Not offered on any machine yet — refused with the machine's reason."
        },
        "twirling": {
          "type": "boolean",
          "description": "Provider-executed twirling. Not offered on any machine yet — refused with the machine's reason."
        }
      }
    },
    "Zne": {
      "type": "object",
      "description": "Zero-noise extrapolation. Each scale k runs the circuit folded to k× its length and is billed k×. Unknown fields are refused with a 400.",
      "additionalProperties": false,
      "properties": {
        "scales": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "minItems": 2,
          "maxItems": 4,
          "default": [
            1,
            3,
            5
          ],
          "description": "Odd, strictly increasing, starting at 1, each at most 7."
        },
        "extrapolator": {
          "type": "string",
          "enum": [
            "linear",
            "richardson"
          ],
          "default": "linear",
          "description": "`richardson` only with an `observable`."
        },
        "observable": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[ZI]+$",
          "description": "A Z/I string; its rightmost character is the rightmost character of a counts key; a Z on a classical bit the circuit never measures is refused. Null → histogram mode (a heuristic, extrapolated outcome by outcome)."
        }
      }
    }
  }
}