{
 "openapi": "3.1.0",
 "info": {
  "title": "Tenderfix API",
  "version": "0.1.0",
  "description": "Open UK/EU public tenders and go/no-go screening. Paid calls use L402 (HTTP 402 + Lightning invoice). UK data OGL v3.0; EU data from TED under Decision 2011/833/EU.",
  "contact": {
   "url": "https://nbc-bids.pages.dev/contact.html"
  }
 },
 "servers": [
  {
   "url": "https://tenderfix.io"
  }
 ],
 "components": {
  "securitySchemes": {
   "L402": {
    "type": "http",
    "scheme": "L402",
    "description": "Authorization: L402 <macaroon>:<preimage>"
   }
  }
 },
 "paths": {
  "/v1/tenders": {
   "get": {
    "summary": "Search open tenders",
    "parameters": [
     {
      "in": "query",
      "schema": {
       "type": "string"
      },
      "name": "country"
     },
     {
      "in": "query",
      "schema": {
       "type": "string"
      },
      "name": "cpv"
     },
     {
      "in": "query",
      "schema": {
       "type": "string"
      },
      "name": "q"
     },
     {
      "in": "query",
      "schema": {
       "type": "string"
      },
      "name": "tier"
     },
     {
      "in": "query",
      "name": "min_value",
      "schema": {
       "type": "number"
      }
     },
     {
      "in": "query",
      "name": "limit",
      "schema": {
       "type": "integer",
       "maximum": 500
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Tenders"
     },
     "402": {
      "description": "Payment required (tier=full, 1000 sats)"
     }
    }
   }
  },
  "/v1/tenders/{id}/gonogo": {
   "get": {
    "summary": "Go/no-go screen for one tender (2000 sats)",
    "security": [
     {
      "L402": []
     }
    ],
    "parameters": [
     {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Score"
     },
     "402": {
      "description": "Payment required"
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/mcp": {
   "post": {
    "summary": "MCP JSON-RPC endpoint",
    "responses": {
     "200": {
      "description": "JSON-RPC"
     }
    }
   }
  },
  "/v1/music/pitch-pack": {
   "get": {
    "summary": "Release Pitch Pack download (12000 sats)",
    "security": [
     {
      "L402": []
     }
    ],
    "responses": {
     "200": {
      "description": "Paid: JSON with download_url (24h signed link to zip)"
     },
     "402": {
      "description": "Payment required; Lightning invoice in WWW-Authenticate"
     },
     "401": {
      "description": "Invalid L402 token"
     }
    }
   }
  },
  "/v1/tip": {
   "get": {
    "summary": "Lightning tip invoice",
    "parameters": [
     {
      "in": "query",
      "name": "sats",
      "required": true,
      "schema": {
       "type": "integer",
       "minimum": 1000,
       "maximum": 100000
      }
     },
     {
      "in": "query",
      "name": "site",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "BOLT11 invoice"
     },
     "400": {
      "description": "Bad amount"
     },
     "429": {
      "description": "Rate limited"
     },
     "503": {
      "description": "Wallet offline"
     }
    }
   }
  }
 }
}