Rental workflow
Create, activate, read SMS, prolong and restore a rental.
1. Select a country, service and duration
Start with the live rental lists and Rental countries. Use Rental data by provider to compare service codes, provider counts and prices for the same country and duration.
For multi-service rentals, send comma-separated codes in services and check Multi-service count. Pass dtype and dcount explicitly to that method, as the source documentation recommends. Most duration methods use week or month; do not assume every method supports days.
2. Create the rental
Use Create rental or Create multi-service rental. Save data.id, pnumber, ccode and until. These are rental identifiers, not Activation V2 order IDs.
Both requests use GET as documented. They may create a paid order. If a timeout leaves the result uncertain, inspect Rental orders before repeating the request.
3. Activate before sending SMS
Call Activate rental with the rental order ID. Then inspect state in Rental orders:
| state | Meaning from the documentation |
|---|---|
| 0 | Not active |
| 1 | Active |
| 2 | Activating |
| -1 | Not in system |
Only send an SMS after the order is active. A successful activate request does not replace checking the order state.
4. Read messages
Call Rental SMS. Inspect status=1, then read data.SmsList and data.OtherSms. An empty list is a successful result with no messages in that list. Do not use the Activation V2 HTTP 202 waiting logic here.
The method returns message lists, not a documented “consume next message” cursor. Repeated reads can include messages you have already processed. Keep application-side processing state.
For polling, space requests, stop when your task is complete or the rental expires, and handle transport errors separately. Handle rate-limit responses from the method you are calling, and set a deadline for your checks. The endpoint examples make one request and do not retry automatically.
5. Extend, change or remove a rental
- Add service requires the rental ID, pnumber and service; rent_days is optional as documented.
- Prolong uses week/month periods. Inspect canprolong, canprolongmax and canprolonguntil first.
- Prolong by days requires dtype=day, dcount=1–6, within the order-specific canprolongmax limit.
- Remove order uses GET with method=delete, not HTTP DELETE.
These methods have different purposes and are not called automatically by the examples.
6. Restore a completed rental
Read Rental history and check isAvailForRestore. Call Restore precalculation to inspect cost and duration, then Restore rental.
On success, data.id is the new restored order ID. Use that ID with subsequent rental operations and inspect current orders. A failed restore may return HTTP 200 with status=0 and msg; inspect the JSON before declaring success.
Time fields and formats
Creation examples document until as a string, while order-list examples use an integer. Keep the source types for each response. Expiry and prolongation deadlines are Unix timestamps in seconds; the Activation V2 orderExpireIn model does not apply.