rent

Buy virtual phone number for rent

GEThttps://onlinesim.io/api/rent/getRentNum.php

This request allows you to rent a number of a specific country for SMS receiving.

You can use this request when you need to receive messages from multiple different services or from a single one, but over a long time period.

The price is the days price of the country in tariffsRent. It is reserved on the balance, not charged: the rent starts with status 0 and waits for the first SMS. The first SMS confirms the rent (status 1): the price is charged and the rent lasts days days from the start. SMS of the rent are also sent to the profile webhook. POST with the same parameters works too.

Security

OAuth2
rent-scope
grants access to renting phone numbers from Onlinesim

Parameters

query8
NameTypeDescription
countryinteger

Country code. Default: the default country of the profile settings. An unknown code gives UNDEFINED_COUNTRY

daysinteger

Rent period in days, one of the keys of days of the country in tariffsRent. Any other value gives UNDEFINED_DAYS

Default:1
extensionboolean

true/1 (default) — the rent can be extended later with extendRentState; false/0 — it can never be extended (extend is []). Values other than true, 1, on, yes count as false. Auto-renewal is a separate mode that cannot be turned on here

Default:true
rejectstring

Number prefixes (with the country code) that must not be issued: a comma list, a JSON array or reject[]=…. For example 911,912123 skips Indian numbers starting with +911 and +912123. Without the parameter the prefixes saved in the profile settings are used

dev_idinteger

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

paginationboolean

true (default) — messages of a rent operation is split into pages (see page and per_page); false — messages is a flat list of SMS, newest first

Default:true
numberinteger

Any value: the answer also gets time_seconds and guard_interval_remaining_seconds

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

200The rented number or an error
Content-Typeapplication/json
Schema
schemaoneOf
One Of
[0]object
[1]object
[2]object

Examples

Virtual number successfully rented41 lines

Returns information about the rental operation

{
  "response": 1,
  "item": {
    "status": 0,
    "messages": {
      "current_page": 1,
      "data": [],
      "from": 1,
      "last_page": 0,
      "per_page": 20,
      "to": 0,
      "total": 0
    },
    "country": 7,
    "rent": 3,
    "days_autoextend": 3,
    "extension": 1,
    "checked_time": "2026-11-19 10:00:00",
    "sum": 1.5,
    "number": "9915584307",
    "start_time": "2026-11-19 10:00:00",
    "stop_time": "2026-11-19 10:20:00",
    "webhook_url": null,
    "tzid": 22867974,
    "time": 19,
    "days": 0,
    "hours": 0,
    "extend": {
      "1": 0.9,
      "3": 1.5,
      "7": 3,
      "15": 5.5,
      "30": 9
    },
    "checked": false,
    "reload": 0,
    "day_extend": 0.3,
    "m_ext": false,
    "freeze": false
  }
}
No free number

No free number of this country now

{
  "response": "NO_NUMBER"
}
Low balance

The balance is lower than the price

{
  "response": "WARNING_LOW_BALANCE"
}
Undefined days

The country has no rent for this number of days

{
  "response": "UNDEFINED_DAYS"
}
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...