{
  "components": {
    "headers": {
      "ETag": {
        "description": "A hash of the rendered document. Send it back as If-None-Match and an unchanged feed answers 304.",
        "schema": {
          "type": "string"
        }
      },
      "PAYMENT-REQUIRED": {
        "description": "The 402 challenge, base64-encoded PaymentRequired. The response-body challenge without the body-only eip712 signing document; a v2 client reads this.",
        "schema": {
          "format": "byte",
          "type": "string"
        }
      },
      "PAYMENT-RESPONSE": {
        "description": "Base64-encoded Settlement protocol receipt: success, transaction, network (CAIP-2), optional payer/errorReason. Sent on successful payments when the network is known; omitted for historical records without network evidence. Application body tx fields are unchanged.",
        "schema": {
          "format": "byte",
          "type": "string"
        }
      },
      "Referrer-Policy": {
        "description": "no-referrer on the feed routes: the URL carries the token, and it must not travel to whatever a link in the document points at.",
        "schema": {
          "type": "string"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying, when the refusal is temporary.",
        "schema": {
          "type": "integer"
        }
      },
      "WWW-Authenticate": {
        "description": "Sent with a 401: the bearer scheme and the error code, RFC 6750 style.",
        "schema": {
          "type": "string"
        }
      },
      "X-Payment-Response": {
        "description": "The v1 name for PAYMENT-RESPONSE, carrying the same value, sent for clients written against v1.",
        "schema": {
          "format": "byte",
          "type": "string"
        }
      },
      "X-Qmarket-Access": {
        "description": "Why the read was allowed: free, owned or paid.",
        "schema": {
          "enum": [
            "free",
            "owned",
            "paid"
          ],
          "type": "string"
        }
      },
      "X-Qmarket-Price-Cents": {
        "description": "What this read actually charged, which on a first read is the trial price.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "parameters": {
      "after": {
        "description": "Page cursor: the next_cursor of the previous page. Omit for the first page.",
        "in": "query",
        "name": "after",
        "schema": {
          "type": "string"
        }
      },
      "ifNoneMatch": {
        "description": "The ETag of the feed document you already have. A feed that has not changed answers 304 with no body, which is what makes polling this every few minutes cheap. Weak validators are accepted: the tag is a hash of the document.",
        "in": "header",
        "name": "If-None-Match",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "limit": {
        "description": "Page size. Defaults to 50; clamped to 1–200; non-numeric values are ignored.",
        "in": "query",
        "name": "limit",
        "schema": {
          "type": "integer"
        }
      },
      "paymentSignature": {
        "description": "The signed payment, base64-encoded PaymentPayload. The v2 name for X-PAYMENT; either header is read, and the version is taken from the payload rather than the header it arrived in. Present: settle on the wallet rail. Absent: quote a 402.",
        "example": "eyJhY2NlcHRlZCI6eyJhbW91bnQiOiI1MDAwMDAwIiwiYXNzZXQiOiIweDgzMzU4OWZDRDZlRGI2RTA4ZjRjN0MzMkQ0ZjcxYjU0YmRBMDI5MTMiLCJkZXNjcmlwdGlvbiI6IkZyZXNoIHJldmlzaW9uIG9mIFFtYXJrZXQgYXJ0aWZhY3QgYV94IiwibWF4QW1vdW50UmVxdWlyZWQiOiI1MDAwMDAwIiwibWF4VGltZW91dFNlY29uZHMiOjYwLCJtaW1lVHlwZSI6InRleHQvbWFya2Rvd24iLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJwYXlUbyI6IjB4XHUwMDNjYWNjZXB0c1swXS5wYXlUb1x1MDAzZSIsInJlc291cmNlIjoiaHR0cHM6Ly9xbWFya2V0LmV4YW1wbGUvdjEvYXJ0aWZhY3RzL2FfeC9mcmVzaCIsInNjaGVtZSI6ImV4YWN0In0sInBheWxvYWQiOnsiYXV0aG9yaXphdGlvbiI6eyJmcm9tIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwibm9uY2UiOiIweFx1MDAzYzMyIHJhbmRvbSBieXRlcywgaGV4XHUwMDNlIiwidG8iOiIweFx1MDAzY2FjY2VwdHNbMF0ucGF5VG9cdTAwM2UiLCJ2YWxpZEFmdGVyIjoiMCIsInZhbGlkQmVmb3JlIjoiMTc2NzIyNTYwMCIsInZhbHVlIjoiNTAwMDAwMCJ9LCJzaWduYXR1cmUiOiIweFx1MDAzYzY1LWJ5dGUgRUlQLTcxMiBzaWduYXR1cmUsIGhleFx1MDAzZSJ9LCJ4NDAyVmVyc2lvbiI6Mn0=",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "required": false,
        "schema": {
          "format": "byte",
          "type": "string"
        }
      },
      "signInWithX": {
        "description": "A CAIP-122 proof that you control a wallet, base64-encoded. Bound to this service's origin and spent once. No payment and no balance are involved -- it proves control, nothing else.",
        "in": "header",
        "name": "SIGN-IN-WITH-X",
        "required": true,
        "schema": {
          "format": "byte",
          "type": "string"
        }
      },
      "xPayment": {
        "description": "x402 v1 payment, base64-encoded PaymentPayload. Present: settle on the wallet rail. Absent: quote a 402 (or, with a bearer key on an operation that takes credits, spend credits).",
        "example": "eyJhY2NlcHRlZCI6eyJhbW91bnQiOiI1MDAwMDAwIiwiYXNzZXQiOiIweDgzMzU4OWZDRDZlRGI2RTA4ZjRjN0MzMkQ0ZjcxYjU0YmRBMDI5MTMiLCJkZXNjcmlwdGlvbiI6IkZyZXNoIHJldmlzaW9uIG9mIFFtYXJrZXQgYXJ0aWZhY3QgYV94IiwibWF4QW1vdW50UmVxdWlyZWQiOiI1MDAwMDAwIiwibWF4VGltZW91dFNlY29uZHMiOjYwLCJtaW1lVHlwZSI6InRleHQvbWFya2Rvd24iLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJwYXlUbyI6IjB4XHUwMDNjYWNjZXB0c1swXS5wYXlUb1x1MDAzZSIsInJlc291cmNlIjoiaHR0cHM6Ly9xbWFya2V0LmV4YW1wbGUvdjEvYXJ0aWZhY3RzL2FfeC9mcmVzaCIsInNjaGVtZSI6ImV4YWN0In0sInBheWxvYWQiOnsiYXV0aG9yaXphdGlvbiI6eyJmcm9tIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwibm9uY2UiOiIweFx1MDAzYzMyIHJhbmRvbSBieXRlcywgaGV4XHUwMDNlIiwidG8iOiIweFx1MDAzY2FjY2VwdHNbMF0ucGF5VG9cdTAwM2UiLCJ2YWxpZEFmdGVyIjoiMCIsInZhbGlkQmVmb3JlIjoiMTc2NzIyNTYwMCIsInZhbHVlIjoiNTAwMDAwMCJ9LCJzaWduYXR1cmUiOiIweFx1MDAzYzY1LWJ5dGUgRUlQLTcxMiBzaWduYXR1cmUsIGhleFx1MDAzZSJ9LCJ4NDAyVmVyc2lvbiI6Mn0=",
        "in": "header",
        "name": "X-PAYMENT",
        "required": false,
        "schema": {
          "format": "byte",
          "type": "string"
        }
      }
    },
    "responses": {
      "AuthUnavailable": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The token verifier could not be reached; whether the credential is good is unknown. Retry. Codes: `auth_unavailable`."
      },
      "BadRequest": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The request was understood and refused. Codes: `bad_body`, `bad_amount`, `bad_budget`, `bad_key`, `bad_kind`, `bad_label`, `bad_question`, `bad_request`, `bad_wallet`, `budget_met`, `not_fundable`."
      },
      "Conflict": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The request is well formed but the state moved. Codes: `price_changed`, `intent_closed`, `payment_state`, `payment_reused`."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The account may not do this. Codes: `headstart`, `forbidden`."
      },
      "Gone": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The top-up intent aged out unpaid; create a new one. Nothing was charged. Codes: `intent_expired`."
      },
      "NotFound": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "No such row. Codes: `not_found`, `no_free_revision`."
      },
      "PaymentRequired": {
        "content": {
          "application/json": {
            "example": {
              "x402Version": 2,
              "error": "payment required",
              "accepts": [
                {
                  "scheme": "exact",
                  "network": "eip155:84532",
                  "amount": "5000000",
                  "maxAmountRequired": "5000000",
                  "resource": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                  "description": "Qmarket credits for acc_example",
                  "mimeType": "application/json",
                  "payTo": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                  "maxTimeoutSeconds": 60,
                  "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                  "extra": {
                    "name": "USDC",
                    "version": "2"
                  }
                }
              ],
              "resource": {
                "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                "description": "Qmarket credits for acc_example",
                "mimeType": "application/json"
              },
              "extensions": {
                "bazaar": {
                  "info": {
                    "input": {
                      "body": {},
                      "bodyType": "json",
                      "method": "POST",
                      "type": "http"
                    },
                    "output": {
                      "type": "json"
                    }
                  },
                  "schema": {
                    "$schema": "https://json-schema.org/draft/2020-12/schema",
                    "properties": {
                      "input": {
                        "properties": {
                          "body": {
                            "type": "object"
                          },
                          "bodyType": {
                            "enum": [
                              "json"
                            ]
                          },
                          "method": {
                            "enum": [
                              "GET",
                              "POST"
                            ]
                          },
                          "type": {
                            "const": "http"
                          }
                        },
                        "required": [
                          "type",
                          "method"
                        ],
                        "type": "object"
                      },
                      "output": {
                        "properties": {
                          "type": {
                            "enum": [
                              "json",
                              "text"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      }
                    },
                    "required": [
                      "input"
                    ],
                    "type": "object"
                  }
                }
              },
              "chainId": 84532,
              "eip712": {
                "domain": {
                  "chainId": 84532,
                  "name": "USDC",
                  "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                  "version": "2"
                },
                "primaryType": "TransferWithAuthorization",
                "types": {
                  "EIP712Domain": [
                    {
                      "name": "name",
                      "type": "string"
                    },
                    {
                      "name": "version",
                      "type": "string"
                    },
                    {
                      "name": "chainId",
                      "type": "uint256"
                    },
                    {
                      "name": "verifyingContract",
                      "type": "address"
                    }
                  ],
                  "TransferWithAuthorization": [
                    {
                      "name": "from",
                      "type": "address"
                    },
                    {
                      "name": "to",
                      "type": "address"
                    },
                    {
                      "name": "value",
                      "type": "uint256"
                    },
                    {
                      "name": "validAfter",
                      "type": "uint256"
                    },
                    {
                      "name": "validBefore",
                      "type": "uint256"
                    },
                    {
                      "name": "nonce",
                      "type": "bytes32"
                    }
                  ]
                },
                "message": {
                  "from": "\u003cyour address\u003e",
                  "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                  "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                  "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                  "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                  "value": "5000000"
                },
                "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
              },
              "retry": {
                "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                "header": "PAYMENT-SIGNATURE",
                "note": "Sign accepts[0] -- the eip712 field is the document, complete but for from, validAfter, validBefore and nonce -- then send this exact request again, same method and same body and same bearer, with the signed payment in the header named here. X-PAYMENT is accepted for a v1 payload."
              }
            },
            "schema": {
              "$ref": "#/components/schemas/PaymentRequired"
            }
          }
        },
        "description": "Payment required. On a first request this is the quote; after a submitted payment it names why the payment was refused. Nothing was charged. Sign accepts[0] and retry with PAYMENT-SIGNATURE (legacy X-PAYMENT is also accepted).",
        "headers": {
          "PAYMENT-REQUIRED": {
            "$ref": "#/components/headers/PAYMENT-REQUIRED"
          }
        }
      },
      "RateLimited": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Too many unauthenticated attempts from this address -- anonymous account creations, or feed-token management by signature; Retry-After says when the window resets. Codes: `rate_limited`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        }
      },
      "SettlementUnresolved": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The facilitator was asked to settle and the outcome is unknown or unidentifiable. The money may have moved; the payment is on file for reconciliation. Do not pay again. Codes: `settle_unknown`, `settle_no_reference`."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "No usable credential. auth_required: none was sent where one is needed; invalid_key / invalid_token: one was sent and did not resolve -- fix it rather than retry. Codes: `auth_required`, `invalid_key`, `invalid_token`.",
        "headers": {
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWW-Authenticate"
          }
        }
      },
      "X402NotConfigured": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "This deployment cannot settle x402; pay with credits. Codes: `x402_not_configured`."
      }
    },
    "schemas": {
      "AgentAccount": {
        "properties": {
          "account_id": {
            "type": "string"
          },
          "api_key": {
            "description": "Shown once. Send as Authorization: Bearer.",
            "type": "string"
          },
          "balance_credits": {
            "description": "Always 0 on creation: fund the account over x402 or Stripe.",
            "format": "int32",
            "type": "integer"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "account_id",
          "api_key",
          "balance_credits",
          "note"
        ],
        "type": "object"
      },
      "AgentAccountRequest": {
        "properties": {
          "label": {
            "description": "Free text, for the operator's own bookkeeping. Truncated to 60 characters.",
            "type": "string"
          },
          "wallet_address": {
            "description": "Optional EVM address the agent will pay from.",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ArtifactSummary": {
        "properties": {
          "age_hours": {
            "description": "Age of the latest revision; null when none is published.",
            "format": "double",
            "nullable": true,
            "type": "number"
          },
          "downloads": {
            "format": "int64",
            "type": "integer"
          },
          "external_url": {
            "nullable": true,
            "type": "string"
          },
          "freshness_hours": {
            "format": "int32",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "latest_rev": {
            "format": "int32",
            "type": "integer"
          },
          "machine_price_cents": {
            "description": "The price of a fresh read after the first; the first read of an artifact is the trial price.",
            "format": "int32",
            "type": "integer"
          },
          "question_id": {
            "type": "string"
          },
          "teaser": {
            "additionalProperties": true,
            "description": "arbitrary JSON object",
            "nullable": true,
            "type": "object"
          },
          "unique_buyers": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "age_hours",
          "downloads",
          "external_url",
          "freshness_hours",
          "id",
          "latest_rev",
          "machine_price_cents",
          "question_id",
          "teaser",
          "unique_buyers"
        ],
        "type": "object"
      },
      "ArtifactsPage": {
        "properties": {
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/ArtifactSummary"
            },
            "nullable": false,
            "type": "array"
          },
          "next_cursor": {
            "description": "Send back as ?after= for the next page. Absent on the last page, and on a free-text search, which returns its best page and no cursor.",
            "type": "string"
          }
        },
        "required": [
          "artifacts"
        ],
        "type": "object"
      },
      "BuilderCallback": {
        "description": "One builder status callback: queued, building, preview_ready (preview_url), deployed (live_url, artifact_urls, release_notes) or failed (failure). job_id is the marketplace's correlation id from the job payload; payload_version is \"1\". Signed over the raw body in X-Builder-Signature.",
        "properties": {
          "artifact_urls": {
            "items": {
              "type": "string"
            },
            "nullable": true,
            "type": "array"
          },
          "at": {
            "format": "date-time",
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "failure": {
            "nullable": true,
            "properties": {
              "diagnostic_ref": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              }
            },
            "required": [
              "diagnostic_ref",
              "summary"
            ],
            "type": "object"
          },
          "job_id": {
            "type": "string"
          },
          "live_url": {
            "type": "string"
          },
          "payload_version": {
            "type": "string"
          },
          "preview_url": {
            "type": "string"
          },
          "question": {
            "type": "string"
          },
          "release_notes": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "event_id",
          "job_id",
          "type",
          "at",
          "payload_version"
        ],
        "type": "object"
      },
      "BuilderEventResult": {
        "description": "duplicate is true when the event id had already been applied; state is the project's state after the callback.",
        "properties": {
          "duplicate": {
            "type": "boolean"
          },
          "ok": {
            "type": "boolean"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "duplicate",
          "ok",
          "state"
        ],
        "type": "object"
      },
      "ChainInfo": {
        "additionalProperties": false,
        "description": "The on-chain rail's configuration.",
        "properties": {
          "chain_reads_configured": {
            "description": "Whether a read-only node is configured. Configuration, not reachability: nothing is probed, so a node that is set and unreachable still reports true. False is definitive and means smart-contract wallet sign-in and settlement reconciliation are both inert -- a wallet that can pay may be unable to sign back in, and a settlement whose outcome was never learned stays unresolved.",
            "type": "boolean"
          },
          "escrow": {
            "additionalProperties": false,
            "description": "The deployed per-question escrow descriptor, or null. Only these fields are published; all of them are readable on the chain.",
            "nullable": true,
            "properties": {
              "chain_id": {
                "type": "integer"
              },
              "deployed_block": {
                "description": "An indexer's fromBlock.",
                "type": "integer"
              },
              "factory": {
                "description": "The escrow factory address to call.",
                "type": "string"
              },
              "implementation": {
                "type": "string"
              },
              "network": {
                "type": "string"
              },
              "platform": {
                "type": "string"
              },
              "usdc": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "network": {
            "type": "string"
          },
          "pay_to": {
            "description": "Null when this deployment cannot settle x402.",
            "nullable": true,
            "type": "string"
          },
          "usdc": {
            "description": "USDC contract address on the network.",
            "type": "string"
          }
        },
        "required": [
          "network",
          "usdc",
          "pay_to",
          "escrow",
          "chain_reads_configured"
        ],
        "type": "object"
      },
      "Checkout": {
        "properties": {
          "checkout_url": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          }
        },
        "required": [
          "checkout_url",
          "session_id"
        ],
        "type": "object"
      },
      "CheckoutRequest": {
        "description": "Pass pack or amount_cents.",
        "properties": {
          "amount_cents": {
            "description": "Alternative to pack.",
            "format": "int64",
            "type": "integer"
          },
          "pack": {
            "description": "A credit pack, in dollars.",
            "enum": [
              "100",
              "20",
              "5",
              ""
            ],
            "type": "string"
          },
          "purpose": {
            "enum": [
              "",
              "credits",
              "fund"
            ],
            "type": "string"
          },
          "question_id": {
            "type": "string"
          },
          "return_path": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ClaimedRun": {
        "properties": {
          "proposal_id": {
            "nullable": true,
            "type": "string"
          },
          "question_id": {
            "type": "string"
          },
          "run_id": {
            "type": "string"
          },
          "status": {
            "enum": [
              "running"
            ],
            "type": "string"
          }
        },
        "required": [
          "proposal_id",
          "question_id",
          "run_id",
          "status"
        ],
        "type": "object"
      },
      "CreditsLedger": {
        "properties": {
          "balance_credits": {
            "format": "int64",
            "type": "integer"
          },
          "entries": {
            "items": {
              "$ref": "#/components/schemas/CreditsLedgerEntry"
            },
            "nullable": false,
            "type": "array"
          }
        },
        "required": [
          "balance_credits",
          "entries"
        ],
        "type": "object"
      },
      "CreditsLedgerEntry": {
        "properties": {
          "delta_credits": {
            "description": "Signed movement; a top-up is positive, a read or a fund is negative.",
            "format": "int32",
            "type": "integer"
          },
          "reason": {
            "description": "Why the balance moved.",
            "example": "x402_topup",
            "type": "string"
          },
          "ref": {
            "description": "The idempotency key for the reason: an x402 transaction, a Stripe session, a download id.",
            "nullable": true,
            "type": "string"
          },
          "ts": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "delta_credits",
          "reason",
          "ref",
          "ts"
        ],
        "type": "object"
      },
      "DiscoveryListing": {
        "description": "The x402 discovery listing shape (specification v2 §8), describing this deployment's paid resources.",
        "properties": {
          "items": {
            "items": {
              "properties": {
                "accepts": {
                  "items": {
                    "$ref": "#/components/schemas/PaymentRequirements"
                  },
                  "type": "array"
                },
                "lastUpdated": {
                  "format": "date-time",
                  "type": "string"
                },
                "metadata": {
                  "properties": {
                    "amount": {
                      "description": "\"fixed\" when accepts[0].maxAmountRequired is the price; \"per-request\" when the 402 quotes it (a read's price, the amount the caller asked to fund or buy).",
                      "type": "string"
                    },
                    "auth": {
                      "description": "What the resource wants besides the payment. \"bearer-to-settle\" is the middle case: the 402 is served to anyone, so a wallet can discover the price, and only the paid retry needs a key.",
                      "enum": [
                        "none",
                        "bearer",
                        "bearer-to-settle"
                      ],
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "input": {
                      "description": "The bazaar extension's info.input for this resource.",
                      "type": "object"
                    },
                    "method": {
                      "type": "string"
                    },
                    "openapi": {
                      "description": "The operation in /openapi.json.",
                      "format": "uri",
                      "type": "string"
                    },
                    "output": {
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "resource": {
                  "description": "Absolute URL, with {param} placeholders for a templated route.",
                  "type": "string"
                },
                "type": {
                  "enum": [
                    "http"
                  ],
                  "type": "string"
                },
                "x402Version": {
                  "type": "integer"
                }
              },
              "required": [
                "resource",
                "type",
                "x402Version",
                "accepts",
                "lastUpdated",
                "metadata"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "pagination": {
            "properties": {
              "limit": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "limit",
              "offset",
              "total"
            ],
            "type": "object"
          },
          "x402Version": {
            "enum": [
              2
            ],
            "type": "integer"
          }
        },
        "required": [
          "x402Version",
          "items",
          "pagination"
        ],
        "type": "object"
      },
      "EIP712Field": {
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "type"
        ],
        "type": "object"
      },
      "EIP712TypedData": {
        "description": "The EIP-712 document to sign for challenge.accepts[0], ready for eth_signTypedData_v4. The `exact` scheme on an EVM network is an EIP-3009 TransferWithAuthorization; everything but from, validAfter, validBefore and nonce is fixed by the challenge and filled in here.",
        "properties": {
          "domain": {
            "additionalProperties": {
              "description": "any JSON value"
            },
            "description": "USDC's EIP-712 domain: name and version from accepts[0].extra, chainId, verifyingContract = accepts[0].asset.",
            "nullable": true,
            "type": "object"
          },
          "fill": {
            "description": "What to replace and how to send the signature.",
            "type": "string"
          },
          "message": {
            "additionalProperties": {
              "description": "any JSON value"
            },
            "description": "to and value are final; from, validAfter, validBefore and nonce are placeholders in angle brackets.",
            "nullable": true,
            "type": "object"
          },
          "primaryType": {
            "type": "string"
          },
          "types": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/EIP712Field"
              },
              "nullable": true,
              "type": "array"
            },
            "nullable": true,
            "type": "object"
          }
        },
        "required": [
          "domain",
          "fill",
          "message",
          "primaryType",
          "types"
        ],
        "type": "object"
      },
      "Error": {
        "description": "The body of every non-2xx response except a 402. Match on error.code; the message is for humans.",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorBody"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "ErrorBody": {
        "properties": {
          "code": {
            "description": "Stable machine-readable code. Shared with GraphQL extensions.code and MCP tool errors.",
            "example": "auth_required",
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "FailRunRequest": {
        "properties": {
          "reason": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "FeedToken": {
        "description": "A minted reader credential. `token` is the secret and is returned exactly once -- it is stored hashed, so a lost one is revoked and replaced rather than recovered.",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "token": {
            "description": "The secret, prefixed qm_feed_. Shown once.",
            "type": "string"
          },
          "url": {
            "description": "The feed to subscribe to, with the token already in the query string. The only place the secret is assembled into a URL.",
            "format": "uri",
            "type": "string"
          }
        },
        "required": [
          "id",
          "token",
          "url"
        ],
        "type": "object"
      },
      "FeedTokenInfo": {
        "description": "One live token as its owner sees it. No secret: what is stored is a hash.",
        "properties": {
          "created_ts": {
            "description": "RFC 3339, UTC.",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "last_used_ts": {
            "description": "When a reader last fetched with this token, RFC 3339 UTC. Absent for a token nothing has used yet -- which is how a subscription that was never wired up is spotted.",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "created_ts",
          "id"
        ],
        "type": "object"
      },
      "FeedTokenRequest": {
        "description": "What to call the reader this token is for. Every field is optional, and so is the body itself.",
        "properties": {
          "label": {
            "description": "A note to tell one reader from another in the listing, e.g. the name of the app it was pasted into. At most 64 characters.",
            "maxLength": 64,
            "type": "string"
          }
        },
        "type": "object"
      },
      "FeedTokens": {
        "description": "Every live token on the account, newest first.",
        "items": {
          "$ref": "#/components/schemas/FeedTokenInfo"
        },
        "type": "array"
      },
      "FundRequest": {
        "properties": {
          "amount_cents": {
            "description": "How much to escrow. Clamped to what the round still needs.",
            "format": "int32",
            "maximum": 1000000,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "amount_cents"
        ],
        "type": "object"
      },
      "FundResult": {
        "description": "What the contribution bought, and where to watch it.",
        "properties": {
          "budget_cents": {
            "format": "int32",
            "type": "integer"
          },
          "escrowed_cents": {
            "description": "What this call actually escrowed, after clamping to the remainder.",
            "format": "int32",
            "type": "integer"
          },
          "funding_position": {
            "type": "string"
          },
          "question_id": {
            "type": "string"
          },
          "question_status": {
            "enum": [
              "curating",
              "listed",
              "rejected",
              "duplicate",
              "funded",
              "answering",
              "answered",
              "retired",
              "superseded"
            ],
            "type": "string"
          },
          "run_id": {
            "description": "The research run this contribution scheduled. Present only on the contribution that completed the round -- that is the one that schedules it.",
            "type": "string"
          },
          "status_url": {
            "description": "Poll this while question_status moves funded -\u003e answering -\u003e answered.",
            "format": "uri",
            "type": "string"
          },
          "total_cents": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "budget_cents",
          "escrowed_cents",
          "funding_position",
          "question_id",
          "question_status",
          "status_url",
          "total_cents"
        ],
        "type": "object"
      },
      "Health": {
        "description": "Readiness: ok is true while the database is reachable.",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      },
      "LaunchMessage": {
        "properties": {
          "message": {
            "type": "string"
          },
          "revision": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "revision",
          "message"
        ],
        "type": "object"
      },
      "ListQuestionRequest": {
        "properties": {
          "budget_cents": {
            "description": "Funding proposal budget. Omit, null or 0 for no preference; otherwise 100–100000. This does not guarantee executor spending or research depth.",
            "nullable": true,
            "oneOf": [
              {
                "enum": [
                  0
                ],
                "type": "integer"
              },
              {
                "maximum": 100000,
                "minimum": 100,
                "type": "integer"
              }
            ],
            "type": "integer"
          },
          "entities": {
            "items": {
              "maxLength": 14,
              "type": "string"
            },
            "maxItems": 4,
            "nullable": true,
            "type": "array"
          },
          "text": {
            "maxLength": 2000,
            "minLength": 12,
            "type": "string"
          },
          "trigger": {
            "additionalProperties": {
              "description": "any JSON value"
            },
            "description": "Optional watch trigger, passed through as JSON.",
            "nullable": true,
            "type": "object"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "ListQuestionResult": {
        "properties": {
          "budget_cents": {
            "format": "int32",
            "nullable": true,
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "enum": [
              "listed",
              "rejected",
              "duplicate",
              "curating"
            ],
            "type": "string"
          },
          "tier": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "type": "object"
      },
      "Ok": {
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      },
      "PageDownloadRequest": {
        "description": "A copy or a PDF saved from the question page.",
        "properties": {
          "channel": {
            "enum": [
              "copy",
              "pdf"
            ],
            "type": "string"
          },
          "rev": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "rev",
          "channel"
        ],
        "type": "object"
      },
      "PaymentAuthorization": {
        "description": "payload.authorization is the EIP-3009 message and payload.signature its EIP-712 signature; a top-up intent hands both out ready to fill in, as payment.x402.eip712.",
        "properties": {
          "authorization": {
            "properties": {
              "from": {
                "description": "The payer.",
                "type": "string"
              },
              "nonce": {
                "description": "32 random bytes, hex. Never reuse one.",
                "type": "string"
              },
              "to": {
                "description": "accepts[0].payTo.",
                "type": "string"
              },
              "validAfter": {
                "type": "string"
              },
              "validBefore": {
                "description": "Unix seconds; within accepts[0].maxTimeoutSeconds of now. Also what a settlement of unknown outcome is reconciled against, so it must be real.",
                "type": "string"
              },
              "value": {
                "description": "accepts[0].amount.",
                "type": "string"
              }
            },
            "required": [
              "from",
              "to",
              "value",
              "validAfter",
              "validBefore",
              "nonce"
            ],
            "type": "object"
          },
          "signature": {
            "description": "EIP-712 signature of the authorization under the asset's domain (accepts[0].extra).",
            "type": "string"
          }
        },
        "required": [
          "signature",
          "authorization"
        ],
        "type": "object"
      },
      "PaymentIntent": {
        "description": "A hosted checkout. Send the customer to url; when they come back, confirm with status_url and trust only status == paid.",
        "properties": {
          "amount_cents": {
            "format": "int64",
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "paid_at": {
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "payer": {
            "nullable": true,
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "paid",
              "expired",
              "failed"
            ],
            "type": "string"
          },
          "status_url": {
            "format": "uri",
            "type": "string"
          },
          "tx_hash": {
            "nullable": true,
            "type": "string"
          },
          "url": {
            "format": "uri",
            "type": "string"
          }
        },
        "required": [
          "amount_cents",
          "currency",
          "expires_at",
          "id",
          "project_id",
          "reference",
          "status",
          "status_url"
        ],
        "type": "object"
      },
      "PaymentIntentRequest": {
        "description": "One checkout for the deployed app's customer: the amount in whole cents, the app's own order reference (a pending checkout per reference), and where to send the customer afterwards; return_url must be on the app's live or preview host.",
        "properties": {
          "amount_cents": {
            "format": "int64",
            "type": "integer"
          },
          "reference": {
            "type": "string"
          },
          "return_url": {
            "format": "uri",
            "type": "string"
          }
        },
        "required": [
          "amount_cents",
          "reference",
          "return_url"
        ],
        "type": "object"
      },
      "PaymentIntentStatus": {
        "description": "Where a top-up intent is. Poll until it is terminal.",
        "enum": [
          "pending",
          "settled",
          "credited",
          "expired",
          "failed",
          "unresolved",
          "duplicate"
        ],
        "type": "string"
      },
      "PaymentPayload": {
        "description": "The decoded PAYMENT-SIGNATURE (or X-PAYMENT) header: `exact` on an EVM network, in either wire version. Send it base64-encoded; bare JSON is also accepted.",
        "example": {
          "accepted": {
            "amount": "5000000",
            "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
            "description": "Fresh revision of Qmarket artifact a_x",
            "maxAmountRequired": "5000000",
            "maxTimeoutSeconds": 60,
            "mimeType": "text/markdown",
            "network": "eip155:8453",
            "payTo": "0x\u003caccepts[0].payTo\u003e",
            "resource": "https://qmarket.example/v1/artifacts/a_x/fresh",
            "scheme": "exact"
          },
          "payload": {
            "authorization": {
              "from": "0x1111111111111111111111111111111111111111",
              "nonce": "0x\u003c32 random bytes, hex\u003e",
              "to": "0x\u003caccepts[0].payTo\u003e",
              "validAfter": "0",
              "validBefore": "1767225600",
              "value": "5000000"
            },
            "signature": "0x\u003c65-byte EIP-712 signature, hex\u003e"
          },
          "x402Version": 2
        },
        "oneOf": [
          {
            "description": "x402Version 2. `accepted` is the accepts entry you signed, with its CAIP-2 network and `amount`.",
            "properties": {
              "accepted": {
                "$ref": "#/components/schemas/PaymentRequirements"
              },
              "payload": {
                "$ref": "#/components/schemas/PaymentAuthorization"
              },
              "x402Version": {
                "enum": [
                  2
                ],
                "type": "integer"
              }
            },
            "required": [
              "x402Version",
              "payload",
              "accepted"
            ],
            "title": "v2",
            "type": "object"
          },
          {
            "description": "x402Version 1, still accepted. `network` is the bare name, not CAIP-2.",
            "properties": {
              "network": {
                "description": "Bare network name, e.g. base-sepolia.",
                "type": "string"
              },
              "payload": {
                "$ref": "#/components/schemas/PaymentAuthorization"
              },
              "scheme": {
                "enum": [
                  "exact"
                ],
                "type": "string"
              },
              "x402Version": {
                "enum": [
                  1
                ],
                "type": "integer"
              }
            },
            "required": [
              "x402Version",
              "scheme",
              "network",
              "payload"
            ],
            "title": "v1",
            "type": "object"
          }
        ]
      },
      "PaymentRequired": {
        "description": "The body of a 402, also served base64-encoded in the PAYMENT-REQUIRED response header. Sign accepts[0] and retry the same request with the payment in PAYMENT-SIGNATURE (or X-PAYMENT, which is still accepted).",
        "properties": {
          "accepts": {
            "items": {
              "$ref": "#/components/schemas/PaymentRequirements"
            },
            "minItems": 1,
            "nullable": false,
            "type": "array"
          },
          "chainId": {
            "description": "The EIP-155 chain id accepts[0].network stands for, for a client composing its own signature. Not part of the x402 wire shape; x402 clients ignore it.",
            "format": "int64",
            "type": "integer"
          },
          "eip712": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EIP712TypedData"
              }
            ],
            "description": "The EIP-712 document to sign for accepts[0], ready for eth_signTypedData_v4 with from, validAfter, validBefore and nonce left as placeholders; `fill` says what replaces them and how the signature travels. Body only: the PAYMENT-REQUIRED header carries the challenge without it. Not part of the x402 wire shape; x402 clients ignore it.",
            "nullable": true,
            "type": "object"
          },
          "error": {
            "description": "\"payment required\" on a first refusal; otherwise why a submitted payment was not accepted (bad_payment_header, verify_failed, settle_failed, facilitator_unreachable). An uncertain settlement must be reconciled before paying again.",
            "type": "string"
          },
          "extensions": {
            "additionalProperties": {
              "description": "any JSON value"
            },
            "description": "x402 v2 extensions carried on the challenge body. `bazaar` describes the request this resource takes, in the discovery extension's info shape.",
            "nullable": true,
            "type": "object"
          },
          "resource": {
            "nullable": true,
            "properties": {
              "description": {
                "type": "string"
              },
              "mimeType": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "url"
            ],
            "type": "object"
          },
          "retry": {
            "nullable": true,
            "properties": {
              "header": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "header",
              "note",
              "url"
            ],
            "type": "object"
          },
          "x402Version": {
            "enum": [
              2
            ],
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "accepts",
          "error",
          "x402Version"
        ],
        "type": "object"
      },
      "PaymentRequirements": {
        "description": "One entry of a 402 challenge's accepts list: what to pay, where, on which network. x402 v2 `exact` scheme.",
        "properties": {
          "amount": {
            "description": "USDC atomic units (6 decimals) as a decimal string: cents × 10,000. The v2 name for the price.",
            "example": "5000000",
            "type": "string"
          },
          "asset": {
            "description": "USDC contract address on `network`.",
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "extra": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "EIP-712 domain of the asset: {name, version}. Sign the TransferWithAuthorization against it.",
            "nullable": true,
            "type": "object"
          },
          "maxAmountRequired": {
            "description": "The v1 name for amount, carrying the same value, sent for clients written against v1.",
            "example": "5000000",
            "type": "string"
          },
          "maxTimeoutSeconds": {
            "description": "How long the signed authorization must remain valid.",
            "format": "int64",
            "type": "integer"
          },
          "mimeType": {
            "description": "What a successful response is.",
            "type": "string"
          },
          "network": {
            "description": "CAIP-2 chain identifier, e.g. eip155:8453 for Base mainnet or eip155:84532 for Base Sepolia.",
            "example": "eip155:8453",
            "type": "string"
          },
          "payTo": {
            "description": "The address that receives the USDC. The zero address means this deployment cannot settle.",
            "type": "string"
          },
          "resource": {
            "description": "Absolute URL of the resource being paid for.",
            "format": "uri",
            "type": "string"
          },
          "scheme": {
            "enum": [
              "exact"
            ],
            "type": "string"
          }
        },
        "required": [
          "amount",
          "asset",
          "description",
          "maxAmountRequired",
          "maxTimeoutSeconds",
          "mimeType",
          "network",
          "payTo",
          "resource",
          "scheme"
        ],
        "type": "object"
      },
      "PlatformActivity": {
        "description": "The homepage's public totals.",
        "properties": {
          "report_downloads": {
            "format": "int64",
            "type": "integer"
          },
          "reports_funded": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "report_downloads",
          "reports_funded"
        ],
        "type": "object"
      },
      "PublicTopUpResult": {
        "description": "A public deposit-link receipt without the account balance. For signup, account_id names the account. Only the initial verified settlement can return api_key; recovery uses wallet proof at POST /v1/accounts/key.",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "api_key": {
            "type": "string"
          },
          "credited_cents": {
            "format": "int32",
            "type": "integer"
          },
          "intent_id": {
            "type": "string"
          },
          "replay": {
            "type": "boolean"
          },
          "tx": {
            "type": "string"
          }
        },
        "required": [
          "credited_cents",
          "replay",
          "tx"
        ],
        "type": "object"
      },
      "PublishRequest": {
        "properties": {
          "citations": {
            "format": "int32",
            "type": "integer"
          },
          "content": {
            "description": "The report, markdown.",
            "minLength": 1,
            "type": "string"
          },
          "cost_actual_cents": {
            "description": "What the run cost; prices the artifact as a markup on it.",
            "format": "int32",
            "nullable": true,
            "type": "integer"
          },
          "teaser": {
            "description": "any JSON value"
          }
        },
        "required": [
          "content"
        ],
        "type": "object"
      },
      "PublishResult": {
        "properties": {
          "artifact_id": {
            "type": "string"
          },
          "rev": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "artifact_id",
          "rev"
        ],
        "type": "object"
      },
      "Question": {
        "properties": {
          "art_url": {
            "nullable": true,
            "type": "string"
          },
          "art_url_600": {
            "nullable": true,
            "type": "string"
          },
          "artifact": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ArtifactSummary"
              }
            ],
            "nullable": true,
            "type": "object"
          },
          "budget_cents": {
            "description": "The research budget the live proposal is measured against; null before curation attaches one.",
            "format": "int32",
            "nullable": true,
            "type": "integer"
          },
          "created": {
            "description": "When the question was listed. RFC 3339, UTC. Before 15 September 2026 this was a bare YYYY-MM-DD date.",
            "format": "date-time",
            "type": "string"
          },
          "display_title": {
            "description": "Optional presentation heading for visible questions; text remains the complete approved question.",
            "maxLength": 110,
            "nullable": true,
            "type": "string"
          },
          "entities": {
            "items": {
              "type": "string"
            },
            "nullable": false,
            "type": "array"
          },
          "forecasters": {
            "format": "int32",
            "nullable": true,
            "type": "integer"
          },
          "funders": {
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "raised_cents": {
            "description": "Escrowed so far across every rail.",
            "format": "int64",
            "type": "integer"
          },
          "ref_url": {
            "nullable": true,
            "type": "string"
          },
          "reject_reason": {
            "nullable": true,
            "type": "string"
          },
          "slug": {
            "description": "The readable half of the question's URL: /q/{slug}-{id}. Decorative -- the id is what resolves -- so a link built from a stale slug still works.",
            "type": "string"
          },
          "status": {
            "enum": [
              "curating",
              "listed",
              "rejected",
              "duplicate",
              "funded",
              "answering",
              "answered",
              "retired",
              "superseded"
            ],
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "tier": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "art_url",
          "art_url_600",
          "budget_cents",
          "created",
          "display_title",
          "entities",
          "forecasters",
          "funders",
          "id",
          "raised_cents",
          "ref_url",
          "slug",
          "status",
          "text",
          "tier"
        ],
        "type": "object"
      },
      "QuestionsPage": {
        "properties": {
          "next_cursor": {
            "description": "Send back as ?after= for the next page. Absent on the last page, and on a free-text search, which returns its best page and no cursor.",
            "type": "string"
          },
          "questions": {
            "items": {
              "$ref": "#/components/schemas/Question"
            },
            "nullable": false,
            "type": "array"
          }
        },
        "required": [
          "questions"
        ],
        "type": "object"
      },
      "RevenueEventRequest": {
        "description": "One revenue event from the deployed app: a receipt, or a refund or processing_fee naming the receipt it belongs to in refund_of. Amounts are USDC cents; occurred_at decides the reporting month.",
        "properties": {
          "amount_cents": {
            "format": "int64",
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "occurred_at": {
            "format": "date-time",
            "type": "string"
          },
          "receipt_id": {
            "type": "string"
          },
          "refund_of": {
            "type": "string"
          }
        },
        "required": [
          "receipt_id",
          "kind",
          "amount_cents",
          "occurred_at"
        ],
        "type": "object"
      },
      "RevenueEventResult": {
        "description": "duplicate is true when the receipt id had already been reported; period is the YYYY-MM the event was filed under.",
        "properties": {
          "duplicate": {
            "type": "boolean"
          },
          "ok": {
            "type": "boolean"
          },
          "period": {
            "type": "string"
          }
        },
        "required": [
          "duplicate",
          "ok",
          "period"
        ],
        "type": "object"
      },
      "ReviewRequest": {
        "properties": {
          "canonical_text": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "verdict": {
            "enum": [
              "accept",
              "reject",
              "rewrite"
            ],
            "type": "string"
          }
        },
        "required": [
          "verdict"
        ],
        "type": "object"
      },
      "ReviewResult": {
        "properties": {
          "bounty_cents": {
            "format": "int32",
            "type": "integer"
          },
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "bounty_cents",
          "ok"
        ],
        "type": "object"
      },
      "RoyaltiesLedger": {
        "properties": {
          "accrued_cents": {
            "format": "int64",
            "type": "integer"
          },
          "entries": {
            "items": {
              "$ref": "#/components/schemas/RoyaltyLedgerEntry"
            },
            "nullable": false,
            "type": "array"
          }
        },
        "required": [
          "accrued_cents",
          "entries"
        ],
        "type": "object"
      },
      "RoyaltyLedgerEntry": {
        "properties": {
          "artifact_id": {
            "type": "string"
          },
          "cents": {
            "format": "int64",
            "type": "integer"
          },
          "contributor_account": {
            "type": "string"
          },
          "n": {
            "description": "How many downloads the row aggregates.",
            "format": "int64",
            "type": "integer"
          },
          "role": {
            "type": "string"
          },
          "status": {
            "enum": [
              "accrued",
              "approved",
              "paid"
            ],
            "type": "string"
          }
        },
        "required": [
          "artifact_id",
          "cents",
          "contributor_account",
          "n",
          "role",
          "status"
        ],
        "type": "object"
      },
      "SetLabelRequest": {
        "description": "A display name to claim.",
        "properties": {
          "label": {
            "type": "string"
          }
        },
        "required": [
          "label"
        ],
        "type": "object"
      },
      "Settlement": {
        "description": "The decoded PAYMENT-RESPONSE and X-Payment-Response protocol receipt. Application bodies retain their separate tx field.",
        "properties": {
          "errorReason": {
            "type": "string"
          },
          "network": {
            "description": "CAIP-2 identifier from the settlement or stored authorization evidence.",
            "example": "eip155:8453",
            "type": "string"
          },
          "payer": {
            "description": "The wallet that paid.",
            "type": "string"
          },
          "success": {
            "example": true,
            "type": "boolean"
          },
          "transaction": {
            "description": "On-chain transaction reference. The same reference credits once.",
            "example": "0xabc123",
            "type": "string"
          }
        },
        "required": [
          "network",
          "success",
          "transaction"
        ],
        "type": "object"
      },
      "TopUpIntent": {
        "description": "A credits top-up intent: the amount, the URL a wallet pays without a bearer key, the payment terms while payable, and how to confirm the credits landed. Quarantined legacy intents report unresolved and carry no challenge or signing document. Identical over REST, GraphQL and MCP.",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "amount_cents": {
            "description": "Credits the payment buys.",
            "format": "int32",
            "maximum": 1000000,
            "minimum": 100,
            "type": "integer"
          },
          "balance_credits": {
            "format": "int64",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "credited_cents": {
            "format": "int32",
            "type": "integer"
          },
          "detail": {
            "nullable": true,
            "type": "string"
          },
          "expires_at": {
            "description": "created_at + 60 minutes. A pay attempt after this is refused with 410 intent_expired before the facilitator is called.",
            "format": "date-time",
            "type": "string"
          },
          "intent_id": {
            "type": "string"
          },
          "payer": {
            "nullable": true,
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/TopUpPayment"
          },
          "status": {
            "$ref": "#/components/schemas/PaymentIntentStatus"
          },
          "tx": {
            "nullable": true,
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "verify": {
            "$ref": "#/components/schemas/TopUpVerify"
          }
        },
        "required": [
          "account_id",
          "amount_cents",
          "balance_credits",
          "created_at",
          "credited_cents",
          "detail",
          "expires_at",
          "intent_id",
          "payer",
          "payment",
          "status",
          "tx",
          "updated_at",
          "verify"
        ],
        "type": "object"
      },
      "TopUpPayment": {
        "properties": {
          "auth": {
            "description": "No Authorization header: the intent id in the URL is the capability.",
            "enum": [
              "none"
            ],
            "type": "string"
          },
          "body": {
            "description": "Nothing is required; the amount is fixed by the intent. Always null.",
            "nullable": true,
            "type": "object"
          },
          "content_type": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "x402": {
            "$ref": "#/components/schemas/TopUpX402"
          }
        },
        "required": [
          "auth",
          "body",
          "content_type",
          "method",
          "url",
          "x402"
        ],
        "type": "object"
      },
      "TopUpRequest": {
        "properties": {
          "amount_cents": {
            "description": "Credits to buy: one cent is one credit.",
            "format": "int32",
            "maximum": 1000000,
            "minimum": 100,
            "type": "integer"
          }
        },
        "required": [
          "amount_cents"
        ],
        "type": "object"
      },
      "TopUpResult": {
        "description": "An authenticated direct top-up receipt, including the owner's current balance.",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "api_key": {
            "type": "string"
          },
          "balance_credits": {
            "format": "int64",
            "type": "integer"
          },
          "credited_cents": {
            "format": "int32",
            "type": "integer"
          },
          "intent_id": {
            "type": "string"
          },
          "replay": {
            "type": "boolean"
          },
          "tx": {
            "type": "string"
          }
        },
        "required": [
          "balance_credits",
          "credited_cents",
          "replay",
          "tx"
        ],
        "type": "object"
      },
      "TopUpVerify": {
        "properties": {
          "auth": {
            "enum": [
              "bearer"
            ],
            "type": "string"
          },
          "credited_status": {
            "enum": [
              "credited"
            ],
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "poll_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "terminal_statuses": {
            "items": {
              "type": "string"
            },
            "nullable": false,
            "type": "array"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "auth",
          "credited_status",
          "method",
          "poll_seconds",
          "terminal_statuses",
          "url"
        ],
        "type": "object"
      },
      "TopUpX402": {
        "properties": {
          "chain_id": {
            "description": "EIP-155 chain id behind challenge.accepts[0].network (base: 8453, base-sepolia: 84532); zero when quarantined.",
            "format": "int64",
            "type": "integer"
          },
          "challenge": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentRequired"
              }
            ],
            "description": "Payment terms; null for a quarantined legacy intent. A null challenge is not permission to replace an uncertain payment.",
            "nullable": true,
            "type": "object"
          },
          "eip712": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EIP712TypedData"
              }
            ],
            "description": "Signing document; null for a quarantined legacy intent.",
            "nullable": true,
            "type": "object"
          },
          "encoding": {
            "type": "string"
          },
          "request_header": {
            "description": "Send the signed payment here. X-PAYMENT is also read, for clients written against v1.",
            "enum": [
              "PAYMENT-SIGNATURE"
            ],
            "type": "string"
          },
          "response_header": {
            "description": "The settlement comes back here and, for v1 clients, on X-Payment-Response as well.",
            "enum": [
              "PAYMENT-RESPONSE"
            ],
            "type": "string"
          },
          "version": {
            "enum": [
              2
            ],
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "chain_id",
          "challenge",
          "eip712",
          "encoding",
          "request_header",
          "response_header",
          "version"
        ],
        "type": "object"
      },
      "WalletKey": {
        "description": "A key minted for the account a wallet owns.",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "api_key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "account_id",
          "api_key"
        ],
        "type": "object"
      },
      "WalletLabel": {
        "description": "The public name an account is displayed under.",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "account_id",
          "label"
        ],
        "type": "object"
      },
      "WatchRequest": {
        "properties": {
          "key": {
            "description": "An entity is free text -- a ticker, a name -- and is stored uppercased. A question is a question id, exactly as given: ids are case-sensitive.",
            "type": "string"
          },
          "kind": {
            "description": "What the key names. Defaults to entity.",
            "enum": [
              "entity",
              "question"
            ],
            "type": "string"
          }
        },
        "required": [
          "key"
        ],
        "type": "object"
      },
      "WebhookResult": {
        "properties": {
          "credited": {
            "format": "int64",
            "type": "integer"
          },
          "funding": {
            "nullable": true,
            "properties": {
              "budget_cents": {
                "format": "int32",
                "type": "integer"
              },
              "escrowed_cents": {
                "format": "int32",
                "type": "integer"
              },
              "funding_position": {
                "type": "string"
              },
              "question_status": {
                "type": "string"
              },
              "run_id": {
                "type": "string"
              },
              "total_cents": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "budget_cents",
              "escrowed_cents",
              "funding_position",
              "question_status",
              "total_cents"
            ],
            "type": "object"
          },
          "funding_error": {
            "type": "string"
          },
          "handled": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "handled"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "description": "`Authorization: Bearer \u003ctoken\u003e`. A qm_sk_ agent key (mint one with the mintAgentKey GraphQL mutation, or POST /v1/accounts/agent with no credentials) or a Privy access token for a logged-in human. An invalid qm_sk_ key answers 401 invalid_key, including on public routes. Missing credentials are anonymous; routes requiring an account answer 401 auth_required. A non-qm_sk_ token is anonymous when Privy verification is not configured.",
        "scheme": "bearer",
        "type": "http"
      },
      "x402Payment": {
        "description": "x402 v2 payment: base64-encoded PaymentPayload signed against the 402's accepts[0]. X-PAYMENT is accepted for legacy clients. Sending it is what selects the wallet rail over credits.",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "description": "Qmarket is an exchange for research questions: anyone lists one, funders pool its budget, an executor answers it, and the report is sold. This document is generated from the running code -- schemas from the structs the handlers encode, bounds from the constants they validate against -- and the deployment's contract tests replay requests against it.\n\n**Auth.** Browse, teasers, freed revisions, the 402 challenge and the top-up pay URL need no credential. Everything else takes `Authorization: Bearer` (see bearerAuth). Missing credentials are anonymous; invalid qm_sk_ keys answer `401 invalid_key`, including on public routes. Operations requiring an account answer `401 auth_required` when anonymous.\n\n**Paying.** Credits pay for reads and funding on every surface. USDC comes in over x402 v2 (`exact` scheme, see x-x402). An authenticated fresh read or funding request can spend credits even without a wallet payment header. Inspect GraphQL artifactAccess with the same credential before obtaining spending permission; it does not reserve the price or revision. A top-up request without a payment header, or an anonymous paid fresh read, answers `402` with PAYMENT-REQUIRED and a PaymentRequired body. The same request retried with `PAYMENT-SIGNATURE` settles through the facilitator and answers `200` with `PAYMENT-RESPONSE`. Legacy X-PAYMENT and X-Payment-Response remain supported. An agent that cannot run that negotiation itself -- an MCP or GraphQL session -- mints a top-up intent instead and hands its bearer-free pay URL to any x402 wallet. Cards go through Stripe checkout.\n\n**Settlement outcomes.** Do not retry an uncertain settlement with a new authorization. Reconcile payment and delivery first. `502 settle_unknown` / `settle_no_reference` means the money may have moved and delivery could not be confirmed; the payment is on file for reconciliation and must not be paid again. `503 x402_not_configured` means this deployment does not run the rail at all.\n\nStandalone JSON Schemas (2020-12) for every component are listed under x-json-schemas.",
    "title": "Qmarket API",
    "version": "1.2.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/": {
      "get": {
        "description": "Every route, the auth model and how to pay, as prose in one JSON document. Start here or at /openapi.json.",
        "operationId": "index",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The index."
          }
        },
        "security": [
          {}
        ],
        "summary": "Service index",
        "tags": [
          "meta"
        ]
      }
    },
    "/.well-known/jwks.json": {
      "get": {
        "operationId": "jwks",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "A JWK set of ES256 keys."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "App login is not enabled on this deployment."
          }
        },
        "security": [
          {}
        ],
        "summary": "Keys that sign app ID tokens",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/.well-known/openid-configuration": {
      "get": {
        "description": "\"Log in with Qmarket\" for the apps the launchpad builds. Point any OpenID Connect library at this issuer with the project id as client_id, no client secret, PKCE S256, and a redirect_uri on the app's live or preview host. The sub is the person's marketplace account id, the same in every app.",
        "operationId": "openidConfiguration",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The discovery document."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "App login is not enabled on this deployment."
          }
        },
        "security": [
          {}
        ],
        "summary": "OpenID provider metadata",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/graphql": {
      "post": {
        "description": "The same reads and writes in one round trip, plus login (authPrivy), key minting (mintAgentKey), viewer, and the top-up intent (createTopupIntent / topupIntent). The schema is served by introspection.",
        "operationId": "graphql",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "GraphQL response envelope."
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "GraphQL",
        "tags": [
          "meta"
        ]
      }
    },
    "/healthz": {
      "get": {
        "description": "200 while the database is reachable, 503 when it is not. Readiness rather than liveness: a database outage must not restart every replica.",
        "operationId": "health",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                },
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            },
            "description": "Ready."
          },
          "503": {
            "content": {
              "application/json": {
                "example": {
                  "ok": false
                },
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            },
            "description": "Database unreachable."
          }
        },
        "security": [
          {}
        ],
        "summary": "Readiness probe",
        "tags": [
          "meta"
        ]
      }
    },
    "/llms.txt": {
      "get": {
        "description": "The llmstxt.org discovery file, rendered from this deployment's config.",
        "operationId": "llmsTxt",
        "responses": {
          "200": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The file."
          }
        },
        "security": [
          {}
        ],
        "summary": "llms.txt",
        "tags": [
          "meta"
        ]
      }
    },
    "/mcp": {
      "post": {
        "description": "The marketplace as agent tools. Public browsing and free report reads are anonymous; private account information and writes require a bearer credential. qmarket_create_topup_intent and qmarket_topup_status return the TopUpIntent object served by this API.",
        "operationId": "mcp",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "JSON-RPC response."
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "MCP (streamable HTTP)",
        "tags": [
          "meta"
        ]
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "openapi",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "OpenAPI 3.0.3."
          }
        },
        "security": [
          {}
        ],
        "summary": "This document",
        "tags": [
          "meta"
        ]
      }
    },
    "/robots.txt": {
      "get": {
        "description": "Allows every crawler and names the sitemap. Served from here because the Sitemap line has to be absolute and only this process knows the app's origin.",
        "operationId": "robotsTxt",
        "responses": {
          "200": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The file."
          }
        },
        "security": [
          {}
        ],
        "summary": "robots.txt",
        "tags": [
          "meta"
        ]
      }
    },
    "/schemas/{name}": {
      "get": {
        "description": "JSON Schema 2020-12 with every referenced component under $defs. The names are the keys of components.schemas here.",
        "operationId": "schema",
        "parameters": [
          {
            "description": "Component name, e.g. PaymentRequirements, Settlement, TopUpIntent, CreditsLedgerEntry, PaymentIntentStatus.",
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/schema+json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The schema."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "One component as a standalone JSON Schema",
        "tags": [
          "meta"
        ]
      }
    },
    "/sitemap.xml": {
      "get": {
        "description": "Every public question as a URL on the app origin, newest first, capped at 50,000. The path shape is /q/{slug}-{id}.",
        "operationId": "sitemap",
        "responses": {
          "200": {
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "A urlset."
          }
        },
        "security": [
          {}
        ],
        "summary": "Sitemap",
        "tags": [
          "meta"
        ]
      }
    },
    "/v1/accounts/agent": {
      "post": {
        "description": "How an agent with no human gets a key: one anonymous POST returns an agent account and its qm_sk_ key. The balance is 0 -- nothing is granted -- so fund it with a top-up intent (POST /v1/credits/topup/intent) or POST /v1/credits/topup before a paid read. Rate-limited to 20 per client address per 1h0m0s.",
        "operationId": "createAgentAccount",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "label": "my-research-agent",
                "wallet_address": "0x1111111111111111111111111111111111111111"
              },
              "schema": {
                "$ref": "#/components/schemas/AgentAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentAccount"
                }
              }
            },
            "description": "The account and its key, shown once."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {}
        ],
        "summary": "Create an agent account (no auth)",
        "tags": [
          "accounts"
        ]
      }
    },
    "/v1/accounts/key": {
      "post": {
        "description": "The way back in. An account opened by a settlement is handed its key once, in the response to the payment that created it; if that response is lost, the money moved and the credential did not arrive. Sign a SIWX proof for this service's origin, send it in SIGN-IN-WITH-X, and the account that wallet owns is issued a new key. Costs nothing and needs no balance: proving control of a wallet is not a payment. Rotating -- any previous key stops working, and the account owner is notified. A wallet that owns no account is wallet_unknown: a signature is free to produce and must not be able to create an account. Each proof is spent once.",
        "operationId": "mintWalletKey",
        "parameters": [
          {
            "$ref": "#/components/parameters/signInWithX"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "account_id": "acct_1",
                  "api_key": "qm_sk_...",
                  "label": "agent-k4m2p"
                },
                "schema": {
                  "$ref": "#/components/schemas/WalletKey"
                }
              }
            },
            "description": "A new key."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {}
        ],
        "summary": "Mint a key with a wallet signature (no bearer key)",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/accounts/label": {
      "post": {
        "description": "An account opened by a payment is displayed under a generated pseudonym, because the funder list is public and a wallet address on it is not something a funder chose to publish. This replaces it with a name you pick, authorized by a SIWX proof from the wallet that owns the account. Names are 3-32 characters of lowercase letters, digits and hyphens, unique among chosen names, and cannot start with agent- (that prefix is the generated ones). A name somebody else holds is label_taken.",
        "operationId": "setWalletLabel",
        "parameters": [
          {
            "$ref": "#/components/parameters/signInWithX"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "label": "orbital-research"
              },
              "schema": {
                "$ref": "#/components/schemas/SetLabelRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "account_id": "acct_1",
                  "label": "orbital-research"
                },
                "schema": {
                  "$ref": "#/components/schemas/WalletLabel"
                }
              }
            },
            "description": "The new name."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "security": [
          {}
        ],
        "summary": "Set your display name (wallet signature)",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/artifacts": {
      "get": {
        "operationId": "listArtifacts",
        "parameters": [
          {
            "description": "Filter to one entity.",
            "in": "query",
            "name": "entity",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/after"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactsPage"
                }
              }
            },
            "description": "A page."
          }
        },
        "security": [
          {}
        ],
        "summary": "Browse artifacts",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/v1/artifacts/{aid}/downloads": {
      "post": {
        "description": "The site calls this when someone copies a report or saves it as a PDF. The reader is the signed-in account, or the browser id in X-Qmarket-Client (16 to 64 of A-Z, a-z, 0-9, _ and -). Repeats by the same reader that day change nothing.",
        "operationId": "pageDownload",
        "parameters": [
          {
            "description": "Artifact id.",
            "in": "path",
            "name": "aid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "channel": "copy",
                "rev": 1
              },
              "schema": {
                "$ref": "#/components/schemas/PageDownloadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Counted."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "Count a copy or PDF from the question page",
        "tags": [
          "meta"
        ]
      }
    },
    "/v1/artifacts/{aid}/fresh": {
      "get": {
        "description": "The access rule decides first: funders and buyers of this revision read free (X-Qmarket-Access: owned), a revision past the freshness window is free, and one inside the head-start window is funders-only (403 headstart -- wait, do not retry). Otherwise it is for sale: a bearer key spends credits, X-PAYMENT settles USDC anonymously, and neither answers 402.",
        "operationId": "fresh",
        "parameters": [
          {
            "description": "Artifact id.",
            "in": "path",
            "name": "aid",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/paymentSignature"
          },
          {
            "$ref": "#/components/parameters/xPayment"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The revision.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "enum": [
                    "private, no-store"
                  ],
                  "type": "string"
                }
              },
              "PAYMENT-RESPONSE": {
                "$ref": "#/components/headers/PAYMENT-RESPONSE"
              },
              "X-Payment-Response": {
                "$ref": "#/components/headers/X-Payment-Response"
              },
              "X-Qmarket-Access": {
                "$ref": "#/components/headers/X-Qmarket-Access"
              },
              "X-Qmarket-Price-Cents": {
                "$ref": "#/components/headers/X-Qmarket-Price-Cents"
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "$ref": "#/components/responses/SettlementUnresolved"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "x402Payment": []
          },
          {}
        ],
        "summary": "Current revision (paid)",
        "tags": [
          "artifacts",
          "payments"
        ]
      }
    },
    "/v1/artifacts/{aid}/stale": {
      "get": {
        "description": "A revision is free once a newer one supersedes it or it ages past the freshness window. 404 no_free_revision while none has.",
        "operationId": "stale",
        "parameters": [
          {
            "description": "Artifact id.",
            "in": "path",
            "name": "aid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The revision.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "enum": [
                    "private, no-store"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "Newest freed revision (free)",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/v1/artifacts/{aid}/teaser": {
      "get": {
        "operationId": "teaser",
        "parameters": [
          {
            "description": "Artifact id.",
            "in": "path",
            "name": "aid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactSummary"
                }
              }
            },
            "description": "The summary."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "Teaser (free)",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/v1/auth/revoke": {
      "post": {
        "description": "An app's logout. Ends the refresh token's whole family. Unknown tokens answer 200, as the RFC requires.",
        "operationId": "appRevoke",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Revoked, or nothing to revoke."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "An OAuth error: {\"error\", \"error_description\"}."
          }
        },
        "security": [
          {}
        ],
        "summary": "Revoke an app refresh token (RFC 7009)",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/auth/token": {
      "post": {
        "description": "grant_type authorization_code (code, redirect_uri, code_verifier, client_id) or refresh_token (refresh_token, client_id). Refresh tokens rotate on every use; one presented again after its use revokes its whole family.",
        "operationId": "appToken",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "access_token, id_token, refresh_token, expires_in, token_type, scope."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "An OAuth error: {\"error\", \"error_description\"}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "An OAuth error: {\"error\", \"error_description\"}."
          }
        },
        "security": [
          {}
        ],
        "summary": "Exchange an app login code, or refresh",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/auth/userinfo": {
      "get": {
        "description": "The bearer is the app's access token, not a marketplace credential.",
        "operationId": "appUserinfo",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "sub and the claims the granted scopes allow."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "An OAuth error: {\"error\", \"error_description\"}."
          }
        },
        "security": [
          {}
        ],
        "summary": "The logged-in person, for an app access token",
        "tags": [
          "launchpad"
        ]
      },
      "post": {
        "description": "The bearer is the app's access token, not a marketplace credential.",
        "operationId": "appUserinfoPost",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "sub and the claims the granted scopes allow."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "An OAuth error: {\"error\", \"error_description\"}."
          }
        },
        "security": [
          {}
        ],
        "summary": "The logged-in person, for an app access token",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/chain": {
      "get": {
        "operationId": "chain",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChainInfo"
                }
              }
            },
            "description": "Network, USDC asset, pay-to and escrow descriptor."
          }
        },
        "security": [
          {}
        ],
        "summary": "On-chain rail configuration",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/credits/topup": {
      "post": {
        "description": "The one-request on-ramp: without a payment header it quotes a 402 for amount_cents, with or without a bearer key, so an x402 client can discover the price the standard way; with a payment header it settles and credits, and the bearer key is required then because credits have to land on an account. The caller drives the x402 retry itself. A client that cannot -- an MCP or GraphQL session, or a wallet that will not carry a bearer key -- should create a top-up intent instead.",
        "operationId": "topUp",
        "parameters": [
          {
            "$ref": "#/components/parameters/paymentSignature"
          },
          {
            "$ref": "#/components/parameters/xPayment"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "amount_cents": 500
              },
              "schema": {
                "$ref": "#/components/schemas/TopUpRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "credited_cents": 500,
                  "balance_credits": 1250,
                  "tx": "0xabc123",
                  "replay": false
                },
                "schema": {
                  "$ref": "#/components/schemas/TopUpResult"
                }
              }
            },
            "description": "Credited.",
            "headers": {
              "PAYMENT-RESPONSE": {
                "$ref": "#/components/headers/PAYMENT-RESPONSE"
              },
              "X-Payment-Response": {
                "$ref": "#/components/headers/X-Payment-Response"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "$ref": "#/components/responses/SettlementUnresolved"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "bearerAuth": [],
            "x402Payment": []
          }
        ],
        "summary": "Buy credits with USDC (same-request x402)",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/credits/topup/intent": {
      "post": {
        "description": "Mints a pending intent for amount_cents and returns everything needed to pay it: a URL under /v1/pay/topup/ that takes no bearer key, the exact 402 that URL answers with (sign accepts[0] without provoking it), and the status URL to poll. The intent id is the capability: holding it lets a wallet put money on this account and nothing else. Expires after 1h0m0s.",
        "operationId": "createTopUpIntent",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "amount_cents": 500
              },
              "schema": {
                "$ref": "#/components/schemas/TopUpRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "example": {
                  "intent_id": "xp_00000000example0",
                  "status": "pending",
                  "account_id": "acc_example",
                  "amount_cents": 500,
                  "credited_cents": 0,
                  "balance_credits": 0,
                  "tx": null,
                  "payer": null,
                  "detail": null,
                  "created_at": "2026-01-01T00:00:00Z",
                  "expires_at": "2026-01-01T01:00:00Z",
                  "updated_at": "2026-01-01T00:00:00Z",
                  "payment": {
                    "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                    "method": "POST",
                    "auth": "none",
                    "content_type": "application/json",
                    "body": null,
                    "x402": {
                      "version": 2,
                      "request_header": "PAYMENT-SIGNATURE",
                      "response_header": "PAYMENT-RESPONSE",
                      "encoding": "base64(json)",
                      "challenge": {
                        "x402Version": 2,
                        "error": "payment required",
                        "accepts": [
                          {
                            "scheme": "exact",
                            "network": "eip155:84532",
                            "amount": "5000000",
                            "maxAmountRequired": "5000000",
                            "resource": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                            "description": "Qmarket credits for acc_example",
                            "mimeType": "application/json",
                            "payTo": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                            "maxTimeoutSeconds": 60,
                            "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                            "extra": {
                              "name": "USDC",
                              "version": "2"
                            }
                          }
                        ],
                        "resource": {
                          "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                          "description": "Qmarket credits for acc_example",
                          "mimeType": "application/json"
                        },
                        "extensions": {
                          "bazaar": {
                            "info": {
                              "input": {
                                "body": {},
                                "bodyType": "json",
                                "method": "POST",
                                "type": "http"
                              },
                              "output": {
                                "type": "json"
                              }
                            },
                            "schema": {
                              "$schema": "https://json-schema.org/draft/2020-12/schema",
                              "properties": {
                                "input": {
                                  "properties": {
                                    "body": {
                                      "type": "object"
                                    },
                                    "bodyType": {
                                      "enum": [
                                        "json"
                                      ]
                                    },
                                    "method": {
                                      "enum": [
                                        "GET",
                                        "POST"
                                      ]
                                    },
                                    "type": {
                                      "const": "http"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "method"
                                  ],
                                  "type": "object"
                                },
                                "output": {
                                  "properties": {
                                    "type": {
                                      "enum": [
                                        "json",
                                        "text"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "type": "object"
                                }
                              },
                              "required": [
                                "input"
                              ],
                              "type": "object"
                            }
                          }
                        },
                        "chainId": 84532,
                        "eip712": {
                          "domain": {
                            "chainId": 84532,
                            "name": "USDC",
                            "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                            "version": "2"
                          },
                          "primaryType": "TransferWithAuthorization",
                          "types": {
                            "EIP712Domain": [
                              {
                                "name": "name",
                                "type": "string"
                              },
                              {
                                "name": "version",
                                "type": "string"
                              },
                              {
                                "name": "chainId",
                                "type": "uint256"
                              },
                              {
                                "name": "verifyingContract",
                                "type": "address"
                              }
                            ],
                            "TransferWithAuthorization": [
                              {
                                "name": "from",
                                "type": "address"
                              },
                              {
                                "name": "to",
                                "type": "address"
                              },
                              {
                                "name": "value",
                                "type": "uint256"
                              },
                              {
                                "name": "validAfter",
                                "type": "uint256"
                              },
                              {
                                "name": "validBefore",
                                "type": "uint256"
                              },
                              {
                                "name": "nonce",
                                "type": "bytes32"
                              }
                            ]
                          },
                          "message": {
                            "from": "\u003cyour address\u003e",
                            "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                            "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                            "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                            "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                            "value": "5000000"
                          },
                          "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
                        },
                        "retry": {
                          "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                          "header": "PAYMENT-SIGNATURE",
                          "note": "Sign accepts[0] -- the eip712 field is the document, complete but for from, validAfter, validBefore and nonce -- then send this exact request again, same method and same body and same bearer, with the signed payment in the header named here. X-PAYMENT is accepted for a v1 payload."
                        }
                      },
                      "chain_id": 84532,
                      "eip712": {
                        "domain": {
                          "chainId": 84532,
                          "name": "USDC",
                          "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                          "version": "2"
                        },
                        "primaryType": "TransferWithAuthorization",
                        "types": {
                          "EIP712Domain": [
                            {
                              "name": "name",
                              "type": "string"
                            },
                            {
                              "name": "version",
                              "type": "string"
                            },
                            {
                              "name": "chainId",
                              "type": "uint256"
                            },
                            {
                              "name": "verifyingContract",
                              "type": "address"
                            }
                          ],
                          "TransferWithAuthorization": [
                            {
                              "name": "from",
                              "type": "address"
                            },
                            {
                              "name": "to",
                              "type": "address"
                            },
                            {
                              "name": "value",
                              "type": "uint256"
                            },
                            {
                              "name": "validAfter",
                              "type": "uint256"
                            },
                            {
                              "name": "validBefore",
                              "type": "uint256"
                            },
                            {
                              "name": "nonce",
                              "type": "bytes32"
                            }
                          ]
                        },
                        "message": {
                          "from": "\u003cyour address\u003e",
                          "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                          "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                          "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                          "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                          "value": "5000000"
                        },
                        "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
                      }
                    }
                  },
                  "verify": {
                    "url": "https://api.qmarket.ghostagent.org/v1/credits/topup/intent/xp_00000000example0",
                    "method": "GET",
                    "auth": "bearer",
                    "credited_status": "credited",
                    "terminal_statuses": [
                      "credited",
                      "expired",
                      "failed",
                      "unresolved",
                      "duplicate"
                    ],
                    "poll_seconds": 5
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TopUpIntent"
                }
              }
            },
            "description": "The intent."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a top-up intent",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/credits/topup/intent/{id}": {
      "get": {
        "description": "The intent as its owner sees it. status is the field to watch; credited means the balance moved and balance_credits is the result. Another account's intent is 404.",
        "operationId": "getTopUpIntent",
        "parameters": [
          {
            "description": "Intent id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "intent_id": "xp_00000000example0",
                  "status": "pending",
                  "account_id": "acc_example",
                  "amount_cents": 500,
                  "credited_cents": 0,
                  "balance_credits": 0,
                  "tx": null,
                  "payer": null,
                  "detail": null,
                  "created_at": "2026-01-01T00:00:00Z",
                  "expires_at": "2026-01-01T01:00:00Z",
                  "updated_at": "2026-01-01T00:00:00Z",
                  "payment": {
                    "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                    "method": "POST",
                    "auth": "none",
                    "content_type": "application/json",
                    "body": null,
                    "x402": {
                      "version": 2,
                      "request_header": "PAYMENT-SIGNATURE",
                      "response_header": "PAYMENT-RESPONSE",
                      "encoding": "base64(json)",
                      "challenge": {
                        "x402Version": 2,
                        "error": "payment required",
                        "accepts": [
                          {
                            "scheme": "exact",
                            "network": "eip155:84532",
                            "amount": "5000000",
                            "maxAmountRequired": "5000000",
                            "resource": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                            "description": "Qmarket credits for acc_example",
                            "mimeType": "application/json",
                            "payTo": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                            "maxTimeoutSeconds": 60,
                            "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                            "extra": {
                              "name": "USDC",
                              "version": "2"
                            }
                          }
                        ],
                        "resource": {
                          "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                          "description": "Qmarket credits for acc_example",
                          "mimeType": "application/json"
                        },
                        "extensions": {
                          "bazaar": {
                            "info": {
                              "input": {
                                "body": {},
                                "bodyType": "json",
                                "method": "POST",
                                "type": "http"
                              },
                              "output": {
                                "type": "json"
                              }
                            },
                            "schema": {
                              "$schema": "https://json-schema.org/draft/2020-12/schema",
                              "properties": {
                                "input": {
                                  "properties": {
                                    "body": {
                                      "type": "object"
                                    },
                                    "bodyType": {
                                      "enum": [
                                        "json"
                                      ]
                                    },
                                    "method": {
                                      "enum": [
                                        "GET",
                                        "POST"
                                      ]
                                    },
                                    "type": {
                                      "const": "http"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "method"
                                  ],
                                  "type": "object"
                                },
                                "output": {
                                  "properties": {
                                    "type": {
                                      "enum": [
                                        "json",
                                        "text"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "type": "object"
                                }
                              },
                              "required": [
                                "input"
                              ],
                              "type": "object"
                            }
                          }
                        },
                        "chainId": 84532,
                        "eip712": {
                          "domain": {
                            "chainId": 84532,
                            "name": "USDC",
                            "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                            "version": "2"
                          },
                          "primaryType": "TransferWithAuthorization",
                          "types": {
                            "EIP712Domain": [
                              {
                                "name": "name",
                                "type": "string"
                              },
                              {
                                "name": "version",
                                "type": "string"
                              },
                              {
                                "name": "chainId",
                                "type": "uint256"
                              },
                              {
                                "name": "verifyingContract",
                                "type": "address"
                              }
                            ],
                            "TransferWithAuthorization": [
                              {
                                "name": "from",
                                "type": "address"
                              },
                              {
                                "name": "to",
                                "type": "address"
                              },
                              {
                                "name": "value",
                                "type": "uint256"
                              },
                              {
                                "name": "validAfter",
                                "type": "uint256"
                              },
                              {
                                "name": "validBefore",
                                "type": "uint256"
                              },
                              {
                                "name": "nonce",
                                "type": "bytes32"
                              }
                            ]
                          },
                          "message": {
                            "from": "\u003cyour address\u003e",
                            "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                            "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                            "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                            "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                            "value": "5000000"
                          },
                          "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
                        },
                        "retry": {
                          "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                          "header": "PAYMENT-SIGNATURE",
                          "note": "Sign accepts[0] -- the eip712 field is the document, complete but for from, validAfter, validBefore and nonce -- then send this exact request again, same method and same body and same bearer, with the signed payment in the header named here. X-PAYMENT is accepted for a v1 payload."
                        }
                      },
                      "chain_id": 84532,
                      "eip712": {
                        "domain": {
                          "chainId": 84532,
                          "name": "USDC",
                          "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                          "version": "2"
                        },
                        "primaryType": "TransferWithAuthorization",
                        "types": {
                          "EIP712Domain": [
                            {
                              "name": "name",
                              "type": "string"
                            },
                            {
                              "name": "version",
                              "type": "string"
                            },
                            {
                              "name": "chainId",
                              "type": "uint256"
                            },
                            {
                              "name": "verifyingContract",
                              "type": "address"
                            }
                          ],
                          "TransferWithAuthorization": [
                            {
                              "name": "from",
                              "type": "address"
                            },
                            {
                              "name": "to",
                              "type": "address"
                            },
                            {
                              "name": "value",
                              "type": "uint256"
                            },
                            {
                              "name": "validAfter",
                              "type": "uint256"
                            },
                            {
                              "name": "validBefore",
                              "type": "uint256"
                            },
                            {
                              "name": "nonce",
                              "type": "bytes32"
                            }
                          ]
                        },
                        "message": {
                          "from": "\u003cyour address\u003e",
                          "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                          "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                          "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                          "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                          "value": "5000000"
                        },
                        "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
                      }
                    }
                  },
                  "verify": {
                    "url": "https://api.qmarket.ghostagent.org/v1/credits/topup/intent/xp_00000000example0",
                    "method": "GET",
                    "auth": "bearer",
                    "credited_status": "credited",
                    "terminal_statuses": [
                      "credited",
                      "expired",
                      "failed",
                      "unresolved",
                      "duplicate"
                    ],
                    "poll_seconds": 5
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TopUpIntent"
                }
              }
            },
            "description": "The intent."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Verify a top-up intent",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/curation/{qid}/review": {
      "post": {
        "operationId": "review",
        "parameters": [
          {
            "description": "Question id.",
            "in": "path",
            "name": "qid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewResult"
                }
              }
            },
            "description": "Applied."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Human curation verdict",
        "tags": [
          "curation"
        ]
      }
    },
    "/v1/feed": {
      "get": {
        "operationId": "feed",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuestionsPage"
                }
              }
            },
            "description": "Questions ranked by the account's watches."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Personalized feed",
        "tags": [
          "questions"
        ]
      }
    },
    "/v1/feed-tokens": {
      "get": {
        "description": "Which readers are subscribed, so one of them can be told apart and revoked. Authorized like minting: a bearer key lists an account's tokens, and a CAIP-122 proof in SIGN-IN-WITH-X lists a wallet's -- which is how a subscriber with no account reaches the tokens it minted before signing up. An account also sees the tokens of every wallet it has attested, so signing up does not hide the URL you were already using. No secrets in the response: what is stored is a hash, and a route that took a token as a query parameter to list itself would write every reader's credential into a log. The proof spends a one-time nonce, so listing by signature takes a fresh one each time.",
        "operationId": "listFeedTokens",
        "parameters": [
          {
            "description": "A CAIP-122 proof that you control a wallet, base64-encoded, for a wallet with no account. Ignored when a bearer key is sent. Spent once.",
            "in": "header",
            "name": "SIGN-IN-WITH-X",
            "required": false,
            "schema": {
              "format": "byte",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedTokens"
                }
              }
            },
            "description": "The subject's live tokens."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "List your feed tokens",
        "tags": [
          "accounts"
        ]
      },
      "post": {
        "description": "A reader credential for /v1/updates, and nothing else: it cannot spend, fund or read a report. Two ways to authorize it. A bearer key mints one for that account. A CAIP-122 proof in SIGN-IN-WITH-X mints one for a wallet -- which is the case that has to work, because a wallet that bought a report over x402 and never signed up has no account to bear a key for and no other way to be told the report it paid for was refreshed. Mint one per reader, so revoking the one you pasted somewhere does not stop the others. `token` is returned exactly once and stored hashed; `url` is the feed with it already in the query string, ready to subscribe.",
        "operationId": "createFeedToken",
        "parameters": [
          {
            "description": "A CAIP-122 proof that you control a wallet, base64-encoded, for a wallet with no account. Ignored when a bearer key is sent.",
            "in": "header",
            "name": "SIGN-IN-WITH-X",
            "required": false,
            "schema": {
              "format": "byte",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "label": "netnewswire"
              },
              "schema": {
                "$ref": "#/components/schemas/FeedTokenRequest"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "id": "ft_68b0c1d2a1b2c3d4e5",
                  "label": "netnewswire",
                  "token": "qm_feed_...",
                  "url": "https://api.qmarket.ghostagent.org/v1/updates.atom?token=qm_feed_..."
                },
                "schema": {
                  "$ref": "#/components/schemas/FeedToken"
                }
              }
            },
            "description": "The token, shown once."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "Mint a feed token",
        "tags": [
          "accounts"
        ]
      }
    },
    "/v1/feed-tokens/{id}": {
      "delete": {
        "description": "Retires one token. The reader holding it stops working immediately; every other reader keeps going, which is the whole reason a subscriber can hold more than one. Authorized like the list: a bearer key for the account, or a fresh CAIP-122 proof for the wallet, so a wallet can revoke a token it minted before signing up. A token that is unknown, already revoked or not yours is 404 not_found -- one answer for all three, because telling them apart tells whoever is guessing which guesses were close.",
        "operationId": "revokeFeedToken",
        "parameters": [
          {
            "description": "Feed token id, from GET /v1/feed-tokens. Not the secret.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "A CAIP-122 proof that you control the wallet, base64-encoded, for a wallet with no account. Ignored when a bearer key is sent. Spent once.",
            "in": "header",
            "name": "SIGN-IN-WITH-X",
            "required": false,
            "schema": {
              "format": "byte",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            },
            "description": "Revoked."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "Revoke a feed token",
        "tags": [
          "accounts"
        ]
      }
    },
    "/v1/launch-drafts/{id}/messages": {
      "post": {
        "description": "The web app's route for talking to the launch agent as a creator: the same turn as the GraphQL mutation sendLaunchDraftMessage, answered as an event stream so the reply reads as it is written. `delta` events carry the reply's text in pieces; one `done` event carries the saved draft (the GraphQL LaunchDraftSession's fields); an `error` event carries the code and message the mutation would have returned (stale_draft, agent_failed, ...). `revision` must match the draft's current revision. Signed-in people only; agents use the mutation.",
        "operationId": "streamLaunchMessage",
        "parameters": [
          {
            "description": "Launch draft id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "revision": 0,
                "message": "A shared inbox for two-person support teams, flat $15 a month per inbox."
              },
              "schema": {
                "$ref": "#/components/schemas/LaunchMessage"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "example": "event: delta\ndata: {\"text\":\"Good brief. \"}\n\nevent: done\ndata: {\"id\":\"lds_01\",\"revision\":1}\n\n",
                  "type": "string"
                }
              }
            },
            "description": "An event stream: delta events with the reply's text, then one done event with the saved draft, or one error event."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "One turn of the launch conversation, streamed",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/ledger/credits": {
      "get": {
        "operationId": "creditsLedger",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditsLedger"
                }
              }
            },
            "description": "The ledger, newest first, 100 entries."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Credit balance and recent entries",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/ledger/royalties": {
      "get": {
        "operationId": "royaltiesLedger",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoyaltiesLedger"
                }
              }
            },
            "description": "Accruals by artifact and role."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Royalty accruals",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/pay/intent/{id}": {
      "get": {
        "description": "How the app confirms a payment. `status` is pending, paid, expired or failed; a paid checkout carries the payer and the transaction. No authentication; the id is the capability.",
        "operationId": "getPayment",
        "parameters": [
          {
            "description": "Checkout id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "id": "pay_68bf2c1a0123456789",
                  "project_id": "",
                  "status_url": "",
                  "amount_cents": 1999,
                  "currency": "USDG",
                  "reference": "",
                  "status": "paid",
                  "expires_at": "0001-01-01T00:00:00Z"
                },
                "schema": {
                  "$ref": "#/components/schemas/PaymentIntent"
                }
              }
            },
            "description": "The checkout."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {}
        ],
        "summary": "Read a hosted-checkout payment",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/pay/topup": {
      "post": {
        "description": "The way in for a wallet with no account. Takes no Authorization header, because the caller has none -- that is the situation this answers. Mints an unbound intent for amount_cents and returns the URL that pays it and the exact 402 that URL answers with. Nothing is created here: pay the intent and the settlement opens the account, binds it to the wallet that paid, credits it, and returns account_id with api_key on the initial verified request. A recovered settlement returns no key; prove the original wallet at POST /v1/accounts/key. An intent nobody pays expires after 1h0m0s having created no account and no key. A second payment from a wallet that already has an account is credited to it and returns no key, because the key was already issued.",
        "operationId": "createSignupIntent",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "amount_cents": 500
              },
              "schema": {
                "$ref": "#/components/schemas/TopUpRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "example": {
                  "intent_id": "xp_00000000example0",
                  "status": "pending",
                  "account_id": "acc_example",
                  "amount_cents": 500,
                  "credited_cents": 0,
                  "balance_credits": 0,
                  "tx": null,
                  "payer": null,
                  "detail": null,
                  "created_at": "2026-01-01T00:00:00Z",
                  "expires_at": "2026-01-01T01:00:00Z",
                  "updated_at": "2026-01-01T00:00:00Z",
                  "payment": {
                    "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                    "method": "POST",
                    "auth": "none",
                    "content_type": "application/json",
                    "body": null,
                    "x402": {
                      "version": 2,
                      "request_header": "PAYMENT-SIGNATURE",
                      "response_header": "PAYMENT-RESPONSE",
                      "encoding": "base64(json)",
                      "challenge": {
                        "x402Version": 2,
                        "error": "payment required",
                        "accepts": [
                          {
                            "scheme": "exact",
                            "network": "eip155:84532",
                            "amount": "5000000",
                            "maxAmountRequired": "5000000",
                            "resource": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                            "description": "Qmarket credits for acc_example",
                            "mimeType": "application/json",
                            "payTo": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                            "maxTimeoutSeconds": 60,
                            "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                            "extra": {
                              "name": "USDC",
                              "version": "2"
                            }
                          }
                        ],
                        "resource": {
                          "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                          "description": "Qmarket credits for acc_example",
                          "mimeType": "application/json"
                        },
                        "extensions": {
                          "bazaar": {
                            "info": {
                              "input": {
                                "body": {},
                                "bodyType": "json",
                                "method": "POST",
                                "type": "http"
                              },
                              "output": {
                                "type": "json"
                              }
                            },
                            "schema": {
                              "$schema": "https://json-schema.org/draft/2020-12/schema",
                              "properties": {
                                "input": {
                                  "properties": {
                                    "body": {
                                      "type": "object"
                                    },
                                    "bodyType": {
                                      "enum": [
                                        "json"
                                      ]
                                    },
                                    "method": {
                                      "enum": [
                                        "GET",
                                        "POST"
                                      ]
                                    },
                                    "type": {
                                      "const": "http"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "method"
                                  ],
                                  "type": "object"
                                },
                                "output": {
                                  "properties": {
                                    "type": {
                                      "enum": [
                                        "json",
                                        "text"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "type": "object"
                                }
                              },
                              "required": [
                                "input"
                              ],
                              "type": "object"
                            }
                          }
                        },
                        "chainId": 84532,
                        "eip712": {
                          "domain": {
                            "chainId": 84532,
                            "name": "USDC",
                            "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                            "version": "2"
                          },
                          "primaryType": "TransferWithAuthorization",
                          "types": {
                            "EIP712Domain": [
                              {
                                "name": "name",
                                "type": "string"
                              },
                              {
                                "name": "version",
                                "type": "string"
                              },
                              {
                                "name": "chainId",
                                "type": "uint256"
                              },
                              {
                                "name": "verifyingContract",
                                "type": "address"
                              }
                            ],
                            "TransferWithAuthorization": [
                              {
                                "name": "from",
                                "type": "address"
                              },
                              {
                                "name": "to",
                                "type": "address"
                              },
                              {
                                "name": "value",
                                "type": "uint256"
                              },
                              {
                                "name": "validAfter",
                                "type": "uint256"
                              },
                              {
                                "name": "validBefore",
                                "type": "uint256"
                              },
                              {
                                "name": "nonce",
                                "type": "bytes32"
                              }
                            ]
                          },
                          "message": {
                            "from": "\u003cyour address\u003e",
                            "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                            "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                            "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                            "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                            "value": "5000000"
                          },
                          "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
                        },
                        "retry": {
                          "url": "https://api.qmarket.ghostagent.org/v1/pay/topup/xp_00000000example0",
                          "header": "PAYMENT-SIGNATURE",
                          "note": "Sign accepts[0] -- the eip712 field is the document, complete but for from, validAfter, validBefore and nonce -- then send this exact request again, same method and same body and same bearer, with the signed payment in the header named here. X-PAYMENT is accepted for a v1 payload."
                        }
                      },
                      "chain_id": 84532,
                      "eip712": {
                        "domain": {
                          "chainId": 84532,
                          "name": "USDC",
                          "verifyingContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
                          "version": "2"
                        },
                        "primaryType": "TransferWithAuthorization",
                        "types": {
                          "EIP712Domain": [
                            {
                              "name": "name",
                              "type": "string"
                            },
                            {
                              "name": "version",
                              "type": "string"
                            },
                            {
                              "name": "chainId",
                              "type": "uint256"
                            },
                            {
                              "name": "verifyingContract",
                              "type": "address"
                            }
                          ],
                          "TransferWithAuthorization": [
                            {
                              "name": "from",
                              "type": "address"
                            },
                            {
                              "name": "to",
                              "type": "address"
                            },
                            {
                              "name": "value",
                              "type": "uint256"
                            },
                            {
                              "name": "validAfter",
                              "type": "uint256"
                            },
                            {
                              "name": "validBefore",
                              "type": "uint256"
                            },
                            {
                              "name": "nonce",
                              "type": "bytes32"
                            }
                          ]
                        },
                        "message": {
                          "from": "\u003cyour address\u003e",
                          "nonce": "\u003c0x + 32 random bytes as hex; never reuse one\u003e",
                          "to": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
                          "validAfter": "\u003cunix seconds, a few minutes in the past\u003e",
                          "validBefore": "\u003cunix seconds, at most 60 ahead of now\u003e",
                          "value": "5000000"
                        },
                        "fill": "Replace from, validAfter, validBefore and nonce; sign the result with eth_signTypedData_v4 (the domain is the USDC contract's, not this service's). Then send base64({\"x402Version\":2,\"payload\":{\"signature\":\u003csig\u003e,\"authorization\":\u003cmessage\u003e},\"accepted\":\u003cthe accepts entry you signed\u003e}) in the PAYMENT-SIGNATURE header. A v1 payload in X-PAYMENT is still accepted. value and the message fields are decimal strings."
                      }
                    }
                  },
                  "verify": {
                    "url": "https://api.qmarket.ghostagent.org/v1/credits/topup/intent/xp_00000000example0",
                    "method": "GET",
                    "auth": "bearer",
                    "credited_status": "credited",
                    "terminal_statuses": [
                      "credited",
                      "expired",
                      "failed",
                      "unresolved",
                      "duplicate"
                    ],
                    "poll_seconds": 5
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TopUpIntent"
                }
              }
            },
            "description": "The intent."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {}
        ],
        "summary": "Open an account by paying (no bearer key)",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/pay/topup/{id}": {
      "post": {
        "description": "The wallet half of the intent. No body, no Authorization header. Without PAYMENT-SIGNATURE (or legacy X-PAYMENT): the 402 for the intent's amount. With it: settle and credit the intent's account, answering 200 with PAYMENT-RESPONSE and legacy X-Payment-Response when network evidence is available. The public body omits balance_credits; the owner status URL returns it. Idempotent -- the same payment retried answers the same result with replay: true, and a settlement whose credit did not land the first time is completed rather than charged again. A refused payment answers 402 again with error naming why; nothing was charged and the intent stays payable. An in-flight or uncertain settlement is non-payable and must not be paid again. Signup recovery delivers credits without a key; use POST /v1/accounts/key with fresh wallet proof.",
        "operationId": "payTopUpIntent",
        "parameters": [
          {
            "description": "Intent id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/paymentSignature"
          },
          {
            "$ref": "#/components/parameters/xPayment"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "intent_id": "xp_00000000example0",
                  "credited_cents": 500,
                  "tx": "0xabc123",
                  "replay": false,
                  "account_id": "acc_example"
                },
                "schema": {
                  "$ref": "#/components/schemas/PublicTopUpResult"
                }
              }
            },
            "description": "Credited.",
            "headers": {
              "PAYMENT-RESPONSE": {
                "$ref": "#/components/headers/PAYMENT-RESPONSE"
              },
              "X-Payment-Response": {
                "$ref": "#/components/headers/X-Payment-Response"
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "502": {
            "$ref": "#/components/responses/SettlementUnresolved"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {
            "x402Payment": []
          },
          {}
        ],
        "summary": "Pay a top-up intent (no bearer key)",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/platform-activity": {
      "get": {
        "description": "reports_funded counts questions whose round met its budget (funded, answering or answered). report_downloads counts reports taken: a copy or a PDF saved from the question page, or a full fetch through the REST API or MCP. Viewing a report on the site is not a download. One reader of one revision counts once a UTC day. Cached for a minute.",
        "operationId": "platformActivity",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "reports_funded": 42,
                  "report_downloads": 310
                },
                "schema": {
                  "$ref": "#/components/schemas/PlatformActivity"
                }
              }
            },
            "description": "The two totals."
          }
        },
        "security": [
          {}
        ],
        "summary": "Homepage activity",
        "tags": [
          "meta"
        ]
      }
    },
    "/v1/projects/{pid}/builder/events": {
      "post": {
        "description": "Called by the builder for a job the marketplace created at settlement. Authenticated by X-Builder-Signature, the hex HMAC-SHA256 of the raw body under the shared callback secret (a sha256= prefix is accepted). Idempotent on event_id: a replay answers 200 with duplicate: true and changes nothing. An event older than the newest one already applied is refused as stale_event; one for a job this project does not own is refused as unknown_job. deployed opens the delivery review window; failed refunds every backer and closes the project.",
        "operationId": "builderCallback",
        "parameters": [
          {
            "description": "Project id.",
            "in": "path",
            "name": "pid",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Builder-Signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "event_id": "evt_01",
                "job_id": "job_68bf2c1a0123456789",
                "type": "building",
                "at": "0001-01-01T00:00:00Z",
                "payload_version": "1"
              },
              "schema": {
                "$ref": "#/components/schemas/BuilderCallback"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "duplicate": false,
                  "state": "building"
                },
                "schema": {
                  "$ref": "#/components/schemas/BuilderEventResult"
                }
              }
            },
            "description": "Applied, or already applied."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "Builder status callback",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/projects/{pid}/image/{key}": {
      "get": {
        "description": "The URL a project's GraphQL imageUrl names when the image is stored on Qmarket. The key is derived from the image, so a changed image has a new URL and a response can be cached for good. A key that does not match the project's current image is not found.",
        "operationId": "projectImage",
        "parameters": [
          {
            "description": "Project id.",
            "in": "path",
            "name": "pid",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The image's content key, as imageUrl gives it.",
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "image/jpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The image."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "A project's image",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/projects/{pid}/pay": {
      "post": {
        "description": "Called by the deployed app to charge one of its users. No authentication: the page this produces can only pay the project's own revenue vault and return to the app's own host. `reference` is the app's order id and makes the call idempotent while the checkout is pending; `return_url` must be a page on the app's live or preview host. Redirect the user to `url`; they come back to `return_url?qm_intent=\u003cid\u003e\u0026status=paid|canceled`. Confirm with `status_url` and trust only `status: paid`.",
        "operationId": "createProjectPayment",
        "parameters": [
          {
            "description": "Project id.",
            "in": "path",
            "name": "pid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "amount_cents": 1999,
                "reference": "order_1042",
                "return_url": "https://app.example/orders/1042"
              },
              "schema": {
                "$ref": "#/components/schemas/PaymentIntentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "example": {
                  "id": "pay_68bf2c1a0123456789",
                  "project_id": "",
                  "status_url": "",
                  "amount_cents": 1999,
                  "currency": "USDG",
                  "reference": "",
                  "status": "pending",
                  "expires_at": "0001-01-01T00:00:00Z"
                },
                "schema": {
                  "$ref": "#/components/schemas/PaymentIntent"
                }
              }
            },
            "description": "The checkout."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {}
        ],
        "summary": "Open a hosted checkout for a project's app",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/projects/{pid}/revenue": {
      "post": {
        "description": "Called by the deployed app with the project's own qm_rk_ key as the bearer (minted by the creator or the team over GraphQL; rotating it revokes the previous one). Idempotent on receipt_id. A refund or processing_fee must name a receipt already reported. Events for a month that has already been distributed are refused as period_closed.",
        "operationId": "reportProjectRevenue",
        "parameters": [
          {
            "description": "Project id.",
            "in": "path",
            "name": "pid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "receipt_id": "rcpt_9f3",
                "kind": "receipt",
                "amount_cents": 600,
                "currency": "USDC",
                "occurred_at": "0001-01-01T00:00:00Z"
              },
              "schema": {
                "$ref": "#/components/schemas/RevenueEventRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "duplicate": false,
                  "period": "2026-09"
                },
                "schema": {
                  "$ref": "#/components/schemas/RevenueEventResult"
                }
              }
            },
            "description": "Recorded, or already recorded."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Report a revenue event",
        "tags": [
          "launchpad"
        ]
      }
    },
    "/v1/questions": {
      "get": {
        "operationId": "listQuestions",
        "parameters": [
          {
            "description": "Filter by status.",
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "listed",
                "funded",
                "answered"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter to one entity, e.g. MRNA.",
            "in": "query",
            "name": "entity",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Free-text search.",
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Ranking.",
            "in": "query",
            "name": "sort",
            "schema": {
              "enum": [
                "relevance",
                "raised",
                "budget",
                "forecasters",
                "newest"
              ],
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/after"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuestionsPage"
                }
              }
            },
            "description": "A page."
          }
        },
        "security": [
          {}
        ],
        "summary": "Browse questions",
        "tags": [
          "questions"
        ]
      },
      "post": {
        "description": "Free. Curation is attempted inline; the response can be listed, rejected, duplicate, or still curating when curation is unavailable. Only fund a listed result. Ordinary detail reads hide curating, rejected, and duplicate submissions behind the same 404 not_found as a missing ID; public search can find an existing listed match.",
        "operationId": "listQuestion",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "budget_cents": 2000,
                "entities": [
                  "MRNA"
                ],
                "text": "Will MRNA report positive phase 3 data for its flu vaccine by Q2 2027?"
              },
              "schema": {
                "$ref": "#/components/schemas/ListQuestionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListQuestionResult"
                }
              }
            },
            "description": "Curation result or pending curation."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "List a question",
        "tags": [
          "questions"
        ]
      }
    },
    "/v1/questions/{qid}": {
      "get": {
        "operationId": "getQuestion",
        "parameters": [
          {
            "description": "Question id.",
            "in": "path",
            "name": "qid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Question"
                }
              }
            },
            "description": "The question."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {}
        ],
        "summary": "One question",
        "tags": [
          "questions"
        ]
      }
    },
    "/v1/questions/{qid}/fund": {
      "post": {
        "description": "A bearer key spends credits. A bearer key plus PAYMENT-SIGNATURE (or legacy X-PAYMENT) settles USDC over x402 instead -- the header decides the rail. Funding always needs an account, because the funder reads free afterwards. On expiry, credit-funded positions are refunded in credits; x402 positions await an external refund and are not automatically granted credits. Eligible listed or funded questions accept contributions up to remaining proposal capacity. Preflight checks run before settlement, but concurrent changes or interrupted delivery can require reconciliation.",
        "operationId": "fundQuestion",
        "parameters": [
          {
            "description": "Question id.",
            "in": "path",
            "name": "qid",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/paymentSignature"
          },
          {
            "$ref": "#/components/parameters/xPayment"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "amount_cents": 500
              },
              "schema": {
                "$ref": "#/components/schemas/FundRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FundResult"
                }
              }
            },
            "description": "Escrowed.",
            "headers": {
              "PAYMENT-RESPONSE": {
                "$ref": "#/components/headers/PAYMENT-RESPONSE"
              },
              "X-Payment-Response": {
                "$ref": "#/components/headers/X-Payment-Response"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "$ref": "#/components/responses/SettlementUnresolved"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "bearerAuth": [],
            "x402Payment": []
          }
        ],
        "summary": "Fund a question",
        "tags": [
          "questions",
          "payments"
        ]
      }
    },
    "/v1/runs/claim": {
      "post": {
        "operationId": "claimRun",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaimedRun"
                }
              }
            },
            "description": "A run, now running."
          },
          "204": {
            "description": "Nothing scheduled."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Claim the next scheduled run",
        "tags": [
          "executor"
        ]
      }
    },
    "/v1/runs/{rid}/fail": {
      "post": {
        "operationId": "failRun",
        "parameters": [
          {
            "description": "Run id.",
            "in": "path",
            "name": "rid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FailRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            },
            "description": "Recorded."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Record a failed run",
        "tags": [
          "executor"
        ]
      }
    },
    "/v1/runs/{rid}/publish": {
      "post": {
        "operationId": "publishRun",
        "parameters": [
          {
            "description": "Run id.",
            "in": "path",
            "name": "rid",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishResult"
                }
              }
            },
            "description": "The revision written (or the one already written for this run)."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Publish a run's report",
        "tags": [
          "executor"
        ]
      }
    },
    "/v1/stripe/checkout": {
      "post": {
        "operationId": "stripeCheckout",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "pack": "20"
              },
              "schema": {
                "$ref": "#/components/schemas/CheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkout"
                }
              }
            },
            "description": "Redirect the payer to checkout_url."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/X402NotConfigured"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start a Stripe Checkout for credits",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/stripe/webhook": {
      "post": {
        "description": "Called by Stripe, authenticated by Stripe-Signature. Crediting is idempotent on the session id.",
        "operationId": "stripeWebhook",
        "parameters": [
          {
            "in": "header",
            "name": "Stripe-Signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookResult"
                }
              }
            },
            "description": "Applied."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        },
        "security": [
          {}
        ],
        "summary": "Stripe webhook",
        "tags": [
          "payments"
        ]
      }
    },
    "/v1/updates": {
      "get": {
        "description": "Publishes on the questions you hold a stake in -- one you asked, funded, bought a report from, or followed with POST /v1/watches -- newest first. Nothing else appears, so this is the refresh notice for research you have already paid for.\n\nTwo credentials reach it and they are not interchangeable. A bearer key reads its own account's feed. A feed token, minted at POST /v1/feed-tokens and sent as ?token=, is what a feed reader can be handed: a URL is the only thing one can be given, and the token can do nothing but read this. The token wins when both are present -- a subscriber who pasted a URL is asking for that URL's feed, and quietly serving their own account's would make a revoked token look like it still works.\n\nTo poll for new publishes: keep the ETag and send it back as If-None-Match, and an unchanged feed answers 304 with no body. To page back through older publishes: pass ?after= the numeric part of the oldest entry id you have (`urn:qmarket:event:1234` gives `after=1234`), and each page returns the entries just older than it. Entry ids are event ids and events are append-only, so this ordering is total even when two artifacts publish in the same microsecond. `after` walks backward from the newest, so it is a history cursor, not a \"since I last looked\" one: new publishes are found by refetching the newest page, which the ETag makes cheap.\n\nThis path negotiates on Accept and serves Atom to anything else, including */*, which is what a reader that states no preference wants. Subscribe to /v1/updates.atom or /v1/updates.json to be sure of the format.",
        "operationId": "updates",
        "parameters": [
          {
            "description": "A feed token (qm_feed_...). The credential a feed reader can carry; the alternative is a bearer key.",
            "in": "query",
            "name": "token",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Exclusive event-id upper bound for backward pagination. Omit or use 0 for the newest page; a positive value returns the entries older than it.",
            "in": "query",
            "name": "after",
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Entries to return. Defaults to 50 and is clamped to 200; an unbounded feed is a scan of every publish there has ever been.",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/ifNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/atom+xml; charset=utf-8": {},
              "application/feed+json; charset=utf-8": {}
            },
            "description": "Atom 1.0, or JSON Feed 1.1 if Accept asked for it.",
            "headers": {
              "Cache-Control": {
                "description": "private, no-store. The token is in the URL, so this document must never reach a shared cache.",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Referrer-Policy": {
                "$ref": "#/components/headers/Referrer-Policy"
              }
            }
          },
          "304": {
            "description": "Nothing has changed since the ETag you sent. No body."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "Your updates feed",
        "tags": [
          "questions",
          "accounts"
        ]
      }
    },
    "/v1/updates.atom": {
      "get": {
        "description": "Publishes on the questions you hold a stake in -- one you asked, funded, bought a report from, or followed with POST /v1/watches -- newest first. Nothing else appears, so this is the refresh notice for research you have already paid for.\n\nTwo credentials reach it and they are not interchangeable. A bearer key reads its own account's feed. A feed token, minted at POST /v1/feed-tokens and sent as ?token=, is what a feed reader can be handed: a URL is the only thing one can be given, and the token can do nothing but read this. The token wins when both are present -- a subscriber who pasted a URL is asking for that URL's feed, and quietly serving their own account's would make a revoked token look like it still works.\n\nTo poll for new publishes: keep the ETag and send it back as If-None-Match, and an unchanged feed answers 304 with no body. To page back through older publishes: pass ?after= the numeric part of the oldest entry id you have (`urn:qmarket:event:1234` gives `after=1234`), and each page returns the entries just older than it. Entry ids are event ids and events are append-only, so this ordering is total even when two artifacts publish in the same microsecond. `after` walks backward from the newest, so it is a history cursor, not a \"since I last looked\" one: new publishes are found by refetching the newest page, which the ETag makes cheap.\n\nAlways Atom 1.0. This is the URL to hand a feed reader.",
        "operationId": "updatesAtom",
        "parameters": [
          {
            "description": "A feed token (qm_feed_...). The credential a feed reader can carry; the alternative is a bearer key.",
            "in": "query",
            "name": "token",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Exclusive event-id upper bound for backward pagination. Omit or use 0 for the newest page; a positive value returns the entries older than it.",
            "in": "query",
            "name": "after",
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Entries to return. Defaults to 50 and is clamped to 200; an unbounded feed is a scan of every publish there has ever been.",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/ifNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/atom+xml; charset=utf-8": {}
            },
            "description": "Atom 1.0.",
            "headers": {
              "Cache-Control": {
                "description": "private, no-store. The token is in the URL, so this document must never reach a shared cache.",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Referrer-Policy": {
                "$ref": "#/components/headers/Referrer-Policy"
              }
            }
          },
          "304": {
            "description": "Nothing has changed since the ETag you sent. No body."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "Your updates feed (Atom)",
        "tags": [
          "questions",
          "accounts"
        ]
      }
    },
    "/v1/updates.json": {
      "get": {
        "description": "Publishes on the questions you hold a stake in -- one you asked, funded, bought a report from, or followed with POST /v1/watches -- newest first. Nothing else appears, so this is the refresh notice for research you have already paid for.\n\nTwo credentials reach it and they are not interchangeable. A bearer key reads its own account's feed. A feed token, minted at POST /v1/feed-tokens and sent as ?token=, is what a feed reader can be handed: a URL is the only thing one can be given, and the token can do nothing but read this. The token wins when both are present -- a subscriber who pasted a URL is asking for that URL's feed, and quietly serving their own account's would make a revoked token look like it still works.\n\nTo poll for new publishes: keep the ETag and send it back as If-None-Match, and an unchanged feed answers 304 with no body. To page back through older publishes: pass ?after= the numeric part of the oldest entry id you have (`urn:qmarket:event:1234` gives `after=1234`), and each page returns the entries just older than it. Entry ids are event ids and events are append-only, so this ordering is total even when two artifacts publish in the same microsecond. `after` walks backward from the newest, so it is a history cursor, not a \"since I last looked\" one: new publishes are found by refetching the newest page, which the ETag makes cheap.\n\nAlways JSON Feed 1.1 (jsonfeed.org/version/1.1). This is the one to poll from code: `items[].id` has the form `urn:qmarket:event:\u003cid\u003e`; use the numeric portion of the last item's id as `after` to request the next older page. `items[].tags` carries the event kind, artifact.published or artifact.refreshed.",
        "operationId": "updatesJSON",
        "parameters": [
          {
            "description": "A feed token (qm_feed_...). The credential a feed reader can carry; the alternative is a bearer key.",
            "in": "query",
            "name": "token",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Exclusive event-id upper bound for backward pagination. Omit or use 0 for the newest page; a positive value returns the entries older than it.",
            "in": "query",
            "name": "after",
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Entries to return. Defaults to 50 and is clamped to 200; an unbounded feed is a scan of every publish there has ever been.",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/ifNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/feed+json; charset=utf-8": {}
            },
            "description": "JSON Feed 1.1.",
            "headers": {
              "Cache-Control": {
                "description": "private, no-store. The token is in the URL, so this document must never reach a shared cache.",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Referrer-Policy": {
                "$ref": "#/components/headers/Referrer-Policy"
              }
            }
          },
          "304": {
            "description": "Nothing has changed since the ETag you sent. No body."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "summary": "Your updates feed (JSON Feed)",
        "tags": [
          "questions",
          "accounts"
        ]
      }
    },
    "/v1/watches": {
      "delete": {
        "description": "The undo for POST /v1/watches, with the same key in the query string rather than a body. Unfollowing something you were not following answers 200: the caller is in the state they asked for, and reporting a failure for arriving at the right answer only invites a retry that cannot help.",
        "operationId": "unwatch",
        "parameters": [
          {
            "description": "What the key names. Defaults to entity.",
            "in": "query",
            "name": "kind",
            "schema": {
              "enum": [
                "entity",
                "question"
              ],
              "type": "string"
            }
          },
          {
            "description": "The entity or question id to stop following. Entity keys are matched case-insensitively; a question id is not.",
            "in": "query",
            "name": "key",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            },
            "description": "Not following it any more."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Stop following an entity or a question",
        "tags": [
          "accounts"
        ]
      },
      "post": {
        "description": "Two kinds. An entity -- a ticker, a name -- ranks that subject's questions above the general listing in /v1/feed, and its key is free text on purpose: following something nobody has asked about yet is the point. A question puts the account in the audience for that one question, so a publish on it shows up in /v1/updates without the account having funded or bought anything; its key is a question id, and one that names no row is refused 404 not_found rather than stored as a watch that can never fire. Following the same key twice is a no-op, not an error.",
        "operationId": "watch",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "key": "q_68b0c1d2a1b2c3d4e5",
                "kind": "question"
              },
              "schema": {
                "$ref": "#/components/schemas/WatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            },
            "description": "Watching."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Follow an entity or a question",
        "tags": [
          "accounts"
        ]
      }
    },
    "/x402/discovery/resources": {
      "get": {
        "description": "This deployment's x402-paid resources in the discovery listing shape of the x402 v2 specification (§8), Self-hosted listing. Responses use x402 v2; legacy v1 payment inputs remain supported. Empty when x402 is not configured.",
        "operationId": "discoveryResources",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryListing"
                }
              }
            },
            "description": "The listing."
          }
        },
        "security": [
          {}
        ],
        "summary": "x402 discovery listing",
        "tags": [
          "meta",
          "payments"
        ]
      }
    }
  },
  "security": [
    {}
  ],
  "servers": [
    {
      "url": "https://api.qmarket.ghostagent.org"
    }
  ],
  "tags": [
    {
      "description": "Discovery: the index, health, llms.txt, this document, the schemas.",
      "name": "meta"
    },
    {
      "name": "questions"
    },
    {
      "name": "artifacts"
    },
    {
      "description": "Credits, x402 top-ups, Stripe, ledgers.",
      "name": "payments"
    },
    {
      "name": "accounts"
    },
    {
      "description": "Internal accounts only: the run queue.",
      "name": "executor"
    },
    {
      "description": "Internal accounts only.",
      "name": "curation"
    },
    {
      "description": "The project launchpad's machine callers: the builder's signed status callbacks and the deployed app's revenue events. People use /graphql.",
      "name": "launchpad"
    }
  ],
  "x-json-schemas": [
    "https://api.qmarket.ghostagent.org/schemas/AgentAccount",
    "https://api.qmarket.ghostagent.org/schemas/AgentAccountRequest",
    "https://api.qmarket.ghostagent.org/schemas/ArtifactSummary",
    "https://api.qmarket.ghostagent.org/schemas/ArtifactsPage",
    "https://api.qmarket.ghostagent.org/schemas/BuilderCallback",
    "https://api.qmarket.ghostagent.org/schemas/BuilderEventResult",
    "https://api.qmarket.ghostagent.org/schemas/ChainInfo",
    "https://api.qmarket.ghostagent.org/schemas/Checkout",
    "https://api.qmarket.ghostagent.org/schemas/CheckoutRequest",
    "https://api.qmarket.ghostagent.org/schemas/ClaimedRun",
    "https://api.qmarket.ghostagent.org/schemas/CreditsLedger",
    "https://api.qmarket.ghostagent.org/schemas/CreditsLedgerEntry",
    "https://api.qmarket.ghostagent.org/schemas/DiscoveryListing",
    "https://api.qmarket.ghostagent.org/schemas/EIP712Field",
    "https://api.qmarket.ghostagent.org/schemas/EIP712TypedData",
    "https://api.qmarket.ghostagent.org/schemas/Error",
    "https://api.qmarket.ghostagent.org/schemas/ErrorBody",
    "https://api.qmarket.ghostagent.org/schemas/FailRunRequest",
    "https://api.qmarket.ghostagent.org/schemas/FeedToken",
    "https://api.qmarket.ghostagent.org/schemas/FeedTokenInfo",
    "https://api.qmarket.ghostagent.org/schemas/FeedTokenRequest",
    "https://api.qmarket.ghostagent.org/schemas/FeedTokens",
    "https://api.qmarket.ghostagent.org/schemas/FundRequest",
    "https://api.qmarket.ghostagent.org/schemas/FundResult",
    "https://api.qmarket.ghostagent.org/schemas/Health",
    "https://api.qmarket.ghostagent.org/schemas/LaunchMessage",
    "https://api.qmarket.ghostagent.org/schemas/ListQuestionRequest",
    "https://api.qmarket.ghostagent.org/schemas/ListQuestionResult",
    "https://api.qmarket.ghostagent.org/schemas/Ok",
    "https://api.qmarket.ghostagent.org/schemas/PageDownloadRequest",
    "https://api.qmarket.ghostagent.org/schemas/PaymentAuthorization",
    "https://api.qmarket.ghostagent.org/schemas/PaymentIntent",
    "https://api.qmarket.ghostagent.org/schemas/PaymentIntentRequest",
    "https://api.qmarket.ghostagent.org/schemas/PaymentIntentStatus",
    "https://api.qmarket.ghostagent.org/schemas/PaymentPayload",
    "https://api.qmarket.ghostagent.org/schemas/PaymentRequired",
    "https://api.qmarket.ghostagent.org/schemas/PaymentRequirements",
    "https://api.qmarket.ghostagent.org/schemas/PlatformActivity",
    "https://api.qmarket.ghostagent.org/schemas/PublicTopUpResult",
    "https://api.qmarket.ghostagent.org/schemas/PublishRequest",
    "https://api.qmarket.ghostagent.org/schemas/PublishResult",
    "https://api.qmarket.ghostagent.org/schemas/Question",
    "https://api.qmarket.ghostagent.org/schemas/QuestionsPage",
    "https://api.qmarket.ghostagent.org/schemas/RevenueEventRequest",
    "https://api.qmarket.ghostagent.org/schemas/RevenueEventResult",
    "https://api.qmarket.ghostagent.org/schemas/ReviewRequest",
    "https://api.qmarket.ghostagent.org/schemas/ReviewResult",
    "https://api.qmarket.ghostagent.org/schemas/RoyaltiesLedger",
    "https://api.qmarket.ghostagent.org/schemas/RoyaltyLedgerEntry",
    "https://api.qmarket.ghostagent.org/schemas/SetLabelRequest",
    "https://api.qmarket.ghostagent.org/schemas/Settlement",
    "https://api.qmarket.ghostagent.org/schemas/TopUpIntent",
    "https://api.qmarket.ghostagent.org/schemas/TopUpPayment",
    "https://api.qmarket.ghostagent.org/schemas/TopUpRequest",
    "https://api.qmarket.ghostagent.org/schemas/TopUpResult",
    "https://api.qmarket.ghostagent.org/schemas/TopUpVerify",
    "https://api.qmarket.ghostagent.org/schemas/TopUpX402",
    "https://api.qmarket.ghostagent.org/schemas/WalletKey",
    "https://api.qmarket.ghostagent.org/schemas/WalletLabel",
    "https://api.qmarket.ghostagent.org/schemas/WatchRequest",
    "https://api.qmarket.ghostagent.org/schemas/WebhookResult"
  ],
  "x-x402": {
    "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
    "bounds": {
      "budgetCents": {
        "max": 100000,
        "min": 100,
        "zeroMeansUnset": true
      },
      "deepTierFrom": 2000,
      "fundCents": {
        "max": 1000000,
        "min": 1
      },
      "topUpCents": {
        "max": 1000000,
        "min": 100
      }
    },
    "chainId": 84532,
    "discovery": "https://api.qmarket.ghostagent.org/x402/discovery/resources",
    "enabled": true,
    "facilitator": "https://api.cdp.coinbase.com/platform/v2/x402",
    "network": "eip155:84532",
    "networkName": "base-sepolia",
    "payTo": "0xd24961d32C459170A6784220858Cf41C5c4B0900",
    "requestHeader": "PAYMENT-SIGNATURE",
    "responseHeader": "PAYMENT-RESPONSE",
    "scheme": "exact",
    "signing": "EIP-3009 TransferWithAuthorization under USDC's EIP-712 domain. Every 402 body carries the typed data ready to sign as `eip712`, with `chainId` beside it; a top-up intent carries the same document as payment.x402.eip712.",
    "topUpIntent": {
      "create": "POST https://api.qmarket.ghostagent.org/v1/credits/topup/intent",
      "pay": "POST https://api.qmarket.ghostagent.org/v1/pay/topup/{intent_id}",
      "ttl": "1h0m0s",
      "verify": "GET https://api.qmarket.ghostagent.org/v1/credits/topup/intent/{intent_id}"
    },
    "v1": "Still accepted. A payment sent as a v1 PaymentPayload in X-PAYMENT settles, and the settlement comes back on X-Payment-Response as well as PAYMENT-RESPONSE. The challenge itself is v2 only: `network` holds a CAIP-2 identifier, which is the one field that cannot carry both versions at once. `maxAmountRequired` is sent beside `amount` for the same reason it can be.",
    "wireVersion": 2
  }
}