# l402 endpoint health

> Report HTTP status and whether a challenge has a macaroon and an invoice.

l402 endpoint health is a paid AI agent skill on Agensi by agent-bitcoin, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [agent-bitcoin](https://www.agensi.io/creators/agent-bitcoin)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Version: 1.0
- Last updated: 2026-11-25
- Security: scan passed (2026-11-25); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/l402-endpoint-health
- Tags: api, bitcoin, lightning-network, l402, devops

## About this skill

Debugging L402 endpoints manually is tedious and prone to accidental leakage of sensitive credentials. This skill automates the verification of L402-enabled servers, ensuring they correctly issue payment challenges without compromising security.

### What it does
- **Health Check** probes the `/health` path to confirm the server is reachable and responding with a standard 200 status.
- **Challenge Verification** attempts a GET request on protected paths like `/paid/hello` to trigger the required 402 Payment Required status.
- **Header Parsing** validates that the `WWW-Authenticate` header contains the necessary macaroon and BOLT11 invoice fields.
- **Credential Protection** ensures that no macaroons, preimages, or invoices are logged or printed to the output.

### How it works
1. **Target Probe** starts with a standard GET request to the user-provided base URL to check connectivity.
2. **Health Validation** executes a request to `{base}/health` and captures the HTTP status code and response body.
3. **Challenge Test** sends a request to the protected endpoint to induce a 402 error.
4. **Metadata Extraction** uses `parse_www_authenticate` to verify the presence of payment metadata without displaying the actual secrets.

### Frameworks & tools
This skill utilizes the `agent-bitcoin` library for L402 header parsing and Python's standard `urllib` for low-level network requests. It can also fall back to `curl` for quick diagnostic checks.

### Why this beats prompting it yourself
Writing prompts to handle L402 logic often leads to the LLM trying to "complete" the payment or leaking the macaroon strings in the chat logs. This skill enforces a "probe-only" mode that protects your wallet secrets while providing a structured diagnostic report.

### Use cases
- Verify a new L402 server deployment is correctly configured.
- Confirm an endpoint is properly requesting payment before initiating a transaction.
- Debug 500 errors vs 402 challenges in Lightning-gated APIs.
- Monitor the uptime of specific pay-to-access paths.

### Known limitations
Does not support signing into Agensi or completing payments. It only reports on the presence of headers, not their cryptographic validity.

## Requires

- Python 3.10+
- agent-bitcoin package

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the l402 endpoint health skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill prevent sensitive credential leakage during the debugging process?

Manual testing often results in accidental exposure of macaroons or invoice data in logs. This skill provides a 'probe-only' diagnostic that confirms the L402 challenge flow is functioning without ever displaying or storing sensitive secrets.

### Can this skill be used to complete payments or settle Lightning invoices?

No, this skill is strictly a diagnostic tool designed to verify that the 402 Payment Required status and necessary headers are present; it does not have the capability to sign transactions or pay invoices.

### What is included in the purchase of this skill?

You will receive the production-ready skill code, documentation for integration, and a set of pre-configured diagnostic probes for common L402 paths like /health and /paid.

### What specific health metrics does the skill report back to the user?

The skill performs a dual-stage check: first, it validates basic connectivity via the /health path, and then it confirms the L402-specific challenge by verifying the presence of macaroons and BOLT11 fields in the WWW-Authenticate header.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
