Publishing Your API
Make your bolthub-gated API discoverable by AI agents and human developers.
Discovery endpoints
Every active tenant on bolthub gets automatic discovery endpoints on their gateway subdomain. These require no extra configuration; they are generated from the metadata you enter in the dashboard.
| Endpoint | Description |
|---|---|
https://{slug}.gw.bolthub.ai/.well-known/l402-gateway.json | L402 discovery metadata: endpoints, pricing, examples |
https://{slug}.gw.bolthub.ai/.well-known/openapi.json | Auto-generated OpenAPI 3.1 spec |
https://api.bolthub.ai/directory/{slug} | JSON directory entry with full details |
https://api.bolthub.ai/directory/{slug}/mcp-config | Ready-to-use MCP server configuration |
https://{slug}.gw.bolthub.ai/.well-known/mcp.json | MCP discovery config on gateway domain |
https://api.bolthub.ai/badge/{slug}.svg | Embeddable SVG badge |
Enriching your metadata
The more metadata you provide, the better your API appears in the directory, agent configs, and OpenAPI specs:
- Project description and tags: Go to Settings > Directory listing in the dashboard.
- Endpoint descriptions: On each endpoint's detail page, click Add under "Discovery metadata".
- Example request/response: Add JSON examples when creating or editing an endpoint. These populate the playground, OpenAPI spec, and agent tool definitions.
For AI agents
How agents discover your API
AI agents (LLMs with tool use, autonomous agents, MCP servers) find your endpoints through:
-
MCP tool config: The API route
GET /directory/{slug}/mcp-configreturns a JSON config that can be pasted directly into any MCP-compatible client (Cursor, Claude Desktop, OpenClaw). It usesnpx @bolthub/mcp-bridgewhich auto-discovers your endpoints and handles L402 payments. Also available at/.well-known/mcp.jsonon your gateway domain. -
L402 discovery file: Agents can fetch
/.well-known/l402-gateway.jsonfrom your gateway domain to discover all endpoints, pricing, SDK references, and themcpConfigUrl. -
OpenAPI spec: The
/.well-known/openapi.jsonendpoint returns a standard OpenAPI 3.1 spec withx-l402-pricingannotations. Importable by Postman, Swagger UI, or LLM agents. -
Directory API: The public
GET https://api.bolthub.ai/directoryAPI returns all active tenants and endpoints with search and tag filtering. Agents can query this programmatically. The human-facing catalog is the API Hub.
MCP bridge (recommended for AI agents)
The fastest way to connect an AI agent is via the MCP bridge. Paste this config into your MCP client (Cursor, Claude Desktop, OpenClaw):
{
"mcpServers": {
"acme-api": {
"command": "npx",
"args": ["@bolthub/mcp-bridge", "--gateway", "https://acme.gw.bolthub.ai"],
"env": {
"LND_REST_HOST": "<your-lnd-rest-url>",
"LND_MACAROON": "<hex-encoded-admin-macaroon>",
"BUDGET_SATS": "1000"
}
}
}
}Wallet options: LND is shown above (recommended, fastest <200ms). Alternatives:
LNBITS_URL+LNBITS_ADMIN_KEY, orNWC_URI(easiest but slower). Only one wallet type is needed.BUDGET_SATSis optional and caps total spending per session (remove for unlimited).
The bridge auto-discovers endpoints from the OpenAPI spec, creates MCP tools with proper inputSchema, and handles L402 payment transparently on each tool call.
Agent SDKs
For programmatic integration, bolthub provides SDKs that handle the L402 flow automatically:
TypeScript:
npm install @bolthub/agentimport { L402Client, LndWallet } from "@bolthub/agent";
const client = new L402Client({
wallet: new LndWallet({ host: "https://lnd:8080", macaroon: "..." }),
maxPerRequestSats: 100,
budgetSats: 1000,
});
const resp = await client.get("https://acme.gw.bolthub.ai/v1/weather?city=berlin");
const data = await resp.json();Python:
pip install bolthubfrom bolthub import L402Client, LndWallet
with L402Client(
wallet=LndWallet(host="https://lnd:8080", macaroon="..."),
max_per_request_sats=100,
budget_sats=1000,
) as client:
resp = client.get("https://acme.gw.bolthub.ai/v1/weather", params={"city": "berlin"})
data = resp.json()Configuring agents to use your API
To connect an AI agent to your API:
- MCP clients: Grab the config from
https://api.bolthub.ai/directory/{slug}/mcp-configor the API Hub listing, paste into your client config with yourNWC_URI. - CLI: Developers can test your API instantly from the terminal with
bolthub call {slug} /path, with no code needed. - SDK agents: Install the agent SDK (TypeScript or Python), configure a Lightning wallet, and use the gateway URL as the endpoint.
- The CLI, SDKs, and MCP bridge all handle the 402 → pay → retry flow automatically.
For human developers
Alby browser extension (recommended)
The Alby browser extension provides the smoothest experience for humans interacting with L402-gated APIs:
- Install Alby from getalby.com.
- Fund your Alby wallet with sats.
- Visit the API Playground at
https://bolthub.ai/hub/{slug}. - Click Pay & Try. Alby automatically detects the 402 response and prompts for payment.
- After payment, the response appears immediately.
Alby implements the WebLN standard, which the bolthub playground uses to automate the payment flow.
Manual payment (any Lightning wallet)
If you don't have Alby installed, you can use any Lightning wallet:
- Send a request to the gateway endpoint.
- The 402 response includes a
paymentRequest(bolt11 invoice) in the JSON body. - Copy the invoice and pay it with your wallet (Wallet of Satoshi, Phoenix, Zeus, etc.).
- Extract the preimage from your wallet.
- Retry the request with
Authorization: L402 {macaroon}:{preimage}.
Embeddable badge
Add a badge to your README or website to show that your API is available on bolthub:
[](https://bolthub.ai/hub/YOUR-SLUG)<a href="https://bolthub.ai/hub/YOUR-SLUG">
<img src="https://api.bolthub.ai/badge/YOUR-SLUG.svg" alt="Pay with Lightning on bolthub" />
</a>Replace YOUR-SLUG with your tenant slug.
Pricing tips
- Start low: 1-10 sats per request is attractive for agents that optimize for cost
- Use per_request for simple APIs, time_pass for high-frequency use cases
- metered (prepaid) works well for compute-heavy APIs where agents want budget control
- Highlight "pay-per-request in sats" in your listing; it's the killer feature for autonomous agents