{
  "info": {
    "_postman_id": "9cc4d586-937d-4020-9402-402402402402",
    "name": "The402Machine API",
    "description": "Prepared examples for the native quote and polling API plus HTTP Payment Authentication and L402 challenges. Never store live invoices, preimages, macaroons or product capabilities in shared environments.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://the402machine.com"
    },
    {
      "key": "planId",
      "value": "spark"
    },
    {
      "key": "orderId",
      "value": "replace-after-quote"
    },
    {
      "key": "publicId",
      "value": "replace-after-settlement"
    },
    {
      "key": "eventId",
      "value": "replace-with-event-id"
    },
    {
      "key": "ownerToken",
      "value": "replace-with-owner-capability"
    },
    {
      "key": "ingestToken",
      "value": "replace-with-ingest-capability"
    },
    {
      "key": "readToken",
      "value": "replace-with-read-capability"
    },
    {
      "key": "pingToken",
      "value": "replace-with-ping-capability"
    },
    {
      "key": "whisperReadLimit",
      "value": "1"
    },
    {
      "key": "whisperRevealAt",
      "value": ""
    },
    {
      "key": "publicStatusId",
      "value": "pulse_status_[REDACTED]"
    },
    {
      "key": "paymentAuthorization",
      "value": "replace-with-Payment-credential"
    },
    {
      "key": "paymentIdempotencyKey",
      "value": "replace-with-one-stable-key-per-payment-purchase"
    },
    {
      "key": "l402Authorization",
      "value": "replace-with-L402-macaroon-and-preimage"
    },
    {
      "key": "l402IdempotencyKey",
      "value": "replace-with-one-stable-key-per-l402-purchase"
    }
  ],
  "item": [
    {
      "name": "System and catalogue",
      "item": [
        {
          "name": "Health",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Catalogue",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/catalog",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "catalog"
              ]
            },
            "description": ""
          },
          "response": []
        }
      ]
    },
    {
      "name": "Payments",
      "item": [
        {
          "name": "Quote CATCH",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/catch",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "catch"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"planId\": \"{{planId}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Quote WHISPER ciphertext",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "X-Whisper-Plan",
                "value": "{{planId}}",
                "type": "text"
              },
              {
                "key": "X-Whisper-Read-Limit",
                "value": "{{whisperReadLimit}}",
                "type": "text"
              },
              {
                "key": "X-Whisper-Reveal-At",
                "value": "{{whisperRevealAt}}",
                "type": "text",
                "disabled": true
              },
              {
                "key": "Content-Type",
                "value": "application/octet-stream",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/whisper",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "whisper"
              ]
            },
            "description": "Remove the empty reveal header if not scheduling. Replace the body with AES-256-GCM ciphertext, never plaintext.",
            "body": {
              "mode": "raw",
              "raw": "CLIENT_ENCRYPTED_BYTES_0000000",
              "options": {
                "raw": {
                  "language": "text"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Quote PULSE",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/pulse",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "pulse"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"planId\": \"{{planId}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Poll payment",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/payments/{{orderId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "{{orderId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Payment Auth PULSE challenge",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{paymentIdempotencyKey}}",
                "type": "text"
              },
              {
                "key": "X-Payment-Protocol",
                "value": "payment",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/pulse",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "pulse"
              ]
            },
            "description": "Template only. Pay live invoices only with explicit authorization. Never log or share preimages or credentials.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"planId\": \"{{planId}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Payment Auth PULSE credential",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{paymentIdempotencyKey}}",
                "type": "text"
              },
              {
                "key": "X-Payment-Protocol",
                "value": "payment",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "Authorization",
                "value": "Payment {{paymentAuthorization}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/pulse",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "pulse"
              ]
            },
            "description": "Template only. Pay live invoices only with explicit authorization. Never log or share preimages or credentials.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"planId\": \"{{planId}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "L402 PULSE challenge",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{l402IdempotencyKey}}",
                "type": "text"
              },
              {
                "key": "X-Payment-Protocol",
                "value": "l402",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/pulse",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "pulse"
              ]
            },
            "description": "Template only. Pay live invoices only with explicit authorization. Never log or share preimages or credentials.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"planId\": \"{{planId}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "L402 PULSE credential",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{l402IdempotencyKey}}",
                "type": "text"
              },
              {
                "key": "X-Payment-Protocol",
                "value": "l402",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "Authorization",
                "value": "L402 {{l402Authorization}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/payments/pulse",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "payments",
                "pulse"
              ]
            },
            "description": "Template only. Pay live invoices only with explicit authorization. Never log or share preimages or credentials.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"planId\": \"{{planId}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "CATCH",
      "item": [
        {
          "name": "Ingest GET",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ingestToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/c/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "c",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Ingest POST",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ingestToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/c/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "c",
                "{{publicId}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": \"canary\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Ingest PUT",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ingestToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/c/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "c",
                "{{publicId}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": \"canary\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Ingest PATCH",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ingestToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/c/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "c",
                "{{publicId}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": \"canary\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Ingest DELETE",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ingestToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/c/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "c",
                "{{publicId}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": \"canary\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Ingest OPTIONS",
          "request": {
            "method": "OPTIONS",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ingestToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/c/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "c",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Owner status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/catch/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "catch",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "List events",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/catch/{{publicId}}/events?limit=20&access=authenticated",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "catch",
                "{{publicId}}",
                "events"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "20"
                },
                {
                  "key": "access",
                  "value": "authenticated"
                }
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Delete event",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/catch/{{publicId}}/events/{{eventId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "catch",
                "{{publicId}}",
                "events",
                "{{eventId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Destroy CATCH",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/catch/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "catch",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        }
      ]
    },
    {
      "name": "WHISPER",
      "item": [
        {
          "name": "Consume encrypted message",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{readToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/w/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "w",
                "{{publicId}}"
              ]
            },
            "description": "Each successful response spends one read. The response is application/octet-stream ciphertext."
          },
          "response": []
        }
      ]
    },
    {
      "name": "PULSE",
      "item": [
        {
          "name": "Heartbeat",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{pingToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/p/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "p",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Public status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/pulse/public/{{publicStatusId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "pulse",
                "public",
                "{{publicStatusId}}"
              ],
              "variable": [
                {
                  "key": "publicStatusId",
                  "value": "{{publicStatusId}}"
                }
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Owner status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/pulse/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "pulse",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        },
        {
          "name": "Update settings",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/pulse/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "pulse",
                "{{publicId}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Backup heartbeat\",\n  \"description\": \"Nightly backup worker\",\n  \"expectedIntervalSeconds\": 300,\n  \"graceSeconds\": 600,\n  \"publicStatusEnabled\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Destroy PULSE",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{ownerToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/pulse/{{publicId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "pulse",
                "{{publicId}}"
              ]
            },
            "description": ""
          },
          "response": []
        }
      ]
    }
  ]
}
