Anonymous pay-per-use API
txt4coins.net offers an anonymous pay-per-use API. This enables you to integrate SMS service into your application without even needing to register or make any advance payments.
The workflow is similar to manual submitting of messages through the website. You have to provide message, sender and recipient number. The response (json) will contain details (overall result code, message status, price, bitcoin address for payment, ...). You can query for the status of a message at any time later, as long as you know the message ID returned from the create call.
You can send bulk messages by providing multiple recipient numbers separated by semicolon, eg. "+16123456; +49123456; +3244332211". Note that for bulk messages tracking of individual message status is not possible. Up to 200 recipients are supported.
Submit a new txt message
http://txt4coins.net/api/create/json/
POST
the message text
your name/phone number
phone number(s)
Single message example using curl:
curl --data-urlencode 'recipient_number=+1234333' --data-urlencode 'sender=JohnWayne' --data-urlencode 'message=testmessage' http://txt4coins.net/api/create/json/
Response
{
"resultcode": 200,
"resultmessage": "OK",
"txtmessage": {
"status": 10,
"btc_address": "QWERTZYASDFGQWERTLKJ",
"btc_received": "0.0",
"btc_price": "0.01",
"recipient_number": "+12****33",
"id": 33
}
}
Bulk message example using curl:
curl --data-urlencode 'recipient_number=+1234333;+1654321;+4917134678;+315522333' --data-urlencode
'sender=JohnWayne' --data-urlencode 'message=this is a bulk message'
http://txt4coins.net/api/create/json/
Response
{
"resultcode": 200,
"resultmessage": "OK",
"txtmessage": {
"status": 10,
"btc_address": "QWERTZYASDFGQWERTLKJ",
"btc_received": "0.0",
"btc_price": "0.01",
"recipient_number": "bulk, 4 recipients",
"id": 33
}
}
Obtain status of a txt message
http://txt4coins.net/api/status/<id>/json/
GET
Example using curl:
curl http://txt4coins.net/api/status/18/json/
Response
{
"resultcode": 200,
"resultmessage": "OK",
"txtmessage": {
"status": 40,
"btc_address": "None",
"btc_received": "0.0005",
"btc_price": "0.0005",
"recipient_number": "+45****65",
"id": 18
}
}
Possible API resultcodes:
OK
Not found
Invalid parameter "sender"
Invalid parameter "message"
Invalid parameter "recipient_number"
Internal error, try again later
Could not obtain payment address
Payment notification service unavailable
Possible message statuscodes:
Waiting for payment
Partly paid
Waiting for delivery
Delivered successfully
Delivery failed
Buffered at provider
Delivered to SMSC
Delivery accepted
Cancelled