L402
How to use it as an API
What is L402:
L402s are essentially APIs on a Bitcoin Standard. It enables software/apps to talk to each other but without the need for logins, passwords and associated credit cards as it uses a secure authentication mechanism that combines Macaroons and the Lightning Network.More Info
Request Access to the resource
- Make your initial request to the service. You'll receive a 402 response with a header containing: A macaroon (like a ticket) An invoice (payment request)
www-authenticate: L402 macaroon="<macaroon>", invoice="<invoice>"
- Pay the Lightning invoice to obtain the preimage
- Once the payment is completed, send another POST request to https://sats4ai.com/api/l402/logo.png with the macaroon obtained in Step 1 and the Preimage from Step 2.
How to use our L402 service:
Authorization: L402 <macaroon>:<preimage>
Serve the resource