PAYMENTS - SERVER STORAGE - ORDER STORAGE

Payments - Server Storage - Order Storage API Endpoints

Complete documentation for all Payments - Server Storage - Order Storage related endpoints.

POST

Order Storage Server

Create a new storage server order.

Endpoint Details

HTTP Request
POST https://0xhost.com/API/orders/create_order_storage
Parameters
Parameter Type Required Description
user_id string Yes User UUID
plan_id string Yes Plan ID
os_image_id string Yes Operating System Image ID
rental_duration integer Yes Rental duration in hours
name_server string No Server name
password string Yes Server password
type_payment string Yes Payment type (balance, crypto)
auto_renew integer Yes Auto renew status (0 or 1)
versions string Yes OS version/distribution
add_extra string No Add extra storage (1 for yes)
Authentication
API Key Required in header
Headers
Header Value Required Description
x-api-key your_api_key_here Yes Your unique API key for authentication
Content-Type application/json Optional Recommended for consistent response handling

Response Fields

Field Type Description
success boolean Indicates if the operation was successful
message string Response message describing the result
data object/array Contains the response data

Success Response

API Response Example
{
    "success": true,
    "order": {
        "id": "order12345-6789-0123-4567-890123456789",
        "status": "completed",
        "metadata": "add_extra=1",
        "amount": "12.99",
        "currency": "EUR"
    },
    "server_status": {
        "new_id": "server12345-6789-0123-4567-890123456789",
        "id_solusvm": 493,
        "name": "testingApiKey",
        "metadata": "password=securePassword123",
        "primary_ip": "192.168.100.130"
    }
}

Code Examples

Programming Languages
JavaScript (Fetch API)
async function makeRequest() {
  try {
    const response = await fetch('https://0xhost.com/API/orders/create_order_storage', {
      method: 'POST',
      headers: {
        'x-api-key': 'your_api_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
          "user_id": "user_id",
          "plan_id": "5",
          "os_image_id": "6",
          "rental_duration": "720",
          "name_server": "testingApiKey",
          "password": "securePassword123",
          "type_payment": "balance",
          "auto_renew": "1",
          "versions": "ubuntu",
          "add_extra": "1"
      })
    });

    const data = await response.json();
    console.log('Response:', data);
    return data;
  } catch (error) {
    console.error('Error:', error);
  }
}
Python (Requests)
import requests
import json

def make_request(api_key):
    url = 'https://0xhost.com/API/orders/create_order_storage'
    headers = {
        'x-api-key': api_key,
        'Content-Type': 'application/json'
    }
    data = {
        "user_id": "user_id",
        "plan_id": "5",
        "os_image_id": "6",
        "rental_duration": "720",
        "name_server": "testingApiKey",
        "password": "securePassword123",
        "type_payment": "balance",
        "auto_renew": "1",
        "versions": "ubuntu",
        "add_extra": "1"
    }

    response = requests.POST(
        url,
        headers=headers,
        json=data
    )

    if response.status_code == 200:
        return response.json()
    else:
        print(f'Error: {response.status_code}')
        return None
PHP (cURL)
function makeRequest($apiKey) {
    $url = 'https://0xhost.com/API/orders/create_order_storage';
    $data = {
        "user_id": "user_id",
        "plan_id": "5",
        "os_image_id": "6",
        "rental_duration": "720",
        "name_server": "testingApiKey",
        "password": "securePassword123",
        "type_payment": "balance",
        "auto_renew": "1",
        "versions": "ubuntu",
        "add_extra": "1"
    };

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'x-api-key: ' . $apiKey,
        'Content-Type: application/json'
    ]);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    return json_decode($response, true);
}
cURL Command
curl -X POST \
  'https://0xhost.com/API/orders/create_order_storage' \
  -H 'x-api-key: your_api_key_here' \
  -H 'Content-Type: application/json' \
  -d '{    "user_id": "user_id",    "plan_id": "5",    "os_image_id": "6",    "rental_duration": "720",    "name_server": "testingApiKey",    "password": "securePassword123",    "type_payment": "balance",    "auto_renew": "1",    "versions": "ubuntu",    "add_extra": "1"}'