{"openapi": "3.1.0", "info": {"title": "Bitrovas API", "version": "1.0", "description": "Small, deterministic Bitcoin and data tools for agents. Pay per request in sats over Lightning (L402). No account, no API key, no stored inputs. Invalid inputs are rejected for free before any invoice.", "contact": {"url": "https://www.bitrovas.ch"}}, "servers": [{"url": "https://api.bitrovas.ch"}], "externalDocs": {"url": "https://api.bitrovas.ch/llms.txt"}, "components": {"securitySchemes": {"L402": {"type": "http", "scheme": "L402", "description": "Lightning HTTP 402 (bLIP-26). Credential: <macaroon>:<preimage-hex> from the 402 answer and the paid invoice."}}}, "paths": {"/v1/psbtcheck": {"post": {"operationId": "psbtcheck", "summary": "Bitrovas PSBT-Check (21 sats per request)", "description": "Pre-sign check of an unsigned Bitcoin PSBT: recipients, amounts, change, fee/sat-vB, RBF, sighash, missing UTXO info, dust, address-poisoning lookalikes. Verdict ok|warn|danger, JSON + text DE/EN. Never signs or broadcasts; the PSBT is not stored. Free validity/price check: POST /v1/psbtcheck/quote.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 21, "currency": "sats", "pricing": "21 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"psbt": {"description": "unsigned PSBT v0, base64 or hex (required)"}, "expected_address": {"description": "optional"}, "expected_amount_sats": {"description": "optional integer"}, "network": {"description": "optional mainnet|testnet|signet|regtest"}}, "additionalProperties": true, "required": ["psbt"]}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/poisoncheck": {"post": {"operationId": "poisoncheck", "summary": "Bitrovas PoisonCheck (21 sats per request)", "description": "Address-poisoning check: compares the address you are about to send to (used) with the address you know (expected) and detects lookalike/vanity patterns for Bitcoin, EVM and Tron. Level poison|review|clear, JSON + text DE/EN. Single 21 sats; batch up to 50 addresses 21 + 5 sats per address. Pattern, not proof; not a send approval.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 21, "currency": "sats", "pricing": "21 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"used": {"description": "address to check (string) – or list of up to 50 addresses for batch"}, "expected": {"description": "address you know is correct (string; for batch also a list of the same length)"}}, "additionalProperties": true}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/jsonrepair": {"post": {"operationId": "jsonrepair", "summary": "Bitrovas JSON Validate & Repair (10 sats per request)", "description": "Validate and repair a JSON array of flat records (max 1000 rows): syntax repair (trailing commas, code fences, Python literals), whitespace trim, NULL normalization, duplicate removal, optional type standardization, e-mail check and JSON Schema (2020-12) validation with flag|drop. Returns cleaned JSON + machine-readable report. Deterministic; no data stored.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 10, "currency": "sats", "pricing": "10 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"data": {"description": "JSON array of flat objects, or {\"records\": [...]}, or a JSON string to repair (required, max 1000 rows)"}, "json_schema": {"description": "optional JSON Schema 2020-12 applied per row"}, "json_schema_action": {"description": "optional flag|drop (default flag)"}, "options": {"description": "optional DataCleanBot options, e.g. {\"operations\": [...], \"schema\": {col: type}, \"dedupe_keys\": [...]}"}}, "additionalProperties": true, "required": ["data"]}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/walletaddr": {"post": {"operationId": "walletaddr", "summary": "Bitrovas Wallet-Adressen (21 sats per request)", "description": "Watch-only address derivation from xpub/ypub/zpub/tpub or an output descriptor: receive + change addresses (configurable gap, max 1000) and ownership check of given addresses with derivation path. Offline, nothing stored. Private keys/seeds are rejected.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 21, "currency": "sats", "pricing": "21 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"xpub": {"description": "xpub/ypub/zpub/tpub/upub/vpub (account level) – or –"}, "descriptor": {"description": "output descriptor with * (e.g. wpkh([fp/84h/0h/0h]xpub/<0;1>/*))"}, "addresses": {"description": "optional list of addresses to check (max 50)"}, "script": {"description": "optional override for xpub/tpub: p2pkh|p2wpkh|p2sh-p2wpkh|p2tr"}, "gap": {"description": "optional, addresses per chain (default 20, max 1000)"}}, "additionalProperties": true}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/qrbill": {"post": {"operationId": "qrbill", "summary": "Bitrovas QR-Rechnung-Check (10 sats per request)", "description": "Technical offline check of a Swiss QR-bill (SPC payload) or IBAN + reference: format, IBAN checksum, CH/LI, QR-IBAN vs reference type (QRR/SCOR/NON), QR-reference mod10, ISO 11649, amount/currency, mandatory fields, lengths, character set. Optional: compares the bill's IBAN with expected supplier IBAN(s) supplied by the customer (plain or SHA-256); mismatch = danger. Only checks structure and this comparison, not whether a bill is genuine. Verdict ok|warn|danger, DE/EN + JSON. Nothing stored or logged.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 10, "currency": "sats", "pricing": "10 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"payload": {"description": "QR-bill SPC payload text (all lines) – or –"}, "iban": {"description": "IBAN"}, "reference": {"description": "optional QRR/SCOR reference"}, "amount": {"description": "optional"}, "currency": {"description": "optional CHF|EUR"}, "expected_iban": {"description": "optional: expected supplier IBAN or list (max 20); normalized (no spaces, uppercase)"}, "expected_iban_sha256": {"description": "optional: hex SHA-256 of normalized IBAN (no spaces, uppercase, ASCII) or list"}}, "additionalProperties": true}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/formatcheck": {"post": {"operationId": "formatcheck", "summary": "Bitrovas FormatCheck (from 11 sats (10 + 1 per started KB))", "description": "Validate CSV, YAML, XML, TOML or JSON (data max 1 MiB, 1M elements). Price: 10 sats + 1 sat per started KB of data, free quote at POST /v1/formatcheck/quote. Converts to JSON (or flat JSON -> CSV); optional JSON Schema 2020-12 validation (local $ref only). Safe parsers (defusedxml, yaml.safe_load, tomllib), size and time limits, in-memory only. Invalid input = free 400 with error position. Nothing stored or logged.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 11, "currency": "sats", "pricing": "from 11 sats (10 + 1 per started KB)"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"data": {"description": "input text (required, UTF-8, max 1 MiB)"}, "format": {"description": "csv|yaml|xml|toml|json (required)"}, "action": {"description": "optional validate (default) | to_json | to_csv (to_csv: format json, flat records)"}, "json_schema": {"description": "optional JSON Schema 2020-12 for the parsed document (local $ref only, max 8 KB)"}}, "additionalProperties": true, "required": ["data", "format"]}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/timestamp": {"post": {"operationId": "timestamp", "summary": "Bitrovas Zeitstempel (OpenTimestamps) (21 sats per request)", "description": "Bitcoin timestamp for a SHA-256 hash or Nostr event id via OpenTimestamps. Returns a pending .ots proof (base64) immediately; the free GET /v1/timestamp/<id> returns the upgraded proof and block height after confirmation (usually 1–12 h). Only the hash is sent, never the file.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 21, "currency": "sats", "pricing": "21 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"hash": {"description": "SHA-256 hex (64) of your file – or –"}, "event_id": {"description": "Nostr event id (hex, note1…, nevent1…)"}, "status": {"description": "GET /v1/timestamp/<id> (free)"}}, "additionalProperties": true}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/adresswaechter": {"post": {"operationId": "adresswaechter", "summary": "Bitrovas Adress-Wächter (Bitcoin address monitoring) (2100 sats / 90 days)", "description": "Watch-only monitoring of a Bitcoin mainnet address or account xpub/ypub/zpub for 90 days: every incoming and outgoing transaction (also unconfirmed) and dust from lookalike addresses (address poisoning) triggers an encrypted Nostr DM (NIP-17) to the npub you provide. 2100 sats per 90 days, renewable (another order adds 90 days). Only public data, never send seeds or private keys. Free status: GET /v1/adresswaechter/<subscription_id>.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 2100, "currency": "sats", "pricing": "2100 sats / 90 days"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"target": {"description": "Bitcoin mainnet address (bc1…, 1…, 3…) or account-level xpub/ypub/zpub (depth ≤ 3; counts as 1 slot)"}, "npub": {"description": "Nostr public key that receives the alarms by NIP-17 DM (npub1… or 64 hex)"}, "label": {"description": "optional name, max 40 chars"}, "status": {"description": "GET /v1/adresswaechter/<subscription_id> (free)"}, "info": {"description": "GET /v1/adresswaechter/info (free)"}}, "additionalProperties": true}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/markdown": {"post": {"operationId": "markdown", "summary": "Bitrovas Dokument zu Markdown (100 sats per request)", "description": "Converts a document (PDF, DOCX, XLSX, PPTX, HTML, CSV; max 5 MB) to clean Markdown for AI agents, using Microsoft MarkItDown. Upload as base64 in JSON. Sandboxed, no URL fetches, no OCR/LLM, documents are never stored. Free type/size/price check: POST /v1/markdown/quote.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 100, "currency": "sats", "pricing": "100 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"content_base64": {"description": "document bytes, base64 (required; PDF, DOCX, XLSX, PPTX, HTML or CSV in UTF-8)"}, "filename": {"description": "optional, e.g. report.pdf (extension must match the detected type)"}}, "additionalProperties": true, "required": ["content_base64"]}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}, "/v1/utxoplan": {"post": {"operationId": "utxoplan", "summary": "Bitrovas UTXO-Planer (1200 sats per request)", "description": "Watch-only UTXO plan from an xpub/ypub/zpub, an output descriptor, Bitcoin mainnet addresses (bc1…, 1…, 3…) or a UTXO list (Sparrow CSV): fee scenarios, which coins to consolidate, freeze or leave alone, consolidation cost and break-even, privacy hints, Markdown plan. Free preview at /v1/utxoplan/preview. Nothing stored, private keys/seeds are rejected. Addresses are never logged.", "tags": ["paid"], "x-payment-info": {"protocol": "L402", "price": 1200, "currency": "sats", "pricing": "1200 sats per request"}, "security": [{}, {"L402": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"xpub": {"description": "xpub/ypub/zpub (account level, mainnet) – or –"}, "descriptor": {"description": "output descriptor with * (e.g. wpkh([fp/84h/0h/0h]xpub/<0;1>/*)), also multisig – or –"}, "addresses": {"description": "one or more Bitcoin mainnet addresses (bc1…, 1…, 3…): JSON list or text, one per line or comma-separated. Gap limit is ignored. Counts toward the address cap (preview 80, plan 300)."}, "utxos": {"description": "own UTXO list: JSON [{txid, vout, value_sats, address?, label?}] or Sparrow CSV (Output, Address, Label, Value) or text lines 'txid:vout value' (sats, or BTC with a dot)"}, "gap": {"description": "optional gap limit per chain (default 20, max 100); only with xpub or descriptor"}}, "additionalProperties": true}}}}, "responses": {"200": {"description": "Result (after payment)", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "Invalid input. Free, no invoice is created."}, "401": {"description": "Invalid, used or expired L402 credential"}, "402": {"description": "Payment required. Pay the BOLT11 invoice, then repeat the identical request with Authorization: L402 <macaroon>:<preimage-hex>.", "headers": {"WWW-Authenticate": {"schema": {"type": "string"}, "description": "L402 macaroon=\"…\", invoice=\"lnbc…\""}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string", "example": "payment_required"}, "macaroon": {"type": "string"}, "token": {"type": "string"}, "invoice": {"type": "string", "description": "BOLT11 Lightning invoice"}, "paymentHash": {"type": "string"}, "amountSats": {"type": "integer"}, "expiresAt": {"type": "string", "format": "date-time"}, "message": {"type": "string"}}}}}}}}}}, "x-discovery": {"l402_directory": "https://api.bitrovas.ch/.well-known/l402-services", "a2a_agent_card": "https://api.bitrovas.ch/.well-known/agent-card.json", "mcp": "https://api.bitrovas.ch/mcp", "llms_txt": "https://api.bitrovas.ch/llms.txt"}}