Loading...
Loading...
Build integrations with Rocket.net's WordPress hosting API. Manage sites, domains, backups, plugins, themes, CDN cache, FTP accounts, and more programmatically. Use when: building WordPress hosting management tools, automating site deployment, creating reseller portals, managing multiple WordPress sites, integrating with Rocket.net hosting services, automating backup workflows, or building custom control panels.
npx skill4agent add jezweb/claude-skills rocket-net-apihttps://api.rocket.net/v1/loginAuthorization: Bearer <token>Content-Type: application/jsonAccept: application/jsonconst response = await fetch('https://api.rocket.net/v1/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
username: 'your-email@example.com',
password: 'your-password'
})
});
const { token } = await response.json();
// Use token in subsequent requestsasync function rocketApiRequest(
endpoint: string,
options: RequestInit = {}
): Promise<any> {
const response = await fetch(`https://api.rocket.net/v1${endpoint}`, {
...options,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`,
...options.headers
}
});
if (response.status === 401) {
// Token expired, re-authenticate
throw new Error('Token expired - request new token');
}
return response.json();
}| Method | Endpoint | Description |
|---|---|---|
| GET | | List all sites |
| POST | | Create new site |
| GET | | Get site details |
| PATCH | | Update site properties |
| DELETE | | Delete site |
| POST | | Clone a site (background task) |
| GET | | Get site credentials |
| GET | | Get site usage statistics |
| POST | | Lock site (prevent modifications) |
| DELETE | | Unlock site |
| GET | | Get phpMyAdmin SSO link |
| GET | | Get site settings |
| PATCH | | Update site settings |
| GET | | List available site locations |
| Method | Endpoint | Description |
|---|---|---|
| POST | | Create staging site |
| DELETE | | Delete staging site |
| POST | | Publish staging to production |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List site templates |
| POST | | Create site template |
| GET | | Get template details |
| DELETE | | Delete template |
| POST | | Create site from template |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List domain aliases |
| POST | | Add domain alias |
| DELETE | | Remove domain alias |
| GET | | Get main domain info |
| POST | | Set main domain |
| PUT | | Replace main domain |
| PATCH | | Update domain validation/SSL |
| GET | | Check domain status |
| GET | | Force validation recheck |
| GET | | Get edge settings |
| PATCH | | Update edge settings |
| Method | Endpoint | Description |
|---|---|---|
| POST | | Purge specific files |
| POST | | Purge all cache |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List installed plugins |
| POST | | Install plugins |
| PATCH | | Activate/deactivate plugins |
| PUT | | Update plugins |
| DELETE | | Delete plugins |
| GET | | Search available plugins |
| GET | | List featured plugins |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List installed themes |
| POST | | Install themes |
| PATCH | | Activate theme |
| PUT | | Update themes |
| DELETE | | Delete themes |
| GET | | Search available themes |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List backups |
| POST | | Create backup |
| GET | | Download backup |
| DELETE | | Delete backup |
| POST | | Restore backup |
| GET | | List automated backups |
| POST | | Restore automated backup |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List cloud backups |
| POST | | Create cloud backup |
| GET | | Get cloud backup |
| DELETE | | Delete cloud backup |
| GET | | Get download link |
| POST | | Restore cloud backup |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List files |
| POST | | Upload file |
| PUT | | Save file contents |
| DELETE | | Delete file |
| GET | | View file contents |
| GET | | Download file |
| POST | | Create folder |
| POST | | Extract archive |
| POST | | Compress files |
| PATCH | | Change permissions |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List FTP accounts |
| POST | | Create FTP account |
| PATCH | | Update FTP account |
| DELETE | | Delete FTP account |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List SSH keys |
| POST | | Import SSH key |
| DELETE | | Delete SSH key |
| POST | | Activate SSH key |
| POST | | Deactivate SSH key |
| GET | | View SSH key info |
| Method | Endpoint | Description |
|---|---|---|
| GET | | Get WordPress SSO link |
| GET | | Get WordPress status |
| POST | | Execute WP-CLI command |
| Method | Endpoint | Description |
|---|---|---|
| GET | | CDN requests report |
| GET | | Cache status report |
| GET | | Cache content report |
| GET | | Visitors report |
| GET | | WAF events list |
| GET | | WAF events by source |
| GET | | Firewall events |
| GET | | Bandwidth usage |
| GET | | Top bandwidth usage |
| GET | | Access logs |
| Method | Endpoint | Description |
|---|---|---|
| GET | | Get user information |
| PATCH | | Update account settings |
| GET | | Get account usage stats |
| POST | | Change password |
| GET | | List account tasks |
| GET | | Get current plan |
| PUT | | Change hosting plan |
| POST | | Get billing SSO cookie |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List account users |
| POST | | Create account user |
| GET | | Get user details |
| PATCH | | Update user |
| DELETE | | Remove user |
| POST | | Resend invite |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List site users |
| POST | | Invite site user |
| DELETE | | Remove site user |
| POST | | Resend invite |
| Method | Endpoint | Description |
|---|---|---|
| GET | | List billing addresses |
| POST | | Create billing address |
| GET | | Get billing address |
| PATCH | | Update billing address |
| DELETE | | Delete billing address |
| GET | | List invoices |
| GET | | Get invoice |
| GET | | Download invoice PDF |
| POST | | Pay with card |
| GET | | List payment methods |
| POST | | Add payment method |
| DELETE | | Delete payment method |
| GET | | List available products |
| Method | Endpoint | Description |
|---|---|---|
| GET | | Get password protection status |
| POST | | Enable password protection |
| DELETE | | Disable password protection |
| GET | | List ShopShield URIs |
| POST | | Enable ShopShield |
| DELETE | | Disable ShopShield |
| GET | | Account visitor stats |
| GET | | Account bandwidth stats |
const sites = await rocketApiRequest('/sites');
console.log(sites);
// Returns array of site objects with id, domain, status, etc.const newSite = await rocketApiRequest('/sites', {
method: 'POST',
body: JSON.stringify({
name: 'my-new-site',
location: 'us-east-1',
// Additional options as needed
})
});// Purge specific URLs
await rocketApiRequest(`/sites/${siteId}/cache/purge`, {
method: 'POST',
body: JSON.stringify({
files: [
'https://example.com/style.css',
'https://example.com/script.js'
]
})
});
// Purge everything
await rocketApiRequest(`/sites/${siteId}/cache/purge_everything`, {
method: 'POST'
});// Create backup
const backup = await rocketApiRequest(`/sites/${siteId}/backup`, {
method: 'POST'
});
// List backups
const backups = await rocketApiRequest(`/sites/${siteId}/backup`);
// Restore backup (background task)
await rocketApiRequest(`/sites/${siteId}/backup/${backupId}/restore`, {
method: 'POST'
});// List installed plugins
const plugins = await rocketApiRequest(`/sites/${siteId}/plugins`);
// Install plugin
await rocketApiRequest(`/sites/${siteId}/plugins`, {
method: 'POST',
body: JSON.stringify({
plugins: ['wordfence', 'yoast-seo']
})
});
// Update all plugins
await rocketApiRequest(`/sites/${siteId}/plugins`, {
method: 'PUT',
body: JSON.stringify({
plugins: ['all']
})
});
// Activate/deactivate plugin
await rocketApiRequest(`/sites/${siteId}/plugins`, {
method: 'PATCH',
body: JSON.stringify({
plugins: ['wordfence'],
action: 'activate' // or 'deactivate'
})
});const result = await rocketApiRequest(`/sites/${siteId}/wpcli`, {
method: 'POST',
body: JSON.stringify({
command: 'user list --format=json'
})
});// Get SSO link for WordPress admin
const { url } = await rocketApiRequest(`/sites/${siteId}/wp_login`);
// Redirect user to url for auto-logininterface RocketSite {
id: number;
name: string;
domain: string;
status: 'active' | 'suspended' | 'pending';
location: string;
created_at: string;
updated_at: string;
}
interface RocketBackup {
id: number;
site_id: number;
type: 'manual' | 'automated' | 'cloud';
status: 'pending' | 'completed' | 'failed';
size: number;
created_at: string;
}
interface RocketPlugin {
name: string;
slug: string;
version: string;
status: 'active' | 'inactive';
update_available: boolean;
}
interface RocketDomain {
id: number;
domain: string;
is_main: boolean;
ssl_status: 'pending' | 'active' | 'failed';
validation_method: 'dns' | 'http';
}
interface RocketAuthResponse {
token: string;
expires_at: string;
}interface RocketApiError {
error: string;
message: string;
status: number;
}
async function handleRocketRequest(endpoint: string, options?: RequestInit) {
try {
const response = await rocketApiRequest(endpoint, options);
return { data: response, error: null };
} catch (error) {
if (error.status === 401) {
// Re-authenticate and retry
await refreshToken();
return handleRocketRequest(endpoint, options);
}
if (error.status === 404) {
return { data: null, error: 'Resource not found' };
}
if (error.status === 429) {
// Rate limited - wait and retry
await sleep(1000);
return handleRocketRequest(endpoint, options);
}
return { data: null, error: error.message };
}
}// Start a background task
const { task_id } = await rocketApiRequest(`/sites/${siteId}/clone`, {
method: 'POST',
body: JSON.stringify({ name: 'cloned-site' })
});
// Check task status
const tasks = await rocketApiRequest(`/sites/${siteId}/tasks`);
const task = tasks.find(t => t.id === task_id);
console.log(task.status); // 'pending', 'running', 'completed', 'failed'
// Cancel task if needed
await rocketApiRequest(`/sites/${siteId}/tasks/${task_id}/cancel`, {
method: 'POST'
});async function withRetry<T>(
fn: () => Promise<T>,
maxRetries = 3,
delay = 1000
): Promise<T> {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (error.status === 429 && i < maxRetries - 1) {
await new Promise(resolve => setTimeout(resolve, delay * Math.pow(2, i)));
continue;
}
throw error;
}
}
throw new Error('Max retries exceeded');
}