{
  "openapi": "3.1.0",
  "info": {
    "title": "Bastion Helix Agent Lens API",
    "version": "1.0.0",
    "description": "Web pages for AI agents. Charged only on success."
  },
  "servers": [
    {
      "url": "https://lens.bastionhelix.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "bhk_… API key with prepaid credits"
      }
    }
  },
  "paths": {
    "/v1/preflight": {
      "post": {
        "operationId": "preflight",
        "summary": "Free check: allowed? which engine?",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy, signals and the engine each task needs"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/read": {
      "post": {
        "operationId": "read",
        "summary": "Clean Markdown (US$0.004)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "fetch",
                      "kitesurf",
                      "chromium"
                    ],
                    "default": "auto"
                  },
                  "max_chars": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 400000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "markdown, title, words, engine_used, attempts, billing"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Payment required (US$0.004). x402 v2 requirements in the PAYMENT-REQUIRED header and the x402 field."
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/actions": {
      "post": {
        "operationId": "actions",
        "summary": "Forms, buttons, links with selectors (US$0.004)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "fetch",
                      "kitesurf",
                      "chromium"
                    ],
                    "default": "auto"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "forms, buttons, links"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Payment required (US$0.004). x402 v2 requirements in the PAYMENT-REQUIRED header and the x402 field."
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/site": {
      "post": {
        "operationId": "site",
        "summary": "Free site card: llms.txt, sitemap, feeds, AI rules",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Site card"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/extract": {
      "post": {
        "operationId": "extract",
        "summary": "Structured facts as JSON (US$0.002)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "fetch",
                      "kitesurf",
                      "chromium"
                    ],
                    "default": "auto"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "jsonld, offers, meta, feeds, tables"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Payment required (US$0.002). x402 v2 requirements in the PAYMENT-REQUIRED header and the x402 field."
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/delta": {
      "post": {
        "operationId": "delta",
        "summary": "Only what changed since last check (US$0.001)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "fetch",
                      "kitesurf",
                      "chromium"
                    ],
                    "default": "auto"
                  },
                  "previous": {
                    "type": "object",
                    "description": "fingerprint from the last call"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "changed, changed_sections, removed_sections, fingerprint"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Payment required (US$0.001). x402 v2 requirements in the PAYMENT-REQUIRED header and the x402 field."
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/screenshot": {
      "post": {
        "operationId": "screenshot",
        "summary": "PNG screenshot (US$0.008)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "user_agent": {
                    "type": "string",
                    "description": "Your bot's robots.txt name"
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "kitesurf",
                      "chromium"
                    ],
                    "default": "auto"
                  },
                  "full_page": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "image/png, or JSON with image_base64"
          },
          "400": {
            "description": "Bad URL or option"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Payment required (US$0.008). x402 v2 requirements in the PAYMENT-REQUIRED header and the x402 field."
          },
          "403": {
            "description": "Refused: robots.txt or Content Signals say no. Not charged."
          },
          "422": {
            "description": "A bot check or refusal answered instead of the page. Not charged."
          },
          "429": {
            "description": "Rate limited"
          },
          "502": {
            "description": "No engine could load the page. Not charged."
          }
        }
      }
    },
    "/v1/credits": {
      "get": {
        "operationId": "credits",
        "summary": "Credits left",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "credits"
          },
          "401": {
            "description": "Invalid API key"
          }
        }
      }
    }
  }
}