hostinger-api-mcp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/.env.example +10 -0
  2. package/README.md +922 -0
  3. package/package.json +35 -0
  4. package/server.js +1896 -0
package/README.md ADDED
@@ -0,0 +1,922 @@
1
+ # hostinger-api-mcp
2
+
3
+ Model Context Protocol (MCP) server for Hostinger API API.
4
+
5
+ ## Description
6
+
7
+ > [!caution]
8
+ > Currently, this API is in beta stage, meaning that breaking changes, while unlikely, might be introduced.
9
+ > If you encounter any issues or have any feedback, please create an issue on the [Github Repository](https://github.com/hostinger/api/issues).
10
+ # Overview
11
+ The Hostinger API provides a comprehensive set of endpoints that allow developers to interact with Hostinger's services programmatically.
12
+ This API enables you to manage various aspects of your Hostinger account.
13
+
14
+ The Hostinger API is a (mostly) RESTful API that uses standard HTTP methods and status codes.
15
+ # Authentication
16
+ The Hostinger API uses tokens for authentication. To authenticate your requests, you need to include a valid bearer token in the Authorization header of your HTTP requests:
17
+ ```yaml
18
+ Authorization: Bearer YOUR_API_TOKEN
19
+ ```
20
+ API tokens for individual users can be created and managed from the [VPS page](https://hpanel.hostinger.com/vps) of the Hostinger Panel.
21
+ Tokens will have same permissions as the owning user. Optionally, tokens can be set to expire after a certain period of time.
22
+ # Rate Limiting
23
+ To ensure fair usage and prevent abuse, the API enforces rate limits on the number of requests that can be made within a certain time period.
24
+ If you exceed the rate limit, you will receive a 429 Too Many Requests response. Rate limit headers are included in the response to help you manage your requests.
25
+ Your IP address might get temporarily blocked if you exceed the rate limit multiple times.
26
+ # Parameters
27
+ All requests sent to API must have the content type `application/json`. `POST`, `PUT`, `PATCH` methods may include a JSON object in the request body. Documentation provides required structure and examples of the object.
28
+ Some endpoints require path parameters. These parameters are included in the URL path and are marked with curly braces.
29
+ # Pagination
30
+ Some endpoints return a large number of items. To make these responses more manageable, the API uses pagination.
31
+ By default, the API returns50 items per page.
32
+
33
+ The page number can be specified using the `page` query parameter, for example: `/api/vps/v1/public-keys?page=2`
34
+ # Errors
35
+ The Hostinger API uses standard HTTP status codes to indicate the success or failure of a request.
36
+ In case of an error, the API will return a JSON response with an `error` field, containing a human-readable error message.
37
+ Error responses also contain a `correlation_id` field which can be used to identify the request in case you need to contact support.
38
+ # Change log
39
+ For information on the latest changes to the API, please refer to the [change log](https://github.com/hostinger/api/blob/main/CHANGELOG.md).
40
+ # Support
41
+ If you have any questions, feedback or feature requests, please create an [issue](https://github.com/hostinger/api/issues) or [discussion](https://github.com/hostinger/api/discussions) on the repository.
42
+
43
+ For any support take a look at our [Github Repository](https://github.com/hostinger/api/), dedicated to the Hostinger API.
44
+
45
+ ## Installation
46
+
47
+ 1. Install dependencies:
48
+
49
+ ```bash
50
+ npm install
51
+ ```
52
+
53
+ 2. Create a `.env` file based on `.env.example`:
54
+
55
+ ```bash
56
+ cp .env.example .env
57
+ ```
58
+
59
+ 3. Edit the `.env` file to add your API configuration and authorization details.
60
+
61
+ ## Configuration
62
+
63
+ The following environment variables can be configured in the `.env` file:
64
+
65
+ - `API_BASE_URL`: Base URL for the API (required)
66
+ - `SERVER_NAME`: Name of the MCP server (default: "hostinger-api-mcp")
67
+ - `SERVER_VERSION`: Version of the MCP server (default: "0.0.1")
68
+ - `DEBUG`: Enable debug logging (true/false) (default: false)
69
+
70
+
71
+ ### Authorization Configuration
72
+
73
+ This server supports the following authorization schemes defined in the OpenAPI specification:
74
+
75
+ - **apiToken (HTTP Bearer)**: Set environment variable `APITOKEN` with your Bearer token. The token will be sent in the `Authorization` header.
76
+
77
+
78
+
79
+ ## Usage
80
+
81
+ ### Running the Server
82
+
83
+ The server is provided as both JavaScript and TypeScript versions:
84
+
85
+ ```bash
86
+ # Run JavaScript version
87
+ npm start
88
+
89
+ # Or run TypeScript version (compiles on the fly)
90
+ npm run start:ts
91
+ ```
92
+
93
+ ### Building the TypeScript Version
94
+
95
+ ```bash
96
+ npm run build
97
+ cd dist
98
+ node server.js
99
+ ```
100
+
101
+ ## Using as an MCP Tool Provider
102
+
103
+ This server implements the Model Context Protocol (MCP) and can be used with any MCP-compatible consumer, like Claude.js client or other MCP consumers.
104
+
105
+ Example of connecting to this server from a Claude.js client:
106
+
107
+ ```javascript
108
+ import { MCP } from "claude-js";
109
+ import { createStdio } from "claude-js/mcp";
110
+
111
+ // Create stdin/stdout transport
112
+ const transport = createStdio({ command: "node path/to/server.js" });
113
+
114
+ // Connect to the MCP server
115
+ const mcp = new MCP({ transport });
116
+ await mcp.connect();
117
+
118
+ // List available tools
119
+ const { tools } = await mcp.listTools();
120
+ console.log("Available tools:", tools);
121
+
122
+ // Call a tool
123
+ const result = await mcp.callTool({
124
+ id: "TOOL-ID",
125
+ arguments: { param1: "value1" }
126
+ });
127
+ console.log("Tool result:", result);
128
+ ```
129
+
130
+ ## Available Tools
131
+
132
+ This MCP server provides the following tools:
133
+
134
+ ### billing_getCatalogItemListV1
135
+
136
+ - **ID**: `undefined`
137
+ - **Description**: This endpoint retrieves a list of catalog items available for order.
138
+
139
+ Prices in catalog items is displayed as cents (without floating point), e.g: float `17.99` is displayed as integer `1799`.
140
+ - **Method**: `GET`
141
+ - **Path**: `/api/billing/v1/catalog`
142
+
143
+ No parameters required.
144
+
145
+ ### billing_createNewServiceOrderV1
146
+
147
+ - **ID**: `undefined`
148
+ - **Description**: This endpoint creates a new service order.
149
+
150
+ To place order, you need to provide payment method ID and list of price items from the catalog endpoint together with quantity.
151
+ Coupons also can be provided during order creation.
152
+
153
+ Orders created using this endpoint will be set for automatically renewal.
154
+ - **Method**: `POST`
155
+ - **Path**: `/api/billing/v1/orders`
156
+
157
+ **Parameters**:
158
+
159
+ - `payment_method_id`: Payment method ID (required)
160
+ - `items`: items property (required)
161
+ - `coupons`: coupons property
162
+
163
+ ### billing_setDefaultPaymentMethodV1
164
+
165
+ - **ID**: `undefined`
166
+ - **Description**: This endpoint sets default payment method for your account.
167
+ - **Method**: `POST`
168
+ - **Path**: `/api/billing/v1/payment-methods/{paymentMethodId}`
169
+
170
+ **Parameters**:
171
+
172
+ - `paymentMethodId`: Payment method ID (required)
173
+
174
+ ### billing_deletePaymentMethodV1
175
+
176
+ - **ID**: `undefined`
177
+ - **Description**: This endpoint deletes a payment method from your account.
178
+ - **Method**: `DELETE`
179
+ - **Path**: `/api/billing/v1/payment-methods/{paymentMethodId}`
180
+
181
+ **Parameters**:
182
+
183
+ - `paymentMethodId`: Payment method ID (required)
184
+
185
+ ### billing_getPaymentMethodListV1
186
+
187
+ - **ID**: `undefined`
188
+ - **Description**: This endpoint retrieves a list of available payment methods that can be used for placing new orders.
189
+
190
+ If you want to add new payment method, please use [hPanel](https://hpanel.hostinger.com/billing/payment-methods).
191
+ - **Method**: `GET`
192
+ - **Path**: `/api/billing/v1/payment-methods`
193
+
194
+ No parameters required.
195
+
196
+ ### billing_cancelSubscriptionV1
197
+
198
+ - **ID**: `undefined`
199
+ - **Description**: This endpoint cancels a subscription and stops any further billing.
200
+ - **Method**: `DELETE`
201
+ - **Path**: `/api/billing/v1/subscriptions/{subscriptionId}`
202
+
203
+ **Parameters**:
204
+
205
+ - `subscriptionId`: Subscription ID (required)
206
+
207
+ ### billing_getSubscriptionListV1
208
+
209
+ - **ID**: `undefined`
210
+ - **Description**: This endpoint retrieves a list of all subscriptions associated with your account.
211
+ - **Method**: `GET`
212
+ - **Path**: `/api/billing/v1/subscriptions`
213
+
214
+ No parameters required.
215
+
216
+ ### domains_getDomainListV1
217
+
218
+ - **ID**: `undefined`
219
+ - **Description**: This endpoint retrieves a list of all domains associated with your account.
220
+ - **Method**: `GET`
221
+ - **Path**: `/api/domains/v1/portfolio`
222
+
223
+ No parameters required.
224
+
225
+ ### VPS_getDataCentersListV1
226
+
227
+ - **ID**: `undefined`
228
+ - **Description**: This endpoint retrieves a list of all data centers available.
229
+ - **Method**: `GET`
230
+ - **Path**: `/api/vps/v1/data-centers`
231
+
232
+ No parameters required.
233
+
234
+ ### VPS_activateFirewallV1
235
+
236
+ - **ID**: `undefined`
237
+ - **Description**: This endpoint activates a firewall for a specified virtual machine.
238
+
239
+ Only one firewall can be active for a virtual machine at a time.
240
+ - **Method**: `POST`
241
+ - **Path**: `/api/vps/v1/firewall/{firewallId}/activate/{virtualMachineId}`
242
+
243
+ **Parameters**:
244
+
245
+ - `firewallId`: Firewall ID (required)
246
+ - `virtualMachineId`: Virtual Machine ID (required)
247
+
248
+ ### VPS_deactivateFirewallV1
249
+
250
+ - **ID**: `undefined`
251
+ - **Description**: This endpoint deactivates a firewall for a specified virtual machine.
252
+ - **Method**: `POST`
253
+ - **Path**: `/api/vps/v1/firewall/{firewallId}/deactivate/{virtualMachineId}`
254
+
255
+ **Parameters**:
256
+
257
+ - `firewallId`: Firewall ID (required)
258
+ - `virtualMachineId`: Virtual Machine ID (required)
259
+
260
+ ### VPS_getFirewallV1
261
+
262
+ - **ID**: `undefined`
263
+ - **Description**: This endpoint retrieves firewall by its ID and rules associated with it.
264
+ - **Method**: `GET`
265
+ - **Path**: `/api/vps/v1/firewall/{firewallId}`
266
+
267
+ **Parameters**:
268
+
269
+ - `firewallId`: Firewall ID (required)
270
+
271
+ ### VPS_deleteFirewallV1
272
+
273
+ - **ID**: `undefined`
274
+ - **Description**: This endpoint deletes a specified firewall.
275
+
276
+ Any virtual machine that has this firewall activated will automatically have it deactivated.
277
+ - **Method**: `DELETE`
278
+ - **Path**: `/api/vps/v1/firewall/{firewallId}`
279
+
280
+ **Parameters**:
281
+
282
+ - `firewallId`: Firewall ID (required)
283
+
284
+ ### VPS_getFirewallListV1
285
+
286
+ - **ID**: `undefined`
287
+ - **Description**: This endpoint retrieves a list of all firewalls available.
288
+ - **Method**: `GET`
289
+ - **Path**: `/api/vps/v1/firewall`
290
+
291
+ **Parameters**:
292
+
293
+ - `page`: Page number
294
+
295
+ ### VPS_createNewFirewallV1
296
+
297
+ - **ID**: `undefined`
298
+ - **Description**: This endpoint creates a new firewall.
299
+ - **Method**: `POST`
300
+ - **Path**: `/api/vps/v1/firewall`
301
+
302
+ **Parameters**:
303
+
304
+ - `name`: name property (required)
305
+
306
+ ### VPS_updateFirewallRuleV1
307
+
308
+ - **ID**: `undefined`
309
+ - **Description**: This endpoint updates a specific firewall rule from a specified firewall.
310
+
311
+ Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
312
+ - **Method**: `PUT`
313
+ - **Path**: `/api/vps/v1/firewall/{firewallId}/rules/{ruleId}`
314
+
315
+ **Parameters**:
316
+
317
+ - `firewallId`: Firewall ID (required)
318
+ - `ruleId`: Firewall Rule ID (required)
319
+ - `protocol`: protocol property (required)
320
+ - `port`: Port or port range, ex: 1024:2048 (required)
321
+ - `source`: source property (required)
322
+ - `source_detail`: IP range, CIDR, single IP or `any` (required)
323
+
324
+ ### VPS_deleteFirewallRuleV1
325
+
326
+ - **ID**: `undefined`
327
+ - **Description**: This endpoint deletes a specific firewall rule from a specified firewall.
328
+
329
+ Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
330
+ - **Method**: `DELETE`
331
+ - **Path**: `/api/vps/v1/firewall/{firewallId}/rules/{ruleId}`
332
+
333
+ **Parameters**:
334
+
335
+ - `firewallId`: Firewall ID (required)
336
+ - `ruleId`: Firewall Rule ID (required)
337
+
338
+ ### VPS_createFirewallRuleV1
339
+
340
+ - **ID**: `undefined`
341
+ - **Description**: This endpoint creates new firewall rule from a specified firewall.
342
+ By default, the firewall drops all incoming traffic, which means you must add accept rules for all ports you want to use.
343
+
344
+ Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
345
+ - **Method**: `POST`
346
+ - **Path**: `/api/vps/v1/firewall/{firewallId}/rules`
347
+
348
+ **Parameters**:
349
+
350
+ - `firewallId`: Firewall ID (required)
351
+ - `protocol`: protocol property (required)
352
+ - `port`: Port or port range, ex: 1024:2048 (required)
353
+ - `source`: source property (required)
354
+ - `source_detail`: IP range, CIDR, single IP or `any` (required)
355
+
356
+ ### VPS_syncFirewallV1
357
+
358
+ - **ID**: `undefined`
359
+ - **Description**: This endpoint syncs a firewall for a specified virtual machine.
360
+
361
+ Firewall can loose sync with virtual machine if the firewall has new rules added, removed or updated.
362
+ - **Method**: `POST`
363
+ - **Path**: `/api/vps/v1/firewall/{firewallId}/sync/{virtualMachineId}`
364
+
365
+ **Parameters**:
366
+
367
+ - `firewallId`: Firewall ID (required)
368
+ - `virtualMachineId`: Virtual Machine ID (required)
369
+
370
+ ### VPS_getPostInstallScriptV1
371
+
372
+ - **ID**: `undefined`
373
+ - **Description**: This endpoint retrieves post-install script by its ID.
374
+ - **Method**: `GET`
375
+ - **Path**: `/api/vps/v1/post-install-scripts/{postInstallScriptId}`
376
+
377
+ **Parameters**:
378
+
379
+ - `postInstallScriptId`: Post-install script ID (required)
380
+
381
+ ### VPS_updatePostInstallScriptV1
382
+
383
+ - **ID**: `undefined`
384
+ - **Description**: This endpoint updates a specific post-install script.
385
+ - **Method**: `PUT`
386
+ - **Path**: `/api/vps/v1/post-install-scripts/{postInstallScriptId}`
387
+
388
+ **Parameters**:
389
+
390
+ - `postInstallScriptId`: Post-install script ID (required)
391
+ - `name`: Name of the script (required)
392
+ - `content`: Content of the script (required)
393
+
394
+ ### VPS_deleteAPostInstallScriptV1
395
+
396
+ - **ID**: `undefined`
397
+ - **Description**: This endpoint deletes a post-install script from your account.
398
+ - **Method**: `DELETE`
399
+ - **Path**: `/api/vps/v1/post-install-scripts/{postInstallScriptId}`
400
+
401
+ **Parameters**:
402
+
403
+ - `postInstallScriptId`: Post-install script ID (required)
404
+
405
+ ### VPS_getPostInstallScriptListV1
406
+
407
+ - **ID**: `undefined`
408
+ - **Description**: This endpoint retrieves a list of post-install scripts associated with your account.
409
+ - **Method**: `GET`
410
+ - **Path**: `/api/vps/v1/post-install-scripts`
411
+
412
+ **Parameters**:
413
+
414
+ - `page`: Page number
415
+
416
+ ### VPS_createPostInstallScriptV1
417
+
418
+ - **ID**: `undefined`
419
+ - **Description**: This endpoint allows you to add a new post-install script to your account,
420
+ which can then be used run after the installation of a virtual machine instance.
421
+
422
+ The script contents will be saved to the file `/post_install` with executable attribute set and will be executed once virtual machine is installed.
423
+ The output of the script will be redirected to `/post_install.log`. Maximum script size is 48KB.
424
+ - **Method**: `POST`
425
+ - **Path**: `/api/vps/v1/post-install-scripts`
426
+
427
+ **Parameters**:
428
+
429
+ - `name`: Name of the script (required)
430
+ - `content`: Content of the script (required)
431
+
432
+ ### VPS_attachPublicKeyV1
433
+
434
+ - **ID**: `undefined`
435
+ - **Description**: This endpoint attaches an existing public keys from your account to a specified virtual machine.
436
+
437
+ Multiple keys can be attached to a single virtual machine.
438
+ - **Method**: `POST`
439
+ - **Path**: `/api/vps/v1/public-keys/attach/{virtualMachineId}`
440
+
441
+ **Parameters**:
442
+
443
+ - `virtualMachineId`: Virtual Machine ID (required)
444
+ - `ids`: Public Key IDs to attach (required)
445
+
446
+ ### VPS_deleteAPublicKeyV1
447
+
448
+ - **ID**: `undefined`
449
+ - **Description**: This endpoint deletes a public key from your account.
450
+
451
+ **Deleting public key from account does not remove it from virtual machine**
452
+ - **Method**: `DELETE`
453
+ - **Path**: `/api/vps/v1/public-keys/{publicKeyId}`
454
+
455
+ **Parameters**:
456
+
457
+ - `publicKeyId`: Public Key ID (required)
458
+
459
+ ### VPS_getPublicKeyListV1
460
+
461
+ - **ID**: `undefined`
462
+ - **Description**: This endpoint retrieves a list of public keys associated with your account.
463
+ - **Method**: `GET`
464
+ - **Path**: `/api/vps/v1/public-keys`
465
+
466
+ **Parameters**:
467
+
468
+ - `page`: Page number
469
+
470
+ ### VPS_createNewPublicKeyV1
471
+
472
+ - **ID**: `undefined`
473
+ - **Description**: This endpoint allows you to add a new public key to your account,
474
+ which can then be attached to virtual machine instances for secure access.
475
+ - **Method**: `POST`
476
+ - **Path**: `/api/vps/v1/public-keys`
477
+
478
+ **Parameters**:
479
+
480
+ - `name`: name property (required)
481
+ - `key`: key property (required)
482
+
483
+ ### VPS_getTemplateV1
484
+
485
+ - **ID**: `undefined`
486
+ - **Description**: This endpoint retrieves details of a specific OS template for virtual machines.
487
+ - **Method**: `GET`
488
+ - **Path**: `/api/vps/v1/templates/{templateId}`
489
+
490
+ **Parameters**:
491
+
492
+ - `templateId`: Template ID (required)
493
+
494
+ ### VPS_getTemplateListV1
495
+
496
+ - **ID**: `undefined`
497
+ - **Description**: This endpoint retrieves a list of available OS templates for virtual machines.
498
+ - **Method**: `GET`
499
+ - **Path**: `/api/vps/v1/templates`
500
+
501
+ No parameters required.
502
+
503
+ ### VPS_getActionV1
504
+
505
+ - **ID**: `undefined`
506
+ - **Description**: This endpoint retrieves details of a specific action performed on a specified virtual machine.
507
+
508
+ This endpoint allows you to view detailed information about a particular action, including the action name, timestamp, and status.
509
+ - **Method**: `GET`
510
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/actions/{actionId}`
511
+
512
+ **Parameters**:
513
+
514
+ - `virtualMachineId`: Virtual Machine ID (required)
515
+ - `actionId`: Action ID (required)
516
+
517
+ ### VPS_getActionListV1
518
+
519
+ - **ID**: `undefined`
520
+ - **Description**: This endpoint retrieves a list of actions performed on a specified virtual machine.
521
+
522
+ Actions are operations or events that have been executed on the virtual machine, such as starting, stopping, or modifying
523
+ the machine. This endpoint allows you to view the history of these actions, providing details about each action,
524
+ such as the action name, timestamp, and status.
525
+ - **Method**: `GET`
526
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/actions`
527
+
528
+ **Parameters**:
529
+
530
+ - `virtualMachineId`: Virtual Machine ID (required)
531
+ - `page`: Page number
532
+
533
+ ### VPS_getAttachedPublicKeysV1
534
+
535
+ - **ID**: `undefined`
536
+ - **Description**: This endpoint retrieves a list of public keys attached to a specified virtual machine.
537
+ - **Method**: `GET`
538
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/public-keys`
539
+
540
+ **Parameters**:
541
+
542
+ - `virtualMachineId`: Virtual Machine ID (required)
543
+ - `page`: Page number
544
+
545
+ ### VPS_deleteBackupV1
546
+
547
+ - **ID**: `undefined`
548
+ - **Description**: This endpoint deletes a specified backup for a virtual machine.
549
+ - **Method**: `DELETE`
550
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/backups/{backupId}`
551
+
552
+ **Parameters**:
553
+
554
+ - `virtualMachineId`: Virtual Machine ID (required)
555
+ - `backupId`: Backup ID (required)
556
+
557
+ ### VPS_getBackupListV1
558
+
559
+ - **ID**: `undefined`
560
+ - **Description**: This endpoint retrieves a list of backups for a specified virtual machine.
561
+ - **Method**: `GET`
562
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/backups`
563
+
564
+ **Parameters**:
565
+
566
+ - `page`: Page number
567
+ - `virtualMachineId`: Virtual Machine ID (required)
568
+
569
+ ### VPS_restoreBackupV1
570
+
571
+ - **ID**: `undefined`
572
+ - **Description**: This endpoint restores a backup for a specified virtual machine.
573
+
574
+ The system will then initiate the restore process, which may take some time depending on the size of the backup.
575
+
576
+ **All data on the virtual machine will be overwritten with the data from the backup.**
577
+ - **Method**: `POST`
578
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/backups/{backupId}/restore`
579
+
580
+ **Parameters**:
581
+
582
+ - `virtualMachineId`: Virtual Machine ID (required)
583
+ - `backupId`: Backup ID (required)
584
+
585
+ ### VPS_setHostnameV1
586
+
587
+ - **ID**: `undefined`
588
+ - **Description**: This endpoint sets the hostname for a specified virtual machine.
589
+ Changing hostname does not update PTR record automatically.
590
+ If you want your virtual machine to be reachable by a hostname,
591
+ you need to point your domain A/AAAA records to virtual machine IP as well.
592
+ - **Method**: `PUT`
593
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/hostname`
594
+
595
+ **Parameters**:
596
+
597
+ - `virtualMachineId`: Virtual Machine ID (required)
598
+ - `hostname`: hostname property (required)
599
+
600
+ ### VPS_resetHostnameV1
601
+
602
+ - **ID**: `undefined`
603
+ - **Description**: This endpoint resets the hostname and PTR record of a specified virtual machine to the default value.
604
+ - **Method**: `DELETE`
605
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/hostname`
606
+
607
+ **Parameters**:
608
+
609
+ - `virtualMachineId`: Virtual Machine ID (required)
610
+
611
+ ### VPS_getVirtualMachineV1
612
+
613
+ - **ID**: `undefined`
614
+ - **Description**: This endpoint retrieves detailed information about a specified virtual machine.
615
+ - **Method**: `GET`
616
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}`
617
+
618
+ **Parameters**:
619
+
620
+ - `virtualMachineId`: Virtual Machine ID (required)
621
+
622
+ ### VPS_getVirtualMachineListV1
623
+
624
+ - **ID**: `undefined`
625
+ - **Description**: This endpoint retrieves a list of all available virtual machines.
626
+ - **Method**: `GET`
627
+ - **Path**: `/api/vps/v1/virtual-machines`
628
+
629
+ No parameters required.
630
+
631
+ ### VPS_getScanMetricsV1
632
+
633
+ - **ID**: `undefined`
634
+ - **Description**: This endpoint retrieves the scan metrics for the [Monarx](https://www.monarx.com/) malware scanner installed on a specified virtual machine.
635
+ The scan metrics provide detailed information about the malware scans performed by Monarx, including the number of scans,
636
+ detected threats, and other relevant statistics. This information is useful for monitoring the security status of the
637
+ virtual machine and assessing the effectiveness of the malware scanner.
638
+ - **Method**: `GET`
639
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/monarx`
640
+
641
+ **Parameters**:
642
+
643
+ - `virtualMachineId`: Virtual Machine ID (required)
644
+
645
+ ### VPS_installMonarxV1
646
+
647
+ - **ID**: `undefined`
648
+ - **Description**: This endpoint installs the Monarx malware scanner on a specified virtual machine.
649
+
650
+ [Monarx](https://www.monarx.com/) is a security tool designed to detect and prevent malware infections on virtual machines.
651
+ By installing Monarx, users can enhance the security of their virtual machines, ensuring that they are protected against malicious software.
652
+ - **Method**: `POST`
653
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/monarx`
654
+
655
+ **Parameters**:
656
+
657
+ - `virtualMachineId`: Virtual Machine ID (required)
658
+
659
+ ### VPS_uninstallMonarxV1
660
+
661
+ - **ID**: `undefined`
662
+ - **Description**: This endpoint uninstalls the Monarx malware scanner on a specified virtual machine.
663
+ If Monarx is not installed, the request will still be processed without any effect.
664
+ - **Method**: `DELETE`
665
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/monarx`
666
+
667
+ **Parameters**:
668
+
669
+ - `virtualMachineId`: Virtual Machine ID (required)
670
+
671
+ ### VPS_getMetricsV1
672
+
673
+ - **ID**: `undefined`
674
+ - **Description**: This endpoint retrieves the historical metrics for a specified virtual machine.
675
+ It includes the following metrics:
676
+ - CPU usage
677
+ - Memory usage
678
+ - Disk usage
679
+ - Network usage
680
+ - Uptime
681
+ - **Method**: `GET`
682
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/metrics`
683
+
684
+ **Parameters**:
685
+
686
+ - `virtualMachineId`: Virtual Machine ID (required)
687
+ - `date_from`: the date-time notation as defined by RFC 3339, section 5.6 (required)
688
+ - `date_to`: the date-time notation as defined by RFC 3339, section 5.6 (required)
689
+
690
+ ### VPS_setNameserversV1
691
+
692
+ - **ID**: `undefined`
693
+ - **Description**: This endpoint sets the nameservers for a specified virtual machine.
694
+ Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.
695
+ - **Method**: `PUT`
696
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/nameservers`
697
+
698
+ **Parameters**:
699
+
700
+ - `virtualMachineId`: Virtual Machine ID (required)
701
+ - `ns1`: ns1 property (required)
702
+ - `ns2`: ns2 property
703
+
704
+ ### VPS_createPTRRecordV1
705
+
706
+ - **ID**: `undefined`
707
+ - **Description**: This endpoint creates or updates a PTR (Pointer) record for a specified virtual machine.
708
+ - **Method**: `POST`
709
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/ptr`
710
+
711
+ **Parameters**:
712
+
713
+ - `virtualMachineId`: Virtual Machine ID (required)
714
+
715
+ ### VPS_deletePTRRecordV1
716
+
717
+ - **ID**: `undefined`
718
+ - **Description**: This endpoint deletes a PTR (Pointer) record for a specified virtual machine.
719
+
720
+ Once deleted, reverse DNS lookups to the virtual machine's IP address will no longer return the previously configured hostname.
721
+ - **Method**: `DELETE`
722
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/ptr`
723
+
724
+ **Parameters**:
725
+
726
+ - `virtualMachineId`: Virtual Machine ID (required)
727
+
728
+ ### VPS_setPanelPasswordV1
729
+
730
+ - **ID**: `undefined`
731
+ - **Description**: This endpoint sets the panel password for a specified virtual machine.
732
+ If virtual machine does not use panel OS, the request will still be processed without any effect.
733
+ Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
734
+ - **Method**: `PUT`
735
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/panel-password`
736
+
737
+ **Parameters**:
738
+
739
+ - `virtualMachineId`: Virtual Machine ID (required)
740
+ - `password`: Panel password for the virtual machine (required)
741
+
742
+ ### VPS_startRecoveryModeV1
743
+
744
+ - **ID**: `undefined`
745
+ - **Description**: This endpoint initiates the recovery mode for a specified virtual machine.
746
+ Recovery mode is a special state that allows users to perform system rescue operations,
747
+ such as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine
748
+ from booting normally.
749
+
750
+ Virtual machine will boot recovery disk image and original disk image will be mounted in `/mnt` directory.
751
+ - **Method**: `POST`
752
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/recovery`
753
+
754
+ **Parameters**:
755
+
756
+ - `virtualMachineId`: Virtual Machine ID (required)
757
+ - `root_password`: Temporary root password for recovery mode (required)
758
+
759
+ ### VPS_stopRecoveryModeV1
760
+
761
+ - **ID**: `undefined`
762
+ - **Description**: This endpoint stops the recovery mode for a specified virtual machine.
763
+ If virtual machine is not in recovery mode, this operation will fail.
764
+ - **Method**: `DELETE`
765
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/recovery`
766
+
767
+ **Parameters**:
768
+
769
+ - `virtualMachineId`: Virtual Machine ID (required)
770
+
771
+ ### VPS_recreateVirtualMachineV1
772
+
773
+ - **ID**: `undefined`
774
+ - **Description**: This endpoint will recreate a virtual machine from scratch.
775
+ The recreation process involves reinstalling the operating system and resetting the virtual machine to its initial state.
776
+ Snapshots, if there are any, will be deleted.
777
+
778
+ ## Password Requirements
779
+ Password will be checked against leaked password databases.
780
+ Requirements for the password are:
781
+ - At least 8 characters long
782
+ - At least one uppercase letter
783
+ - At least one lowercase letter
784
+ - At least one number
785
+ - Is not leaked publicly
786
+
787
+ **This operation is irreversible and will result in the loss of all data stored on the virtual machine!**
788
+ - **Method**: `POST`
789
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/recreate`
790
+
791
+ **Parameters**:
792
+
793
+ - `virtualMachineId`: Virtual Machine ID (required)
794
+ - `template_id`: Template ID (required)
795
+ - `password`: Password for the virtual machine. If not provided, random password will be generated. Password will not be shown in the response.
796
+ - `post_install_script_id`: Post-install script ID
797
+
798
+ ### VPS_restartVirtualMachineV1
799
+
800
+ - **ID**: `undefined`
801
+ - **Description**: This endpoint restarts a specified virtual machine. This is equivalent to fully stopping and starting the virtual machine.
802
+ If the virtual machine was stopped, it will be started.
803
+ - **Method**: `POST`
804
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/restart`
805
+
806
+ **Parameters**:
807
+
808
+ - `virtualMachineId`: Virtual Machine ID (required)
809
+
810
+ ### VPS_setRootPasswordV1
811
+
812
+ - **ID**: `undefined`
813
+ - **Description**: This endpoint sets the root password for a specified virtual machine.
814
+ Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
815
+ - **Method**: `PUT`
816
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/root-password`
817
+
818
+ **Parameters**:
819
+
820
+ - `virtualMachineId`: Virtual Machine ID (required)
821
+ - `password`: Root password for the virtual machine (required)
822
+
823
+ ### VPS_setupNewVirtualMachineV1
824
+
825
+ - **ID**: `undefined`
826
+ - **Description**: This endpoint will setup newly purchased virtual machine. Such virtual machines has `initial` state.
827
+ New virtual machine can be purchased using [`/api/billing/v1/orders`](/#tag/billing-orders/POST/api/billing/v1/orders) endpoint.
828
+ - **Method**: `POST`
829
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/setup`
830
+
831
+ **Parameters**:
832
+
833
+ - `virtualMachineId`: Virtual Machine ID (required)
834
+ - `template_id`: Template ID (required)
835
+ - `data_center_id`: Data center ID (required)
836
+ - `post_install_script_id`: Post-install script ID
837
+ - `password`: Password for the virtual machine. If not provided, random password will be generated. Password will not be shown in the response.
838
+ - `hostname`: Override default hostname of the virtual machine
839
+ - `install_monarx`: Install Monarx malware scanner (if supported)
840
+ - `enable_backups`: Enable weekly backup schedule
841
+ - `ns1`: ns1 property
842
+ - `ns2`: ns2 property
843
+ - `public_key`: public_key property
844
+
845
+ ### VPS_getSnapshotV1
846
+
847
+ - **ID**: `undefined`
848
+ - **Description**: This endpoint retrieves a snapshot for a specified virtual machine.
849
+ - **Method**: `GET`
850
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/snapshot`
851
+
852
+ **Parameters**:
853
+
854
+ - `virtualMachineId`: Virtual Machine ID (required)
855
+
856
+ ### VPS_createSnapshotV1
857
+
858
+ - **ID**: `undefined`
859
+ - **Description**: This endpoint creates a snapshot of a specified virtual machine.
860
+ A snapshot captures the state and data of the virtual machine at a specific point in time,
861
+ allowing users to restore the virtual machine to that state if needed.
862
+ This operation is useful for backup purposes, system recovery,
863
+ and testing changes without affecting the current state of the virtual machine.
864
+
865
+ **Creating new snapshot will overwrite the existing snapshot!**
866
+ - **Method**: `POST`
867
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/snapshot`
868
+
869
+ **Parameters**:
870
+
871
+ - `virtualMachineId`: Virtual Machine ID (required)
872
+
873
+ ### VPS_deleteSnapshotV1
874
+
875
+ - **ID**: `undefined`
876
+ - **Description**: This endpoint deletes a snapshot of a specified virtual machine.
877
+ - **Method**: `DELETE`
878
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/snapshot`
879
+
880
+ **Parameters**:
881
+
882
+ - `virtualMachineId`: Virtual Machine ID (required)
883
+
884
+ ### VPS_restoreSnapshotV1
885
+
886
+ - **ID**: `undefined`
887
+ - **Description**: This endpoint restores a specified virtual machine to a previous state using a snapshot.
888
+ Restoring from a snapshot allows users to revert the virtual machine to that state, which is useful for system recovery, undoing changes, or testing.
889
+ - **Method**: `POST`
890
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/snapshot/restore`
891
+
892
+ **Parameters**:
893
+
894
+ - `virtualMachineId`: Virtual Machine ID (required)
895
+
896
+ ### VPS_startVirtualMachineV1
897
+
898
+ - **ID**: `undefined`
899
+ - **Description**: This endpoint starts a specified virtual machine.
900
+ If the virtual machine is already running, the request will still be processed without any effect.
901
+ - **Method**: `POST`
902
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/start`
903
+
904
+ **Parameters**:
905
+
906
+ - `virtualMachineId`: Virtual Machine ID (required)
907
+
908
+ ### VPS_stopVirtualMachineV1
909
+
910
+ - **ID**: `undefined`
911
+ - **Description**: This endpoint stops a specified virtual machine.
912
+ If the virtual machine is already stopped, the request will still be processed without any effect.
913
+ - **Method**: `POST`
914
+ - **Path**: `/api/vps/v1/virtual-machines/{virtualMachineId}/stop`
915
+
916
+ **Parameters**:
917
+
918
+ - `virtualMachineId`: Virtual Machine ID (required)
919
+
920
+ ## License
921
+
922
+ MIT