API Documentation

Authentication

All API requests must be made via POST to the following URL:

https://vps4you.hu/api.php

Method 1: Persistent API Key

Use the API key found in your profile settings. This key does not expire unless regenerated.

Parameter Description
email Your registered email address.
apikey Your persistent API key.

Method 2: Passwordless Login (2FA)

Login with your email to receive a temporary API key valid for 24 hours. This method requires 2FA.

Step 1: Request 2FA Code

POST action=login

Parameter Description
email Your registered email address.

Response (2FA Required): {"success":false, "error":"2FA required", "2fasent":true}. An email with the code will be sent. If a code was already sent recently, 2fasent will be false.

Step 2: Submit 2FA Token

POST action=login

Parameter Description
email Your registered email address.
token The 6-digit code received in email.

Success Response: {"success":true, "apikey":"TEMPORARY_KEY_HERE", "temporary":true}

Use this temporary apikey for subsequent requests (valid for 24 hours).

Example Usage

PHP Client Example

<?php
$url = 'https://vps4you.hu/api.php';
$fields = [
    'email' => 'your@email.com',
    'apikey' => 'your_api_key',
    'json' => 1,
    'action' => 'service-list'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
                    

Response Messages

All API responses are returned in JSON format.

Standard Response Fields

Field Type Description
success boolean Indicates if the request was successful (true) or failed (false).
logged_in boolean Indicates if the user is currently authenticated. Useful for checking session status even if an error occurred.
version string The current API version (e.g., "1.6").
error string (Only on failure) A human-readable error message describing why the request failed.

Example Success Response

{
    "success": true,
    "logged_in": true,
    "version": "1.6",
    "packages": { ... }
}

Example Error Response

{
    "success": false,
    "logged_in": false,
    "version": "1.6",
    "error": "Invalid login"
}

Common Actions

Get Packages

POST action=get-packages

Retrieve a list of available service packages.

Parameter Description
type Service type: vps, games, web, or domain.

List Services

POST action=service-list

List your active services.

Parameter Description
id (Optional) Filter by specific service ID.

Order Service

POST action=service-order

Order a new service (VPS, Web, Games).

Parameter Description
type vps, web, games.
packageid ID of the package to order.
templateid (For VPS/Games) ID of the OS template or game version.
days (Optional) Number of days to order for.

Pay Service

POST action=service-pay

Extend a service using your balance.

Parameter Description
serviceid ID of the service to pay for.
days (Optional) Number of days to extend.

VPS Management

Get Templates

POST action=vps-get-templates

Get available OS templates for a package or existing service.

Parameter Description
packageid ID of the package (for new orders).
serviceid ID of the service (for reinstall).

Get Status

POST action=vps-get-status

Get the current status of a VPS or Game server.

Parameter Description
serviceid ID of the service.

Change Status

POST action=vps-change-status

Start, stop, or restart a server.

Parameter Description
serviceid ID of the service.
command start, stop, shutdown, reset, force-shutdown.

Reinstall

POST action=vps-reinstall

Reinstall a server with a specific template.

Parameter Description
serviceid ID of the service.
templateid ID of the template to use.

Set Reverse DNS

POST action=vps-set-reverse

Set the reverse DNS record for an IP.

Parameter Description
serviceid ID of the service.
ip (Optional) Specific IP address.
reverse The reverse hostname.

Change Package

POST action=vps-change-package

Change VPS package or add extra resources.

Parameter Description
serviceid ID of the service.
newpackage (Optional) ID of the new package. If omitted, uses current package (resource upgrade).
extracpu (Optional) Number of extra vCPUs.
extraram (Optional) Amount of extra RAM in GB.
extrassd (Optional) Amount of extra SSD storage in GB.
extradisk (Optional) Amount of extra HDD storage in GB.
extranet (Optional) Extra network bandwidth in Mbit/s (values: 50, 100, 200, 500, 1000).
pricecheck (Optional) Set to 1 to calculate price without executing changes.
paymentmethod balance (default) or date (adjusts expiration date).

Price Check Response:

{
    "success": true,
    "paydiff": 1500,
    "currency": "HUF",
    "new_package_name": "EPYC VPS 4GB",
    "new_price": 5000,
    "datediff": 1709856000,
    "new_cpu": 4,
    "new_ram": 4096,
    "new_ssd": 80,
    "new_disk": [],
    "new_extranet": 0
}

Web Management

Change Package

POST action=web-change-package

Change the package of a web hosting service. This action performs strict validation to ensure that the currently allocated storage (Web, Email, Database) does not exceed the limits of the new package.

Parameter Description
serviceid ID of the web hosting service.
newpackage ID of the new package to switch to.

Note: If the current usage exceeds the new package limits, the request will fail with a specific error message.

Domain Management

Order Domain

POST action=domain-order

Register or transfer a domain.

Parameter Description
domain Full domain name (e.g., example.hu).
type reg or transfer.
owner newperson, neworg, or existing owner ID.
authcode (Required for transfer) Transfer authorization code.
dnsserver defaultdns or customdns.
nameservers (If dnsserver=='customdns') Array of nameservers. Can be a simple list of hostnames or an array of objects for glue records.
Example (JSON):
{
  "nameservers": [
    {
      "hostname": "ns1.example.com",
      "ipv4": "1.2.3.4",
      "ipv6": "2001:db8::1"
    },
    "ns2.example.com"
  ]
}
defaultdnsArecord (If dnsserver=='defaultdns') IP address for the default A record.
defaultdnsMXrecord (If dnsserver=='defaultdns') FQDN for the default MX record.

New Owner Fields (if owner is newperson/neworg):

email, phone, country, zipcode, city, address
firstname, lastname, birthdate (for newperson)
companyname, vatid (for neworg)

Set Transfer Auth Code

POST action=domain-set-transfer-authcode

Submit an auth code for a pending transfer.

Parameter Description
serviceid ID of the domain service.
authcode The authorization code.

Update Nameservers

POST action=domain-update-ns

Update nameservers for a domain.

Parameter Description
serviceid ID of the domain service.
nameservers Array of nameservers. Can be a simple list of hostnames or an array of objects for glue records.
Example (JSON):
{
  "nameservers": [
    {
      "hostname": "ns1.example.com",
      "ipv4": "1.2.3.4",
      "ipv6": "2001:db8::1"
    },
    "ns2.example.com"
  ]
}

DNS Management

List DNS Records

POST action=domain-dns-list

List all DNS records for a domain.

Parameter Description
serviceid ID of the domain service.

Add DNS Record

POST action=domain-dns-add

Add a new DNS record.

Parameter Description
serviceid ID of the domain service.
type A, CNAME, MX, TXT, AAAA, SRV.
name Subdomain name.
data Record value (e.g., IP address).
prio (Optional) Priority for MX/SRV.

Delete DNS Record

POST action=domain-dns-delete

Delete a DNS record.

Parameter Description
serviceid ID of the domain service.
recordid ID of the record to delete.

User Management

Get Balance

POST action=user-get-balance

Get your current account balance.

Parameter Description
currency HUF.

Set SSH Public Key

POST action=user-set-sshpubkey

Update your SSH public key.

Parameter Description
sshpubkey The SSH public key string.