# Lightning Invoice Decoder

> Lightning Invoice Decoder is a paid API for AI agents from diamond.btc-intel.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-20).

Decodes a Lightning Network BOLT11 invoice string into human-readable fields: amount, description, payee node, payment hash, creation time, expiry time, and expiration status.

## Facts

- Endpoint: GET https://diamond.btc-intel.workers.dev/api/x402/invoice_decode?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/lightning-invoice-decoder-b33083cb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_JH9qyRlHqmvwduaznNA9X

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability lightning-invoice-decoder-b33083cb
```

Example prompt: Can you decode this Lightning invoice for me and tell me the amount, who the payee is, and whether it's expired: lnbc1000n1pjk2v3xpp5...?

## When to prefer this

Use this endpoint when you need to programmatically inspect the contents of a Lightning BOLT11 invoice before paying it, verify its validity and expiry, or extract structured metadata (amount, payee, description) from an opaque invoice string. It is specifically designed for Lightning Network invoice decoding, making it more reliable than generic BOLT11 parsers for agents operating in Bitcoin/Lightning workflows.

## Known failure modes

- Invalid or malformed BOLT11 invoice string returns an error response
- Invoice string exceeds 4000 character limit
- Network timeout from the worker endpoint
- Missing required 'invoice' query parameter results in a 400-style error
- Checksum mismatch in the invoice string causes a parse failure

## How this service works

Decode a Lightning BOLT11 invoice: amount, description, payee node, payment hash, creation and expiry time, whether it has expired, route hints.

## Output

A JSON object containing the decoded invoice fields: amount in satoshis, payee node public key, payment description, payment hash, creation time (UTC), expiry time (UTC), a boolean indicating whether the invoice has expired, and any route hints embedded in the invoice.

## Request schema (JSON Schema)

```json
{
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "invoice"
     ],
     "properties": {
      "invoice": {
       "type": "string",
       "maxLength": 4000,
       "description": "A Lightning BOLT11 invoice (lnbc...)"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "payee": "03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f",
  "expired": false,
  "product": "decoded_invoice",
  "amount_sat": 1000,
  "expires_at": "2026-11-07T18:00:00Z",
  "description": "..."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/lightning-invoice-decoder-b33083cb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from diamond.btc-intel.workers.dev](https://www.zero.xyz/host/diamond.btc-intel.workers.dev/llms.txt)
