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/sms 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
Send the L402 POST request to: https://sats4ai.com/api/l402/sms
{
"phone_number": "+1234567890",
"message": "Hello, this is a test SMS!"
}
The message body is a JSON object and should contain the phone number and the message text (up to 120 characters).
Request data:
phone_number: string
The recipient's phone number in international format (e.g., +1234567890).
message: string
The content of the SMS. Maximum of 120 characters.