GitHub Copilot

IDE Plugin

Un prugrammatore di coppia AI da GitHub chì suggerisci u cumplimentu di u codice in u vostru IDE. Mantene a riferenza API VPS.org aperta accanto à u vostru codice per suggerimenti cuntempuranei.

https://github.com/features/copilot
Scaricate u fugliale.md
$ githubcopilot "deploy my app to VPS.org"
Creazione di nu servituri... donna
Registrazione di u duminiu... donna
Configurazione DNS... donna
Distribuisci l'applicazzioni... donna
App in diretta à https://myapp.com

GitHub Copilot Carattiristichi

Integrazione IDE

Funziona in VS Code, JetBrains, Neovim, è Visual Studio.

Completazione di codice

Genera suggerimenti di codice basati supra li file aperti ntô vostru editori.

Chatta

Faci dumande in lingua naturale circa u codice è l'API in u to spaziu di travagliu.

Cumu GitHub Copilot Funziona cu VPS.org

Utilizzandu GitHub Copilot cù VPS.org

Aprite u fugliale.md accanto a u vostru codice, è Copilot usarà u riferimentu API comu cuntestu pi generari un codice cchiù precisu quannu si travagghia cu l'API VPS.org. Funziona cu Copilot Chat pi dumande in lingua naturale ncapu l'API.

Configurazione

  1. Scarica lu fugliale.md
  2. Aggiungi lu ô repositoriu di u vostru prugettu
  3. Aprite in una scheda in VS Code accanto à u vostru codice
  4. Copilot lu rifiriscirà quannu si genera u codice

Fichieru di rifirimentu API

Chistu è lu cuntinutu cumpletu di u fugliale.md. Copiallu o scaricàllu pi usallu cu GitHub Copilot.

Scaricate u fugliale.md
# VPS.org API Integration Guide for GitHub Copilot

This document provides GitHub Copilot with the information needed to interact
with the VPS.org cloud hosting API. Keep this file open in your editor
for Copilot to use as context when generating API integration code.

## Quick Start
1. Get API token from https://admin.vps.org/account/developers/
2. Use `Authorization: Bearer <your-token>` header in all requests
3. Base URL: https://admin.vps.org/api/v1/

## Authentication

All API requests require a Bearer token. Generate one at https://admin.vps.org/account/developers/

```
Authorization: Bearer YOUR_API_TOKEN
```

**Base URL:** `https://admin.vps.org/api/v1/`

**Rate Limit:** 300 requests per 5 minutes per token.

**Token Format:** Tokens start with `vps_` followed by 64 hex characters. They are SHA256-hashed before storage.

**Permission System:** Tokens use `app:action` format permissions (e.g., `servers:create`, `dns:*`, `*:*` for full access).

---

## Servers

### List All Servers
```
GET /api/v1/servers/
```
**Query Parameters:**
- `status` (string, optional) — Filter by status: `active`, `stopped`, `suspended`
- `location` (string, optional) — Filter by datacenter location

**Response (200):**
```json
{
  "count": 2,
  "results": [
    {
      "id": 12345,
      "name": "web-server-01",
      "hostname": "web01.example.com",
      "status": "active",
      "ip_address": "203.0.113.10",
      "location": "us-west",
      "plan": {"id": 1, "name": "Standard VPS", "vcpus": 2, "memory": 4096, "storage": 80},
      "os": {"id": 5, "name": "Ubuntu 22.04 LTS"},
      "created_at": "2025-01-10T14:30:00Z"
    }
  ]
}
```

### Create New Server
```
POST /api/v1/servers/
```
**Request Body:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | Yes | Server name (alphanumeric, hyphens allowed) |
| plan_id | integer | Yes | ID of the VPS plan |
| os_id | integer | Yes | ID of the operating system |
| location | string | Yes | Datacenter location code |
| hostname | string | No | Server hostname (FQDN) |
| ssh_key_id | integer | No | SSH key ID to install |
| backups_enabled | boolean | No | Enable automatic backups (default: false) |

**Response (201):**
```json
{
  "id": 12347,
  "name": "web-server-02",
  "hostname": "web02.example.com",
  "status": "provisioning",
  "ip_address": null,
  "location": "us-west",
  "plan": {"id": 1, "name": "Standard VPS", "vcpus": 2, "memory": 4096, "storage": 80},
  "os": {"id": 5, "name": "Ubuntu 22.04 LTS"},
  "backups_enabled": true,
  "message": "Server is being provisioned. This may take 2-5 minutes."
}
```

### Get Server Details
```
GET /api/v1/servers/{server_id}/
```
**Response (200):** Full server object including `resource_usage` (cpu_percent, memory_used, disk_used, bandwidth_used).

