Skip to content

GET /stubs/handler_api.php?action=getNumber

Buy virtual number for selected service

This request allows you to order a phone number of a specific country to receive SMS from a selected service. This is the main service provided by Onlinesim: you can use virtual numbers to receive verification codes or any other information contained in SMS messages.

WARNING

Please note, that number is issued for 15 minutes (time period depends on the country and service and can differ) and after the operation is closed this number will not be available.

Security

  • api_key
  • BearerAuth
  • OAuth2 (Scopes: sms-scope)
    • sms-scope: grants access to manage numbers for the SMS receiving service from Onlinesim

Parameters

NameTypeDescription
action*string

Method name, in this case getNumber

Enum:getNumberDefault:getNumber
service*string

Service slug (short service name, required upon ordering a number, according to getNumbersStatus response)

Example:3223
country*integer

Country ID (according to getCountries response)

Default:7Example:46
phoneExceptiononeOf

Array for mask exception (including the country code)

For example: with value [911,912123] won’'t issue numbers of India,
that start with 911* and 912123*

Example:908

Responses

200

Successful getNumber response from the server: either returns an
operation ID and issued number for SMS receiving or throws an
exception.

Code Samples