free numbers

Get list of free numbers

GEThttps://onlinesim.io/api/getFreeList

Returns the countries with free numbers, the free numbers of one country, the SMS received by one of them (paginated) and the list of prohibited services. The answer always has the same shape.

  • Without parameters: country 44, its first number.
  • With country: that country, its first number.
  • With country and number: that country and that number.

Missing or unknown values never cause an error: a country without free numbers is replaced by the first country of the list, a number that is not among the numbers of the selected country by its first number. Check messages.country and messages.number to see what was actually selected.

You can use these numbers to receive SMS, for example for testing.

No key is needed. An OAuth token, if sent, must include free-scope; a sent API key is still checked (an invalid one gives HTTP 456, a blocked account its error). Only GET is accepted; the same method is also available at /api/getFreeList.php.

The answer is cached for 5 seconds per set of parameters.

Parameters

query8
NameTypeDescription
countryinteger

Country code (according to countries list), or a slug with as_country_text=yes. The value is cast to an integer: missing, 0 or non-numeric — 44. A country without free numbers is silently replaced by the first country of countries

Default:44
numberstring

Free number without country code whose SMS to show. Must exactly match a number of the selected country, otherwise the first number of that country is used

pageinteger
≥ 1

SMS page number. Values below 1 or non-numeric — 1; a page past the end gives an empty data

Default:1
countinteger

Number of SMS per page. Values below 10 (and non-numeric) become 10, values above 500 become 500

Default:10
as_country_textstring

If yes, country is a country slug (e.g. moldova) instead of a code; an unknown slug means 44. Any other value is ignored

Enum:yes
with_contentstring

If yes, content holds the page content of the selected country; otherwise content is null. Any other value is ignored

Enum:yes
localestring

Language of content (used only with with_content=yes). Defaults to lang; a language without content gives ru

langstring

Language of the texts in the answer (country and service names, status texts): fr, de, ru, en or zh. Every method accepts it; methods without such texts answer the same in any language. Field names, error codes and other fixed values stay in English. Without the parameter: ru for getTariffs, getNumbersStats and getFreeList; otherwise the language of the profile for requests with a key, English for requests without one. An unsupported value falls back to the default language

Enum:frderuenzh

Responses

200Free countries, numbers and SMS, an OAuth scope error, or a common error of a sent key
Content-Typeapplication/json
Schema
schemaoneOfSuccessful response, an OAuth scope error, or a common error (only possible when a key or token is sent)
One Of
[0]object
[1]object
[2]object

Examples

Successful response79 lines

Returns a list of free numbers and the SMS messages received by them

{
  "response": 1,
  "countries": [
    {
      "country": 7,
      "country_text": "Россия",
      "country_original": "russia"
    }
  ],
  "numbers": {
    "9915584911": {
      "country": 7,
      "country_original": "russia",
      "data_humans": "6 days ago",
      "full_number": "79915584911",
      "is_archive": false
    }
  },
  "messages": {
    "current_page": 1,
    "data": [
      {
        "id": 512345678,
        "text": "Your verification code: 482913",
        "in_number": "***2601",
        "my_number": "9915584911",
        "created_at": "2022-07-24T12:32:14.000000Z",
        "data_humans": "1 minute ago",
        "code": "482913"
      }
    ],
    "first_page_url": "https://onlinesim.io/api/getFreeList?page=1",
    "from": 1,
    "last_page": 610,
    "last_page_url": "https://onlinesim.io/api/getFreeList?page=610",
    "links": [
      {
        "url": null,
        "label": "« Previous",
        "active": false
      },
      {
        "url": "https://onlinesim.io/api/getFreeList?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": "https://onlinesim.io/api/getFreeList?page=2",
        "label": "2",
        "active": false
      },
      {
        "url": null,
        "label": "...",
        "active": false
      },
      {
        "url": "https://onlinesim.io/api/getFreeList?page=610",
        "label": "610",
        "active": false
      },
      {
        "url": "https://onlinesim.io/api/getFreeList?page=2",
        "label": "Next »",
        "active": false
      }
    ],
    "next_page_url": "https://onlinesim.io/api/getFreeList?page=2",
    "path": "https://onlinesim.io/api/getFreeList",
    "per_page": 10,
    "prev_page_url": null,
    "to": 10,
    "total": 6100,
    "number": "9915584911",
    "country": 7
  },
  "ignore": "<p>…</p><p>…</p>",
  "content": null
}
freeListOAuthScopeError

The sent OAuth token has no free-scope

{
  "response": "Invalid scope(s) provided: free-scope"
}
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
Content-Typeapplication/json
Schema
schemaobject
responsestringRequired
Error code. The codes any method can return are listed in the introduction; each method lists its own. The list is not closed: treat an unknown code as a generic error and log it.

Examples

Rate limit

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
Content-Typeapplication/json
Schema
schemaobject
responsestringRequired
Error code. The codes any method can return are listed in the introduction; each method lists its own. The list is not closed: treat an unknown code as a generic error and log it.

Examples

Invalid key

Invalid API key or expired token

{
  "response": "ERROR_WRONG_KEY"
}

Code Samples

Generating examples...