{
  "info": {
    "_postman_id": "bitgo-lightning-collection",
    "name": "BitGo Lightning",
    "description": "API collection for BitGo Bitcoin Lightning workflows: wallet setup, invoices, payments, balances, and on-chain withdrawals.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "BASE_URL",
      "value": "https://app.bitgo-test.com",
      "type": "string"
    },
    {
      "key": "EXPRESS_URL",
      "value": "http://localhost:3080",
      "type": "string"
    },
    {
      "key": "ACCESS_TOKEN",
      "value": "",
      "type": "string"
    },
    {
      "key": "COIN",
      "value": "tlnbtc",
      "type": "string"
    },
    {
      "key": "WALLET_ID",
      "value": "",
      "type": "string"
    },
    {
      "key": "ENTERPRISE_ID",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "1 - Set Up Lightning Wallets",
      "description": "Create a Lightning wallet using BitGo Express.",
      "item": [
        {
          "name": "Create Lightning Wallet",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"label\": \"My Lightning Wallet\",\n  \"passphrase\": \"YOUR_PASSPHRASE\",\n  \"passcodeEncryptionCode\": \"YOUR_PASSCODE_ENCRYPTION_CODE\",\n  \"enterprise\": \"{{ENTERPRISE_ID}}\",\n  \"type\": \"hot\",\n  \"subType\": \"lightningCustody\"\n}"
            },
            "url": {
              "raw": "{{EXPRESS_URL}}/api/v2/{{COIN}}/wallet/generate",
              "host": ["{{EXPRESS_URL}}"],
              "path": ["api", "v2", "{{COIN}}", "wallet", "generate"]
            },
            "description": "Creates a new Lightning custody wallet. Requires BitGo Express."
          }
        }
      ]
    },
    {
      "name": "2 - Create Lightning Invoice",
      "description": "Create, get, and list Lightning invoices to receive payments.",
      "item": [
        {
          "name": "Create Invoice",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"valueMsat\": \"10000\",\n  \"memo\": \"Payment for services\",\n  \"expiry\": 86400\n}"
            },
            "url": {
              "raw": "{{BASE_URL}}/api/v2/{{COIN}}/wallet/{{WALLET_ID}}/lightning/invoice",
              "host": ["{{BASE_URL}}"],
              "path": ["api", "v2", "{{COIN}}", "wallet", "{{WALLET_ID}}", "lightning", "invoice"]
            },
            "description": "Creates a Lightning invoice. Provide either valueMsat (millisatoshis) or valueSat (satoshis)."
          }
        },
        {
          "name": "Get Invoice by Payment Hash",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "url": {
              "raw": "{{BASE_URL}}/api/v2/{{COIN}}/wallet/{{WALLET_ID}}/lightning/invoice/:paymentHash",
              "host": ["{{BASE_URL}}"],
              "path": ["api", "v2", "{{COIN}}", "wallet", "{{WALLET_ID}}", "lightning", "invoice", ":paymentHash"],
              "variable": [
                {
                  "key": "paymentHash",
                  "value": "",
                  "description": "The payment hash returned when the invoice was created."
                }
              ]
            },
            "description": "Retrieves a single Lightning invoice by its payment hash."
          }
        },
        {
          "name": "List Invoices",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "url": {
              "raw": "{{BASE_URL}}/api/v2/{{COIN}}/wallet/{{WALLET_ID}}/lightning/invoice",
              "host": ["{{BASE_URL}}"],
              "path": ["api", "v2", "{{COIN}}", "wallet", "{{WALLET_ID}}", "lightning", "invoice"]
            },
            "description": "Lists all Lightning invoices for the wallet."
          }
        }
      ]
    },
    {
      "name": "3 - Pay Lightning Invoice",
      "description": "Pay a Lightning invoice (custody wallets only). Requires BitGo Express.",
      "item": [
        {
          "name": "Pay Invoice",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"invoice\": \"lntb...\",\n  \"passphrase\": \"YOUR_PASSPHRASE\",\n  \"feeLimitMsat\": \"1000\",\n  \"sequenceId\": \"\",\n  \"comment\": \"\"\n}"
            },
            "url": {
              "raw": "{{EXPRESS_URL}}/api/v2/{{COIN}}/wallet/{{WALLET_ID}}/lightning/payment",
              "host": ["{{EXPRESS_URL}}"],
              "path": ["api", "v2", "{{COIN}}", "wallet", "{{WALLET_ID}}", "lightning", "payment"]
            },
            "description": "Pays a Lightning invoice. For zero-amount invoices, include amountMsat. Custody wallets only — Go Lightning does not support payments."
          }
        }
      ]
    },
    {
      "name": "4 - Get Lightning Balances",
      "description": "Retrieve wallet balances including inbound, outbound, and on-chain fields.",
      "item": [
        {
          "name": "Get Wallet Balance",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "url": {
              "raw": "{{BASE_URL}}/api/v2/wallet/{{WALLET_ID}}",
              "host": ["{{BASE_URL}}"],
              "path": ["api", "v2", "wallet", "{{WALLET_ID}}"]
            },
            "description": "Returns wallet details including Lightning balance fields: inboundBalance, outboundBalance, outboundSpendableBalance, and on-chain balances."
          }
        }
      ]
    },
    {
      "name": "5 - Withdraw On-Chain",
      "description": "Withdraw funds from a Lightning wallet to an on-chain Bitcoin address. Requires BitGo Express.",
      "item": [
        {
          "name": "Withdraw On-Chain",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"passphrase\": \"YOUR_PASSPHRASE\",\n  \"recipients\": [\n    {\n      \"amount\": \"10000\",\n      \"address\": \"BITCOIN_ADDRESS\"\n    }\n  ],\n  \"satsPerVbyte\": \"10\",\n  \"sequenceId\": \"\",\n  \"comment\": \"\"\n}"
            },
            "url": {
              "raw": "{{EXPRESS_URL}}/api/v2/{{COIN}}/wallet/{{WALLET_ID}}/lightning/withdraw",
              "host": ["{{EXPRESS_URL}}"],
              "path": ["api", "v2", "{{COIN}}", "wallet", "{{WALLET_ID}}", "lightning", "withdraw"]
            },
            "description": "Withdraws funds from a Lightning wallet to an on-chain Bitcoin address. Amount is in satoshis."
          }
        },
        {
          "name": "Approve Pending Withdrawal",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{ACCESS_TOKEN}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"state\": \"approved\",\n  \"otp\": \"000000\"\n}"
            },
            "url": {
              "raw": "{{BASE_URL}}/api/v2/pendingApprovals/:approvalId",
              "host": ["{{BASE_URL}}"],
              "path": ["api", "v2", "pendingApprovals", ":approvalId"],
              "variable": [
                {
                  "key": "approvalId",
                  "value": "",
                  "description": "The pending approval ID returned from the withdrawal request."
                }
              ]
            },
            "description": "Approves a pending on-chain withdrawal. Only required if wallet has approval policy rules configured."
          }
        }
      ]
    }
  ]
}
