HTTPS API Query Examples

This page shows you many useful examples of how you can use our Bulk SMS Gateway API. All times (created_time, completed_time, timestamp) are in Unix time and in the UTC/GMT time zone.

Command to Send Non-Unicode SMS With a Default Length Limit

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=send&text=test+message&phone=44797123456&unicode=0
Response
{
    "message_id": {
        "8624392": "44797123456"
    }
,
    "sent_text": "test message",
    "parts_count": 1
}

Command to Send a Unicode SMS With a Length Limit

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=send&text=test+limited+message+test+limited+ message+test+limited+message+test+limited+message+ test+limited+message+test+limited+ message+test+limited+message+test+limited+message+ test+limited+message&phone=44797123456&unicode=1&max_length=2
Response
{
    "message_id": {
        "8624393": "44797123456"
    }
,
    "parts_count": 1,
    "sent_text": "test limited message test limited  message test limited message test limited message  test limited message test limited  message test limited message test limited message  test limited message"
}


Command to Send an SMS with Custom previously registered Sender ID

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=send&text=test&phone=44797123456&unicode=1&from=companyX
Response
{
    "message_id": {
        "8624396": "44797123456",
        "parts_count": 1,
        "sent_text": "test"
    }

}

Note: You can use any of your registered Custom Sender IDs. To apply for Custom sender ID follow this link

Command to Send an SMS With Unicode Characters and a Default Length Limit

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy& cmd=send&text=test+limited+unicode+message+?????+test+limited+unicode+
message+?????+test+limited+unicode+message+?????+test+limited+unicode+ message&phone=44797123456&max_length=1&unicode=1
Response
{
    "message_id": {
        "8624394": "44797123456",
        "parts_count": 2,
        "sent_text": "test limited unicode message ????? test limited unicode
message ????? test limited unicode message ????? test limited unicode  message"

    }

}

Command to Send an SMS in Scheduled Time Using Time in the UNIX Timestamp

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=send&text=test&phone=44797123456&unicode=1&send_time=1244558160
Response
{
    "message_id": {
        "8624396": "44797123456",
        "parts_count": 1,
        "sent_text": "test"
    }

}

Note: This means, “Send message at 9 June 2009 at 14:36:00 GMT+0:00.”

Command to Send an SMS in Scheduled Time Using Time in the UTC Format

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy& cmd=send&text=test&phone=44797123456&unicode=1&send_time=2009-06-09T20:36:00Z
Response
{
    "message_id": {
        "8624397": "44797123456",
        "parts_count": 1,
        "sent_text": "test"
    }

}

Note: It means: send message at 9 June, 2009 20:36:00

Command to Check Your Account Balance

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=account
Response
{
    "balance": 417.7
}

Command to Check the Status of a Delivered Text Messages

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=message_status&ids=8624395%2C8624396
Response
{
    "8624395": {
        "text": "sent message example text",
        "status": "d",
        "created_time": 1239869646,
        "reply_number": "447624800500",
        "credits_cost": 0.5,
        "completed_time": 1239869746
    }
,
    "8624396": {
        "text": "sent message example text",
        "status": "d",
        "created_time": 1239869646,
        "reply_number": "447624800500",
        "credits_cost": 0.5,
        "completed_time": 1239869746
    }

}

Command to Check the Status of a Just-Created Queued Text Message

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=message_status&ids=8624397
Response
{
    "8624397": {
        "text": "sent message example text",
        "status": "q",
        "created_time": 1239869646,
        "reply_number": "447624800500"
    }

}

Command to Receive Incoming SMS Messages

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=receive&last_retrieved_id=1775800
Response
{
    "messages": [
        {
            "message_id": 1775801,
            "from": "44797123456",
            "timestamp": 1199866898,
            "text": "My reply!"
        }
,
        {
            "message_id": 1775802,
            "from": "44797123457",
            "timestamp": 1199866939,
            "text": "My reply!"
        }

    ]
,
    "unread": 0
}

Command to Delete Incoming SMS Messages

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=delete_reply&ids=1775803
Response
{
    "deleted": [
        1775803
    ]

}

Command to Check a Single Phone Number

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=check_number&phone=447123456789
Response
{
    "447123456789": {
        "price": 0.8,
        "country": "GB"
    }

}

Command to Check Multiple Phone Numbers

Request
https://www.textmagic.com/app/api?username=xxxx&password=yyyy&cmd=check_number&phone=447123456789,447987654321
Response
{
    "447123456789": {
        "price": 0.8,
        "country": "GB"
    }
,
    "447987654321": {
        "price": 0.8,
        "country": "GB"
    }

}

Back to top