API command reference
The API endpoint URL for scripted requests is
https://getsms.online/api_command.phpTo authorize for API requests, you should generate an API key on the Account -> Profile page. Please note that this action requires a confirmation by email.
One-time MDNs
Quick jump: Balance & Other Info | Webhook URL
1. Request an MDN
| Parameter | Value | Required |
|---|---|---|
| cmd | "request" | Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
| service | Service name (as returned by "list_services" command or seen on View Services web page). | Y |
| mdn |
If this parameter is passed, we will try to provide this specific requested MDN. It can be either reused with the same service or used with another one. The script will return an error if this number is used in an open request or is not available anymore. |
N |
| areacode | A valid 3-digit area code. Takes precedence over "state" patameter. If "mdn" parameter is passed, the "areacode" parameter is ignored. | N |
| state | A valid 2-character US state abbreviation. If this parameter is passed, we will try to provide a number from a specific state. If "mdn" or "areacode" parameters are passed, the "state" parameter is ignored. | N |
| markup | A numeric value, between 10 and 2000 for "priority requests" feature. If passed, and there are no MDNs available for a particular service, the request will be created with "Awaiting MDN" status and a lifetime of 30 minutes. If during that time an MDN becomes available, and there are several users that placed bids, it will be given to the one who placed the highest bid earlier than others. The status of the request will then change to "Reserved". You can monitor the status of the request using "request_status" command. Also, if you have configured a webhook URL, you will receive an event of "priority_request" type if your bid has won. After 30 minutes an unfulfilled request with "Awaiting MDN" status will be automatically deleted. |
N |
A JSON array with the following fields will be returned:
| Parameter | Value |
|---|---|
| status | "ok" or "error" |
| message |
If "status" field equals to "error" this field will contain the explanation of the error.
if "status" equals to "ok", a JSON array will be returned with each entry containing these variables: "id", "mdn", "service", "status", "state" (for geo-tergeted requests), "markup", "price", "carrier" and "till_expiration" (in seconds). |
Example request:
https://getsms.online/api_command.php?cmd=request&user=test&api_key=0123456789&service=Amazon
Example output:
Successful request:
{
"status": "ok",
"message": [
{
"id": "10000001",
"mdn": "15302286946",
"service": "Amazon",
"status": "Reserved",
"state": "",
"markup": 0,
"price": 0.50,
"carrier": "TMobile",
"till_expiration": 900
}
]
}
Unsuccessful request:
{
"status":"error",
"message":"Invalid service name Goooooogle"
}
{
"status":"error",
"message":"No numbers available, retry later"
}
This is an example output when a priority request using "markup" parameter is made. The value of "mdn" parameter will be empty, and the status will be "Awaiting MDN".
{
"status": "ok",
"message": [
{
"id": "10000001",
"mdn": "",
"service": "Amazon",
"status": "Awaiting MDN",
"state": "CA",
"markup": 25,
"price": 0.60,
"carrier": "",
"till_expiration": 900
}
]
}
To reuse the MDN you have used with a certain service, please add "mdn" parameter to the request. Keep in mind that the numbers are changed periodically, so it may not be available any more by the time you want to re-activate your account.
Example request:
https://getsms.online/api_command.php?cmd=request&user=test&api_key=0123456789&service=Amazon&mdn=12345678901
Example output:
Unsuccessful request:
{
"status":"error",
"message":"The MDN is not available"
}
Requesting the same MDN for different services at once
It is possible to pass several service names to "request", command to be able to get an MDN that can be used for all listed services at the same time. In such a case, several priority requests will be created, and when a suitable phone number becomes available, it will be assigned to these requests.
For each of the services you pass a markup will be assigned automatically to ensure you are the highest bidder for all of them.
Note that uging geo garteting may greatly limit the pool of available numbers.
| Parameter | Value | Required |
|---|---|---|
| cmd | "request" | Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
| service | Up to 5 service names, separated with commas (as returned by "list_services" command or seen on View Services web page). | Y |
| areacode | A valid 3-digit area code. Takes precedence over "state" patameter. | N |
| state | A valid 2-character US state abbreviation. If this parameter is passed, we will try to provide a number from a specific state. If "areacode" parameter is passed, the "state" parameter is ignored. | N |
Example request:
https://getsms.online/api_command.php?cmd=request&user=test&api_key=0123456789&service=Yahoo,Google,Amazon
Example output:
{
"status": "ok",
"message": [
{
"id": "10000001",
"mdn": "",
"service": "Amazon",
"status": "Awaiting MDN",
"state": "",
"markup": 10,
"price": 0.30,
"carrier": "",
"till_expiration": 900
},
{
"id": "10000002",
"mdn": "",
"service": "Google",
"status": "Awaiting MDN",
"state": "",
"markup": 110,
"price": 1.30,
"carrier": "",
"till_expiration": 900
},
{
"id": "10000003",
"mdn": "",
"service": "Yahoo",
"status": "Awaiting MDN",
"state": "",
"markup": 50,
"price": 0.45,
"carrier": "",
"till_expiration": 900
}
]
}
2. Get a status of the request
Get a current status of the request by its ID.
| Parameter | Value | Required |
|---|---|---|
| cmd | "request_status" | Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
| id | Request ID, as obtained with "Request" command. | Y |
A JSON array with the following fields will be returned:
| Parameter | Value |
|---|---|
| status | "ok" or "error" |
| message |
If "status" field equals to "error" this field will contain the explanation of the error.
if "status" equals to "ok", a JSON array will be returned with each entry containing these variables: "id", "mdn", "service", "status", "state" (for geo-tergeted requests), "markup", "carrier" and "till_expiration" (in seconds). Possible values for the "status" field inside "message" array are: Awaiting MDN, Reserved, Completed, Rejected, Timed Out. |
Example request:
https://getsms.online/api_command.php?cmd=request_status&user=test&api_key=0123456789&id=10000001
Example output:
Successful request:
{
"status": "ok",
"message": [
{
"id": "10000001",
"mdn": "",
"service": "Amazon",
"status": "Awaiting MDN",
"state": "CA",
"markup": 20,
"carrier": "",
"till_expiration": 300
}
]
}
or
{
"status": "ok",
"message": [
{
"id": "10000001",
"mdn": "12345678901",
"service": "Amazon",
"status": "Reserved",
"state": "CA",
"markup": 20,
"carrier": "ATT",
"till_expiration": 890
}
]
}
Unsuccessful request:
{
"status":"error",
"message":"Invalid request ID"
}
3. Reject an MDN
Reject an MDN that has "Reserved" status. After rejection this number won't be offered to you anymore.
The command can also be used to cancel your bid if you're using priority requesting.
| Parameter | Value | Required |
|---|---|---|
| cmd | "reject" | Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
| id | Request ID, as obtained with "Request" command. | Y |
A JSON array with the following fields will be returned:
| Parameter | Value |
|---|---|
| status | "ok" or "error" |
| message |
If "status" field equals to "error" this field will contain the explanation of the error.
if "status" equals to "ok", this means the MDN has been timed out successfully. |
Example request:
https://getsms.online/api_command.php?cmd=reject&user=test&api_key=0123456789&id=10000001
Example output:
Successful request:
{
"status": "ok",
"message": "MDN has been rejected"
}
Unsuccessful request:
{
"status":"error",
"message":"Invalid request ID"
}
4. Read SMS
Get messages received to a one-time or long-term rented MDN. Kindly note that using this method is not recommended, since SMS polling may take a lot of resources.
Consider configuring a webhook URL (described below).
| Parameter | Value | Required |
|---|---|---|
| cmd | "read_sms"
The script will return a maximum of 3 latest messages received in the past 2 days, sorted by time of receipt, in descending order (newest messages first) |
Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
| id | ID of a one-time MDN rental, as obtained with "request" command. Once added to parameters list, will filter output by the request ID. If passed, "mdn" and "service" parameters are ignored. | N |
| mdn | Use MDN parameter to filter the command results only by that MDN. | N |
| service | One service name can be added to the request in order to filter the command results only by that service. | N |
A JSON array with the following fields will be returned:
| Parameter | Value |
|---|---|
| status | "ok" or "error" |
| message | If "status" field equals to "error" this field will contain the explanation of the error
if "status" equals to "ok", a JSON array will be returned with each entry containing the following variables: "timestamp": UNIX timestamp of the time the message was received "date_time" in human-readable format (server's time zone is America/New_York) "from": the sending number "to": the receiving number "service": service name "price": price "reply": contents of the received SMS "pin": a PIN code, when it was successfully recognized |
Example request:
https://getsms.online/api_command.php?cmd=read_sms&user=test&api_key=0123456789&service=Google
Example output:
Successful request:
{
"status": "ok",
"message": [
{
"timestamp": "1600108956",
"date_time": "2020-09-14 14:42:36 EDT",
"from": "22000",
"to": "18503814729",
"service": "Google",
"price": 1.20,
"reply": "G-804036 is your Google verification code.",
"pin": "G-804036"
},
{
"timestamp": "1600108852",
"date_time": "2020-09-14 14:40:52 EDT",
"from": "18339020112",
"to": "15182193312",
"service": "Google",
"price": 1.20,
"reply": "G-551858 is your Google verification code.",
"pin": "G-551858"
}
]
}
Unsuccessful request:
{
"status": "error",
"message":"No messages"
}
Balance & Other Info
Quick jump: One-time MDNs | Webhook URL
1. List services
| Parameter | Value | Required |
|---|---|---|
| cmd | "list_services" | Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
| service | One or many service names (as returned by "list_services" command or seen on View Services web page), separated by comma. If this parameter is omitted, all available services will be listed. |
N |
A JSON array with the following fields will be returned:
| Parameter | Value |
|---|---|
| status | "ok" or "error" |
| message |
If "status" field equals to "error" this field will contain the explanation of the error.
if "status" equals to "ok", a JSON array will be returned with each entry containing these variables: "name", "price", "ltr_price", "ltr_short_price", "otp_available", "ltr_available", "recommended_markup". |
Example request:
https://getsms.online/api_command.php?cmd=list_services&user=test&api_key=0123456789&service=Google
Example output:
Successful request:
{
"status": "ok",
"message": [
{
"name": "Google",
"price": "1.00",
"ltr_price": "20.00",
"ltr_short_price": "5.00",
"otp_available": "74",
"ltr_available": "3",
"recommended_markup": "10"
}
]
}
Unsuccessful request:
{ "status": "error",
"message":"Invalid service name DummyService"
}
The "recommended_markup" variable will only return a value when a "service" parameter is passed with a single value.
The availability data returned by this command is approximate, as it is not calculated in real time. Only when you make a request, you will know if there are any numbers available for a certain service.
2. View balance
| Parameter | Value | Required |
|---|---|---|
| cmd | "balance" | Y |
| user | Your user name or email | Y |
| api_key | Your API key | Y |
A JSON array with the following fields will be returned:
| Parameter | Value |
|---|---|
| status | "ok" or "error" |
| message | If "status" equals to "ok", your current balance will be displayed, otherwise it will contain the explanation of the error. |
Example request:
https://getsms.online/api_command.php?cmd=balance&user=test&api_key=0123456789
Example output:
{
"status": "ok",
"message": "10.00"
}
Webhook URL
Quick jump: One-time MDNs | Balance & Other Info
1. How to set up a webhook URL
Please go to Account -> Profile in the members area and set up a webhook URL where all notifications from the script will be forwarded. Data will be sent as a POST request to your URL. Note that your URL must return HTTP 200 code and not use use redirects.
If your URL is unavailable when we send data to it (i.e., the response status is not HTTP 200), the script will attempt to notify your URL five more times at 10-minute intervals and then stop the attempts.
2. Incoming messages
The following fields will be passed:
| Field | Value |
|---|---|
| event | "incoming_message" |
| id | request ID, as obtained with "request" API command. |
| timestamp | UNIX timestamp |
| date_time | date and time, in human-readable format (server's time zone is America/New_York) |
| from | the sending number |
| to | the receiving number |
| service | service name |
| reply | contents of the received SMS |
| pin | a PIN code, when it was successfully recognized |
| price | price of the received message |
3. Winning of a priority request
When your priority request wins and you are successfully assigned a number, the following message will be sent.
| Field | Value |
|---|---|
| event | "priority_request" |
| status | "ok" |
| id | Id of your request. |
| mdn | MDN |
| service | Service name |
| price | The price of the request |