SMSPVAdevelopers
Private Email Rental
SMSPVA / DOCUMENTATION

Create rental

GET /api/rent_email.php?method=create_order

SMSPVA API
GEThttps://smspva.com/api/rent_email.php?method=create_order

Send a GET request and check JSON status, even with HTTP 200: 1 means success, 0 means failure, and 2 means no mailbox was available when creating a rental. Error details may be in msg, errormsg and errorid.

This request can modify a rental or incur charges. If the response is lost, check active and archived orders 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

NameLocationTypeRequiredExampleDescription
apikeyquerystringYesSMSPVA_API_KEYAccount API key. Reading messages and managing a rental require the order owner's key.
methodquerystringYes"create_order"Method selector.
scodequerystringYes"twitter"Service code from Services and Prices.
pcodequerystringNo"outlookcom"Provider code from Get Providers. Omit this parameter entirely to use all providers; do not send an empty value or null.
dtypequerystringYes"week"Rental period unit: day = 1 day, week = 7 days, month = 30 days.
dcountqueryintegerYes1Positive number of rental period units.

How to use this method

Rent a mailbox for your chosen service and duration. Get scode and current prices from Services, and pcode from Providers.

To accept any provider, leave pcode out of the request entirely. Do not send pcode=, an empty string or null. If you choose a provider, the API will use only that provider, even when its stock runs out.

The duration is dcount × 1, 7 or 30 days for day, week or month. The cost uses the daily price; months_discount applies from 30 days. A response with status=2 means no mailbox was available. Refresh counts before trying again.

Save data.id as orderid, along with the email address, actual provider and expiry. Use that ID to read messages and check active orders.

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.

Set SMSPVA_EMAIL_PCODE to a current provider code to select it; leave it unset or empty to omit pcode entirely. Provider and service codes come from the live lists.

  • SMSPVA_EMAIL_SCODE: scode.
provider_args=()
if [ -n "${SMSPVA_EMAIL_PCODE:-}" ]; then provider_args=(--data-urlencode "pcode=$SMSPVA_EMAIL_PCODE"); fi
: "${SMSPVA_API_KEY:?Set SMSPVA_API_KEY}"
: "${SMSPVA_EMAIL_SCODE:?Set SMSPVA_EMAIL_SCODE}"
curl --get --fail-with-body --max-time 30 "https://smspva.com/api/rent_email.php" \
  --data-urlencode "method=create_order" \
  --data-urlencode "apikey=$SMSPVA_API_KEY" \
  "${provider_args[@]}" \
  --data-urlencode "scode=$SMSPVA_EMAIL_SCODE" \
  --data-urlencode "dtype=${SMSPVA_EMAIL_DTYPE:-week}" \
  --data-urlencode "dcount=${SMSPVA_EMAIL_DCOUNT:-1}"

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

Check status in the JSON even when HTTP is 200. Examples use illustrative values.

application/json

Unknown or disabled provider

{
  "status": 0,
  "errorid": 9,
  "errormsg": "Provider not found",
  "msg": "Provider not found"
}

Success (illustrative)

{
  "status": 1,
  "data": {
    "id": 123456,
    "email": "[email protected]",
    "scode": "twitter",
    "pcode": "outlookcom",
    "expireDate": 1855324800
  }
}

Error

{
  "status": 0,
  "msg": "Incorrect apikey"
}

No mailboxes available

{
  "status": 2
}

Success

NameTypeDescription
statusinteger(enum: [1])
dataobject
data.idintegerOrder ID. Pass this as orderid in subsequent requests.
data.emailstringAssigned email address.
data.scodestringService code.
data.pcodestringActual assigned provider code.
data.expireDateintegerRental expiry as a Unix timestamp in seconds.

Required: status, data

No mailboxes available

NameTypeDescription
statusinteger(enum: [2])

Required: status

Error

Some errors include errorid and errormsg; others contain only msg. Check all available error fields.

NameTypeDescription
statusinteger(enum: [0])
erroridintegerOptional structured error code.
errormsgstringOptional error description.
msgstringError message.

On this page