### Update Server
```
PUT /api/v1/servers/{server_id}/
```
**Request Body:** `name` (string), `hostname` (string), `backups_enabled` (boolean) — all required.

### Partial Update Server
```
PATCH /api/v1/servers/{server_id}/
```
Only provided fields will be updated.

### Delete Server
```
DELETE /api/v1/servers/{server_id}/
```
**Response:** 204 No Content. This action cannot be undone.

### Power Management
```
POST /api/v1/servers/{server_id}/start/    — Power on a stopped server
POST /api/v1/servers/{server_id}/stop/     — Gracefully shut down a running server
POST /api/v1/servers/{server_id}/reboot/   — Restart a running server
```
**Response (200):**
```json
{
  "status": "success",
  "message": "Server is starting",
  "server": {"id": 12345, "name": "web-server-01", "status": "starting"}
}
```

---

## Plans

### List All Plans
```
GET /api/v1/plans/
```
Returns available VPS plans with pricing, CPU, memory, storage, and bandwidth details.

### Get Plan Details
```
GET /api/v1/plans/{plan_id}/
```

---

## Operating Systems

### List Operating Systems
```
GET /api/v1/operating-systems/
```
Returns available OS images for server deployment (Ubuntu, Debian, CentOS, etc.).

### Get OS Details
```
GET /api/v1/operating-systems/{os_id}/
```

---

## Locations

### List Datacenter Locations
```
GET /api/v1/locations/
```
Returns available datacenter regions with their codes and capabilities.

---

## Backups

### List Server Backups
```
GET /api/v1/servers/{server_id}/backups/
```

### Create Backup
```
POST /api/v1/servers/{server_id}/backups/
```
**Request Body:**
- `name` (string, optional) — Backup name

### Restore Backup
```
POST /api/v1/servers/{server_id}/backups/{backup_id}/restore/
```

---

## Snapshots

### List Snapshots
```
GET /api/v1/snapshots/
```

### Create Snapshot
```
POST /api/v1/servers/{server_id}/snapshots/
```
**Request Body:**
- `name` (string, optional) — Snapshot name

### Restore Snapshot
```
POST /api/v1/snapshots/{snapshot_id}/restore/
```

### Delete Snapshot
```
DELETE /api/v1/snapshots/{snapshot_id}/
```

---

## SSH Keys

### List SSH Keys
```
GET /api/v1/ssh-keys/
```

### Add SSH Key
```
POST /api/v1/ssh-keys/
```
**Request Body:**
- `name` (string, required) — Key name
- `public_key` (string, required) — SSH public key content

### Delete SSH Key
```
DELETE /api/v1/ssh-keys/{key_id}/
```

---

## Domains

### List All Domains
```
GET /api/v1/domains/
```
**Query Parameters:**
- `status` (string, optional) — Filter: `active`, `pending`, `expired`, `locked`
- `search` (string, optional) — Search domains by name

**Response (200):**
```json
{
  "count": 2,
  "results": [
    {
      "id": 101,
      "domain_name": "example.com",
      "status": "active",
      "registration_date": "2023-01-15T10:30:00Z",
      "expiration_date": "2026-01-15T10:30:00Z",
      "auto_renew": true,
      "locked": true,
      "nameservers": ["ns1.vps.org", "ns2.vps.org"],
      "privacy_protection": true
    }
  ]
}
```

### Register New Domain
```
POST /api/v1/domains/
```
**Request Body:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| domain_name | string | Yes | Domain to register (e.g., "example.com") |
| years | integer | No | Registration period 1-10 (default: 1) |
| auto_renew | boolean | No | Enable auto-renewal (default: true) |
| privacy_protection | boolean | No | Enable WHOIS privacy (default: true) |
| nameservers | array | No | Custom nameservers (default: VPS.org) |

**Response (201):** Domain object with `status: "pending"`. Registration takes 5-10 minutes.

### Get Domain Details
```
GET /api/v1/domains/{domain_id}/
```

### Update Domain Settings
```
PUT /api/v1/domains/{domain_id}/
```
**Request Body:** `auto_renew`, `privacy_protection`, `nameservers`, `locked` — all optional.

### Delete Domain
```
DELETE /api/v1/domains/{domain_id}/
```
Removes from account only. Domain registration remains active.

### Transfer Domain
```
POST /api/v1/domains/{domain_id}/transfer/
```
**Request Body:**
- `auth_code` (string, required) — EPP/Authorization code from current registrar
- `auto_renew` (boolean, optional) — Enable auto-renewal after transfer

---

## DNS Zones

### List DNS Zones
```
GET /api/v1/dns-zones/
```
**Query Parameters:**
- `domain` (string, optional) — Filter by exact domain name

