Webline Africa - Premium Domain & Hosting Reseller Platform
RESTful Hosting API Documentation

Powerful Hosting Management API

Integrate our comprehensive hosting management capabilities into your systems with our robust API. Provision hosting accounts automatically with credit management.

Base URL:

https://reseller.co.tz/api/hosting-public.php

API Overview

Base URL: https://reseller.co.tz/api/hosting-public.php

Authentication

  • Send requests as HTTP POST with JSON body
  • Include your API key in header: X-API-KEY: your_api_key
  • Or in JSON body: { "api_key": "your_api_key" }

Credit Management

  • Automatic balance validation before account creation
  • Secure credit deduction with transaction rollback on failures
  • Full audit trail for all provisioning operations

Available Actions

1. Get Available Hosting Packages

Request:

{
  "action": "getPackages"
}

Response:

{
  "status": "success",
  "data": [
    {
      "id": 1,
      "name": "Basic Hosting",
      "description": "Perfect for small websites",
      "disk_space_mb": 5000,
      "bandwidth_mb": 50000,
      "max_accounts": 5,
      "price_monthly": 25000,
      "price_yearly": 250000,
      "directadmin_package": "basic"
    },
    {
      "id": 2,
      "name": "Professional Hosting",
      "description": "Ideal for growing businesses",
      "disk_space_mb": 20000,
      "bandwidth_mb": 200000,
      "max_accounts": 20,
      "price_monthly": 75000,
      "price_yearly": 750000,
      "directadmin_package": "professional"
    }
  ]
}

2. Create Hosting Account

Request:

{
  "action": "createAccount",
  "package_id": 1,
  "domain": "example.com",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john@example.com",
  "phone": "+255123456789"
}

Response:

{
  "status": "success",
  "message": "Hosting account created successfully",
  "data": {
    "account_id": 123,
    "username": "example_user",
    "password": "generated_password_123",
    "domain": "example.com",
    "control_panel_url": "https://server.example.com:2222/CMD_LOGIN",
    "package_name": "Basic Hosting",
    "price_charged": 25000
  }
}

Important Notes

  • Account will be automatically provisioned on DirectAdmin server
  • Credit will be deducted from your balance upon successful creation
  • Save the generated credentials securely - they won't be shown again

3. Get Account Details

Request:

{
  "action": "getAccount",
  "account_id": 123
}

Response:

{
  "status": "success",
  "data": {
    "id": 123,
    "domain": "example.com",
    "username": "example_user",
    "status": "active",
    "package_name": "Basic Hosting",
    "server_name": "Server-01",
    "client_name": "John Doe",
    "client_email": "john@example.com",
    "client_phone": "+255123456789",
    "control_panel_url": "https://server.example.com:2222/CMD_LOGIN",
    "created_at": "2024-03-20 12:00:00",
    "disk_space_mb": 5000,
    "bandwidth_mb": 50000
  }
}

4. List All Accounts

Request:

{
  "action": "listAccounts"
}

Response:

{
  "status": "success",
  "data": [
    {
      "id": 123,
      "domain": "example.com",
      "username": "example_user",
      "status": "active",
      "package_name": "Basic Hosting",
      "server_name": "Server-01",
      "created_at": "2024-03-20 12:00:00"
    },
    {
      "id": 124,
      "domain": "test.com",
      "username": "test_user",
      "status": "pending",
      "package_name": "Professional Hosting",
      "server_name": "Server-02",
      "created_at": "2024-03-21 10:30:00"
    }
  ]
}

5. Get Account Status

Request:

{
  "action": "getAccountStatus",
  "account_id": 123
}

Response:

{
  "status": "success",
  "data": {
    "account_id": 123,
    "status": "active",
    "created_at": "2024-03-20 12:00:00",
    "updated_at": "2024-03-20 12:05:00"
  }
}

Status Values

  • pending - Account creation in progress
  • active - Account is active and ready to use
  • suspended - Account is suspended
  • failed - Account creation failed

Error Response Format

{
  "status": "error",
  "message": "Specific error message"
}

Common Error Scenarios

  • Invalid API key - Authentication failed
  • Missing required field: package_id - Validation error
  • Invalid hosting package - Package not found or inactive
  • Insufficient credit balance - Not enough credits (shows required and available amounts)
  • Invalid domain name format - Domain validation failed
  • Account not found - Account doesn't exist or access denied

Code Examples

PHP Example

Implementation Notes

  • Always handle API errors and timeouts gracefully
  • Store API keys securely and never expose them in client-side code
  • Implement retry logic for failed requests
  • Check account status after creation to confirm provisioning
  • Store generated credentials securely - they won't be retrievable later

Rate Limits

  • Maximum 100 requests per 5 minutes per API key
  • Exceeding limits will result in HTTP 429 (Too Many Requests)
  • Authentication attempts are limited to 10 per 15 minutes per IP
  • All requests are logged for security and audit purposes

Security Features

  • API key authentication with secure validation
  • Input sanitization and validation to prevent injection
  • Database transactions with rollback on failures
  • Comprehensive audit logging for all operations
  • Secure credit management with balance verification