SMSPVAdevelopers
Rental API
SMSPVA / DOCUMENTATION

Rental code examples

Run Rental API requests in eight languages with correct query authentication.

SMSPVA API

Every Rental method includes cURL, JavaScript, TypeScript, Python, PHP, Go, C# and Java. They send URL-encoded query parameters to https://smspva.com/api/rent.php using GET.

Environments

LanguageRequirements
cURLcURL 7.76+, POSIX shell on macOS/Linux/WSL
JavaScriptNode.js 22.16+; save as Example.mjs
TypeScriptNode.js ESM project with Node types; save as Example.mts
PythonPython 3.10+, standard library; python Example.py
PHPPHP 8.1+ with ext-curl; php Example.php
GoGo 1.20+, standard library; go run Example.go
C#.NET 8+ console project; put code in Program.cs
JavaJDK 11+ and Jackson Databind on the classpath

Java uses Jackson to check JSON status even when HTTP is 200. Add this dependency to your Maven project:

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.22.4</version>
</dependency>

Version source: Maven Central. Compile Example.java and run Example with the project dependencies on the classpath or through your IDE. The other examples require no third-party HTTP or JSON package.

API key

Required-key methods read SMSPVA_API_KEY. Optional-key methods omit it if unset; public methods do not request a key at all. The key belongs in the query string apikey, not in a header.

# macOS / Linux / WSL
export SMSPVA_API_KEY="YOUR_API_KEY"
# PowerShell
$env:SMSPVA_API_KEY = "YOUR_API_KEY"

Keep credentials in server-side environment variables. Query strings can appear in proxy/access logs; configure redaction of apikey. Do not expose account requests in public browser code.

Order and number variables

# PowerShell — replace with your rental values
$env:SMSPVA_RENTAL_ORDER_ID = "123"
$env:SMSPVA_RENTAL_NUMBER = "79335445295"

Use IDs from Rental orders/history, not Activation V2. Number values follow each method's pnumber description.

Other examples use source sample values. Override them in code or through SMSPVA_RENTAL_COUNTRY, SMSPVA_RENTAL_SERVICE, SMSPVA_RENTAL_SERVICES, SMSPVA_RENTAL_DTYPE, SMSPVA_RENTAL_DCOUNT, SMSPVA_RENTAL_SKIP, SMSPVA_RENTAL_TAKE, SMSPVA_RENTAL_RENT_DAYS, where the method accepts them. The cURL snippets contain literal country/service/duration values to edit directly.

Optional parameters

Minimal examples omit optional provider, partner_key and extend. Add them only to methods that document them. partner_key is a Rental query parameter; it is different from the Activation V2 partnerkey header. For account-specific prices in methods with optional apikey, set SMSPVA_API_KEY; the cURL example explains how to add it.

The examples use a 30-second timeout and no automatic retries. They URL-encode commas, spaces and other query characters. cURL prints the JSON body; check status yourself before using data. JavaScript/TypeScript, Python, PHP, Go, C# and Java check both HTTP and the Rental JSON status.

On this page