**Response (200):**
```json
[
  {
    "uuid": "abc123-def456-ghi789",
    "domain": "example.com",
    "created_at": "2024-01-15T10:30:00Z",
    "record_count": 12
  }
]
```

### Create DNS Zone
```
POST /api/v1/dns-zones/
```
**Request Body:**
- `domain` (string, required) — Domain name (e.g., "example.com")

### Get DNS Zone Details
```
GET /api/v1/dns-zones/{uuid}/
```
Returns zone with all records.

### Delete DNS Zone
```
DELETE /api/v1/dns-zones/{uuid}/
```

---

## DNS Records

### List Records in Zone
```
GET /api/v1/dns-zones/{uuid}/records/
```

### Create DNS Record
```
POST /api/v1/dns-zones/{uuid}/records/
```
**Request Body:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| record_type | string | Yes | A, AAAA, CNAME, MX, TXT, NS, SRV, CAA |
| name | string | Yes | Record name (@ for root, subdomain, or FQDN) |
| value | string | Yes | Record value (IP, hostname, text) |
| ttl | integer | No | Time to live in seconds (default: 3600) |
| priority | integer | MX/SRV | Priority (required for MX and SRV records) |

**Response (201):**
```json
{
  "uuid": "rec-003",
  "record_type": "A",
  "name": "www",
  "value": "192.0.2.1",
  "ttl": 3600,
  "priority": null,
  "created_at": "2026-01-18T16:50:00Z"
}
```

### Manage Individual Records
```
GET    /api/v1/dns-records/{uuid}/   — Get record details
PUT    /api/v1/dns-records/{uuid}/   — Full update (all fields required)
PATCH  /api/v1/dns-records/{uuid}/   — Partial update
DELETE /api/v1/dns-records/{uuid}/   — Delete record
```

**Supported Record Types:** A, AAAA, CNAME, MX, TXT, NS, SRV, CAA

---

## Common Workflows

### Deploy a New Application
```
1. GET  /api/v1/plans/                              — Choose a plan
2. GET  /api/v1/operating-systems/                   — Choose an OS
3. GET  /api/v1/locations/                           — Choose a datacenter
4. POST /api/v1/servers/                             — Create the server
   Body: {"name": "myapp", "plan_id": 1, "os_id": 5, "location": "us-west"}
5. GET  /api/v1/servers/{id}/                        — Poll until status is "active"
6. SSH into server using the IP address to deploy your application
```

### Set Up a Domain with DNS
```
1. POST /api/v1/domains/                             — Register domain
   Body: {"domain_name": "myapp.com", "years": 1}
2. POST /api/v1/dns-zones/                           — Create DNS zone
   Body: {"domain": "myapp.com"}
3. POST /api/v1/dns-zones/{uuid}/records/            — Add A record
   Body: {"record_type": "A", "name": "@", "value": "SERVER_IP", "ttl": 3600}
4. POST /api/v1/dns-zones/{uuid}/records/            — Add www CNAME
   Body: {"record_type": "CNAME", "name": "www", "value": "myapp.com", "ttl": 3600}
```

### Full Deployment (Server + Domain + DNS)
```
1. Create server (see above)
2. Wait for server to become active, note the IP address
3. Register domain
4. Create DNS zone
5. Add A record pointing to server IP
6. Add any additional records (MX for email, TXT for verification, etc.)
7. SSH into server and deploy your application
8. (Optional) Set up SSL with Let's Encrypt
```

---

## Error Codes

| Status | Description |
|--------|-------------|
| 200 | Success |
| 201 | Created |
| 204 | No Content (successful deletion) |
| 400 | Bad Request — Invalid parameters |
| 401 | Unauthorized — Invalid or missing token |
| 402 | Payment Required — Insufficient credits |
| 403 | Forbidden — Insufficient permissions |
| 404 | Not Found — Resource doesn't exist |
| 429 | Too Many Requests — Rate limit exceeded |
| 500 | Internal Server Error |

**Rate Limit Headers:**
- `X-RateLimit-Limit` — Maximum requests allowed
- `X-RateLimit-Remaining` — Requests remaining
- `X-RateLimit-Reset` — Timestamp when limit resets

---

## Nameserver Infrastructure

- **ns1.vps.org** (38.248.6.195) — Primary master with DNSSEC
- **ns2.vps.org** (38.248.6.196) — Secondary
- **ns3.vps.org** (38.248.6.197) — Secondary

## Support

- **Support Tickets:** https://admin.vps.org/tickets/
- **Email:** hello@vps.org
- **Documentation:** https://www.vps.org/docs/
- **API Docs:** https://www.vps.org/api/