Create rental
GET /api/rent.php?method=create
Send a GET request and check status in the JSON response: 1 means success and 0 means failure, even with HTTP 200. If it fails, read msg for the reason.
This request can modify a rental or incur charges. If the response is lost, check your orders and history before trying again: the change may already have been made. The examples do not retry automatically.
Authentication
Send apikey as a required query parameter.
Parameters
| Name | Location | Type | Required | Example | Description |
|---|---|---|---|---|---|
method | query | string | Yes | "create" | Method name |
apikey | query | string | Yes | SMSPVA_API_KEY | Your API key You can find it on the website in the top right drop-down menu in the Profile and APIKEY section |
dtype | query | string | Yes | "week" | Type of period: week or month |
dcount | query | integer | Yes | 1 | Count type of period, i.e. if dtype=week then counts of weeks |
country | query | string | Yes | "KZ" | Country code of number Countries list |
service | query | string | Yes | "opt6" | Service code Services list |
provider | query | string | No | "T-Mobile" | Optional parameter. Provider name. If not specified, a provider will be chosen randomly from the available ones. |
partner_key | query | string | No | "partnerkeyhere" | Optional partner key for referral accounting. |
How to use this method
Rent a number for one service. For several services on the same number, use Create multi-service rental after checking availability.
Choose a country and compare services, providers and prices for the same country and duration. After creating the rental, find it in Rental orders and activate it before sending an SMS.
Request examples
Environment and dependencies. Each example encodes query values and allows 30 seconds for the request. Check HTTP and JSON status before using data. cURL prints the response for you to check; Java uses Jackson to read the JSON.
: "${SMSPVA_API_KEY:?Set SMSPVA_API_KEY}"
curl --get --fail-with-body --max-time 30 "https://smspva.com/api/rent.php" \
--data-urlencode "method=create" \
--data-urlencode "apikey=$SMSPVA_API_KEY" \
--data-urlencode "dtype=week" \
--data-urlencode "dcount=1" \
--data-urlencode "country=KZ" \
--data-urlencode "service=opt6"Responses
Check the response that matches your request. Example values and dates are illustrative. Optional fields can depend on the outcome or the response format you selected.
HTTP 200
Success
application/json
Illustrative response
{
"status": 1,
"data": {
"id": 40370,
"pnumber": "9096037108",
"ccode": "+7",
"service": "opt6",
"until": "1587633960"
}
}| Name | Type | Description |
|---|---|---|
status | integer | Status of the response: 1 for success, 0 for failure |
data | object | |
data.id | integer | ID of order |
data.pnumber | string | Phone number without country code |
data.ccode | string | Digital country code |
data.service | string | Service code Services list |
data.until | string | UNIX timestamp of expire date |
msg | string | Error message when status is 0. |