Claude Code

CLI Tool

Kifaa cha kupanga uzazi cha Anthropic ambacho huishi katika kituo chako. Ipe VPS.org API rem faili ya CLAUDEd na utumie lugha ya asili kwa wanasarakasi, nyanja za kusimamia, na miundo mbinu ya maendeleo.

https://docs.anthropic.com/en/docs/claude-code
Pakiail.md File
$ claudecode "Mimi hutumia programu yangu kufikia VPS.org"
Kubuni kejeli... print operation status
Utawala wa uandikishaji... print operation status
ARUGU DNS... print operation status
Matumizi rahisi... print operation status
App anaishi https://myapp.com

Claude Code Sehemu

Wenyeji wa Panda

Pinga katika kituo chako chenye uwezo kamili wa kutekeleza amri na API.

Kufishwa kwa Kiakili

Mipango isiyo na msingi na ya kuchukua hatua za aina mbalimbali bila msaada wa mikono.

Utegemezo wa Habari Wapungua

CLAUDE amenukuliwa kutoka kwenye mzizi wako wa mradi, na hivyo kufanya mradi huo uwe mzuri kwa kupandisha marejezo ya API.

Jinsi Gani? Claude Code Fanya kazi na VPS.org

Kutumia Sheria ya Claude kwa VPS.org

Claude Code inaweza kusoma faili ya marejeo ya VPS.org API na kuitumia kama muktadha kuandika na kutekeleza simu za API zinazosambaza seva, kusajili vikoa, na kusanidi DNS. Weka tu faili ya .md kwenye mzizi wa mradi wako kama CLAUDE.md, na Claude Code itaitumia kiotomatiki kama muktadha.

Maagizo ya Kuanzisha

  1. Pakua faili ya mard chini
  2. Iweke kama CLAUDE.md katika mzizi wa mradi wako
  3. Endesha claude kwenye terminal yako
  4. Mwombe Claude atumie programu yako ya VPS.org

Amri za Mfano

  • "Mbuni mpya wa VPS kwa Ubuntu 22.04 kwenye ramani ya Standard"
  • "Msajili myapp.com na kuuelekeza kwa mtumishi wangu"
  • "Kuweka rekodi za ugonjwa wa DNS kwa ajili ya mypp.com na rekodi inayoelekeza kwenye serji yangu IP"
  • "Kubuni picha ya uandaaji wangu wa mtandaoni"

API Reference File

Hii ni faili kamili. Inakili au uipeleke ili uitumie Claude Code.

Pakiail.md File
# VPS.org API Integration Guide for Claude Code

This document provides Claude Code with the information needed to interact
with the VPS.org cloud hosting API. Use these endpoints to create servers,
register domains, configure DNS, and manage cloud infrastructure.

Place this file as `CLAUDE.md` in your project root for automatic context loading.

## 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/