Buy a virtual number for a selected service
GEThttps://onlinesim.io/api/getNum.php
Buys a number of the selected country for receiving SMS from the service — the same as the "Buy number" button
in the dashboard. POST with the same parameters works too.
- The price of the service is reserved on the balance when the number is issued.
tzidfrom the answer is the operation ID for getState and setOperationOk.- With
numberthe answer also contains the phone number and the operation details. - With
dev_id, 5% of the price is credited to the developer.
Security
Parameters
query6
| Name | Type | Description |
|---|---|---|
service* | string | Service slug from the service list. The value is lowercased and |
country | integer | Country code. Default: the country saved in the profile settings |
reject | string | Number prefixes (with the country code) that must not be issued: a comma list, a JSON array or |
dev_id | integer | Onlinesim profile ID of the developer of the software that sends the request. When the operation is paid, 5% of its cost is credited to that profile's affiliate income |
number | boolean | With this parameter (any value, even |
lang | string | Language of the texts in the answer (country and service names, status texts): Enum: frderuenzh |
Responses
200Operation ID or an error
application/jsonschemaoneOf
[0]objectThe fields after tzid are present only when the request has number
[1]object
[2]object
Examples
Number issued
{
"response": 1,
"tzid": 10000
}No numbers available
{
"response": "NO_NUMBER"
}Not enough money
{
"response": "WARNING_LOW_BALANCE"
}429HTTP 429: more than 400 requests per minute from one profile (from one IP for requests without a key), or more than 200 requests per minute from one profile to getNum, getPrice, getState and setOperationOk together
application/jsonschemaobject
Examples
Request rate limit exceeded
{
"response": "TRY_AGAIN_LATER"
}456HTTP 456: the API key is invalid or the OAuth token has expired. Public methods answer the same way when an invalid key is sent
application/jsonschemaobject
Examples
Invalid API key or expired token
{
"response": "ERROR_WRONG_KEY"
}