SharePanel API Documentation

Table of Contents

Overview

The SharePanel API allows you to programmatically manage authentication, user profiles, organizations, instances, billing, analytics, notifications, and more. This API uses simple HTTP requests and returns JSON responses.

Base URL: https://api.sharepanel.host
📚 Complete Documentation: For the most up-to-date and comprehensive API documentation, see API Reference (Markdown)

Available API Modes

Note: All endpoints return user-specific data only. No admin or platform-wide data is accessible through the API.

Authentication

All API endpoints except the authentication endpoint require an API key. You can obtain an API key by authenticating with your SharePanel credentials.

Rate Limiting

Rate limits are enforced based on your plan:

Plan Daily Requests Rate Limit (per minute) Max Payload Size
Free 100 10 1 MB
Basic 1,000 30 5 MB
Pro 10,000 100 15 MB
Enterprise 50,000 500 50 MB

API Endpoints

Authentication

Generate a new API key by authenticating with your email and password.

GET/POST https://api.sharepanel.host/?mode=auth&email={email}&password={password}

Parameters

Parameter Type Required Description
mode String Yes Set to auth
email String Yes Your SharePanel account email
password String Yes Your SharePanel account password

Response

{
  "status": "success",
  "message": "Authentication successful",
  "data": {
    "api_key": "your_api_key_here"
  }
}

User Profile

Manage your user profile information.

View Profile

GET/POST https://api.sharepanel.host/?mode=profile&apikey={apikey}&action=view
Parameters
Parameter Type Required Description
mode String Yes Set to profile
api_key String Yes Your API key
action String Yes Set to view
Response
{
  "status": "success",
  "message": "Profile retrieved successfully",
  "timestamp": "2024-01-01T12:00:00+00:00",
  "data": {
    "id": 123,
    "username": "username",
    "email": "user@example.com",
    "bio": "User bio",
    "pfp": "profile_picture_url",
    "plan": "pro",
    "org_limit": 10,
    "instance_limit": 25,
    "verified": 1,
    "balance": 100.00,
    "first_name": "John",
    "last_name": "Doe",
    "phone": "1234567890",
    "address": "123 Main St"
  }
}

Update Profile

POST https://api.sharepanel.host/?mode=profile&apikey={apikey}&action=update
Parameters
Parameter Type Required Description
mode String Yes Set to profile
api_key String Yes Your API key
action String Yes Set to update
bio String No Update bio
pfp String No Update profile picture URL
first_name String No Update first name
last_name String No Update last name
phone String No Update phone number
address String No Update address
Response
{
  "status": "success",
  "message": "Profile updated successfully",
  "timestamp": "2024-01-01T12:00:00+00:00"
}

Get Profile Statistics

GET/POST https://api.sharepanel.host/?mode=profile&apikey={apikey}&action=stats
Response
{
  "status": "success",
  "message": "Statistics retrieved successfully",
  "timestamp": "2024-01-01T12:00:00+00:00",
  "data": {
    "org_count": 5,
    "instance_count": 12,
    "active_instances": 8,
    "invoice_count": 15,
    "total_spent": 250.00
  }
}

Organizations

Manage your organizations with the following endpoints.

List Organizations

List all organizations where you are a member.

GET/POST https://api.sharepanel.host/?mode=orgs&apikey={apikey}&action=list
Parameters
Parameter Type Required Description
mode String Yes Set to orgs
api_key String Yes Your API key
action String Yes Set to list
Response
{
  "status": "success",
  "message": "Organizations retrieved successfully",
  "data": [
    {
      "id": 1,
      "title": "Organization Name",
      "path": "organization-name",
      "admin_id": 123,
      "contact": "contact@example.com",
      "created_by": 123
    }
  ]
}

Create Organization

Create a new organization.

POST https://api.sharepanel.host/?mode=orgs&apikey={apikey}&action=new
Parameters
Parameter Type Required Description
mode String Yes Set to orgs
api_key String Yes Your API key
action String Yes Set to new
title String No Organization title (default: "New Organization")
path String No Organization path (default: lowercase hyphenated title)
contact String No Organization contact email
Response
{
  "status": "success",
  "message": "Organization created successfully",
  "data": {
    "org_id": 1
  }
}

View Organization Details

GET/POST https://api.sharepanel.host/?mode=orgs&apikey={apikey}&action=view&org_id={org_id}
Parameters
Parameter Type Required Description
org_id Integer Yes Organization ID
Response
{
  "status": "success",
  "message": "Organization retrieved successfully",
  "data": {
    "id": 1,
    "title": "Organization Name",
    "member_count": 5,
    "instance_count": 3
  }
}

Update Organization

POST https://api.sharepanel.host/?mode=orgs&apikey={apikey}&action=update&org_id={org_id}
Parameters
Parameter Type Required Description
org_id Integer Yes Organization ID
title String No Update title
path String No Update path
contact String No Update contact email

Delete Organization

POST https://api.sharepanel.host/?mode=orgs&apikey={apikey}&action=delete&org_id={org_id}
Parameters
Parameter Type Required Description
org_id Integer Yes ID of the organization to delete

List Organization Members

GET/POST https://api.sharepanel.host/?mode=orgs&apikey={apikey}&action=members&org_id={org_id}
Parameters
Parameter Type Required Description
org_id Integer Yes Organization ID

Instances

Manage your instances with the following endpoints.

List Instances

List all instances for your account.

GET/POST https://api.sharepanel.host/?mode=instances&apikey={apikey}&action=list
Parameters
Parameter Type Required Description
mode String Yes Set to instances
api_key String Yes Your API key
action String Yes Set to list
Response
{
  "status": "success",
  "message": "Instances retrieved successfully",
  "timestamp": "2024-01-01T12:00:00+00:00",
  "data": [
    {
      "id": 1,
      "instance_name": "Instance Name",
      "instance_path": "instance-path",
      "created_at": "2023-01-01 12:00:00",
      "status": "active",
      "instance_type": "default",
      "type": "SNCS"
    }
  ]
}

Delete Dead Instances

Delete all instances with a "dead" status.

POST https://api.sharepanel.host/?mode=instances&apikey={apikey}&action=delete_dead
Parameters
Parameter Type Required Description
mode String Yes Set to instances
api_key String Yes Your API key
action String Yes Set to delete_dead
Response
{
  "status": "success",
  "message": "3 dead instances deleted successfully"
}

Awaken All Instances

Set all sleeping instances to "active" status.

POST https://api.sharepanel.host/?mode=instances&apikey={apikey}&action=awaken_all
Parameters
Parameter Type Required Description
mode String Yes Set to instances
api_key String Yes Your API key
action String Yes Set to awaken_all
Response
{
  "status": "success",
  "message": "5 instances awakened successfully"
}

Sleep All Instances

Set all active instances to "sleep" status.

POST https://api.sharepanel.host/?mode=instances&apikey={apikey}&action=sleep_all
Response
{
  "status": "success",
  "message": "5 instances put to sleep successfully"
}

Update Instance Status

POST https://api.sharepanel.host/?mode=instances&apikey={apikey}&action=update_status&instance_id={instance_id}&status={status}
Parameters
Parameter Type Required Description
instance_id Integer Yes Instance ID
status String Yes New status: active, sleep, or dead

Billing

Manage billing, invoices, transactions, and purchases.

Get Account Balance

GET/POST https://api.sharepanel.host/?mode=billing&apikey={apikey}&action=balance
Response
{
  "status": "success",
  "data": {
    "balance": 100.50,
    "currency": "USD"
  }
}

List Invoices

GET/POST https://api.sharepanel.host/?mode=billing&apikey={apikey}&action=invoices
Parameters
Parameter Type Required Description
status String No Filter by status: pending, paid, overdue
limit Integer No Number of results (default: 50)
offset Integer No Pagination offset (default: 0)

Get Invoice Details

GET/POST https://api.sharepanel.host/?mode=billing&apikey={apikey}&action=invoice&invoice_id={invoice_id}

Get Transactions

GET/POST https://api.sharepanel.host/?mode=billing&apikey={apikey}&action=transactions

Get Purchases

GET/POST https://api.sharepanel.host/?mode=billing&apikey={apikey}&action=purchases

List Available Plans

GET/POST https://api.sharepanel.host/?mode=billing&apikey={apikey}&action=plans

Analytics

Get analytics and usage statistics for your account.

Get Analytics Overview

GET/POST https://api.sharepanel.host/?mode=analytics&apikey={apikey}&action=overview

Get API Usage Statistics

GET/POST https://api.sharepanel.host/?mode=analytics&apikey={apikey}&action=usage
Parameters
Parameter Type Required Description
period Integer No Number of days (default: 30)

Get Activity Logs

GET/POST https://api.sharepanel.host/?mode=analytics&apikey={apikey}&action=activity

Get Spending Analytics

GET/POST https://api.sharepanel.host/?mode=analytics&apikey={apikey}&action=spending

Notifications

Manage your notifications.

List Notifications

GET/POST https://api.sharepanel.host/?mode=notifications&apikey={apikey}&action=list
Parameters
Parameter Type Required Description
unread_only Boolean No Set to true for unread only

Get Unread Count

GET/POST https://api.sharepanel.host/?mode=notifications&apikey={apikey}&action=unread_count

Mark Notification as Read

POST https://api.sharepanel.host/?mode=notifications&apikey={apikey}&action=mark_read
Parameters
Parameter Type Required Description
notification_id Integer No Specific notification ID (omit to mark all as read)

API Keys

Manage your API keys.

List API Keys

GET/POST https://api.sharepanel.host/?mode=api_keys&apikey={apikey}&action=list

Create API Key

POST https://api.sharepanel.host/?mode=api_keys&apikey={apikey}&action=create
Parameters
Parameter Type Required Description
name String No Name for the API key
permissions String No Permissions (default: "read,write")
expires_at String No Expiration date (ISO 8601 format)

Delete API Key

POST https://api.sharepanel.host/?mode=api_keys&apikey={apikey}&action=delete&key_id={key_id}

Get API Key Usage

GET/POST https://api.sharepanel.host/?mode=api_keys&apikey={apikey}&action=usage&key_id={key_id}

Statistics

Get overview statistics for your account.

Get Overview Statistics

GET/POST https://api.sharepanel.host/?mode=stats&apikey={apikey}&type=overview

Get Instance Statistics

GET/POST https://api.sharepanel.host/?mode=stats&apikey={apikey}&type=instances

Get Organization Statistics

GET/POST https://api.sharepanel.host/?mode=stats&apikey={apikey}&type=organizations

Error Handling

All API errors will return a JSON response with a status of "error" and a message explaining the error.

{
  "status": "error",
  "message": "Error message here"
}

Common error messages include:

  • "Invalid or expired API key"
  • "Rate limit exceeded. Please try again later."
  • "Email and password are required"
  • "Invalid email or password"
  • "Organization ID is required"
  • "You do not have permission to delete this organization"
  • "Organization limit reached for your plan"
  • "Invalid mode. Available modes: auth, profile, orgs, instances, billing, analytics, notifications, api_keys, search, stats"
  • "Invalid action for [mode] mode"

Code Examples

PHP Example

// Authenticate
$email = "user@example.com";
$password = "password";
$authUrl = "https://api.sharepanel.host/?mode=auth&email=" . urlencode($email) . "&password=" . urlencode($password);
$response = file_get_contents($authUrl);
$data = json_decode($response, true);
$apiKey = $data['data']['api_key'];

// Get profile
$profileUrl = "https://api.sharepanel.host/?mode=profile&apikey=" . urlencode($apiKey) . "&action=view";
$response = file_get_contents($profileUrl);
$profile = json_decode($response, true);

Python Example

import requests

# Authenticate
email = "user@example.com"
password = "password"
auth_url = f"https://api.sharepanel.host/?mode=auth&email={email}&password={password}"
response = requests.get(auth_url)
data = response.json()
apikey = data['data']['api_key']

# Get profile
profile_url = f"https://api.sharepanel.host/?mode=profile&apikey={apikey}&action=view"
response = requests.get(profile_url)
profile = response.json()

JavaScript Example

// Authenticate
const email = "user@example.com";
const password = "password";
const authUrl = `https://api.sharepanel.host/?mode=auth&email=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`;

fetch(authUrl)
  .then(response => response.json())
  .then(data => {
    const apiKey = data.data.api_key;
    
    // Get profile
    const profileUrl = `https://api.sharepanel.host/?mode=profile&apikey=${encodeURIComponent(apiKey)}&action=view`;
    return fetch(profileUrl);
  })
  .then(response => response.json())
  .then(profile => {
    console.log(profile);
  });

Best Practices

Security

  • Store API Keys Securely: Never commit API keys to version control. Use environment variables or secure storage.
  • Use HTTPS: Always use HTTPS for API requests to protect sensitive data.
  • Rotate Keys Regularly: Periodically regenerate API keys for enhanced security.

Error Handling

  • Always Check Response Status: Verify the response status before processing data.
  • Handle Errors Gracefully: Implement proper error handling for all API calls.
  • Log Errors: Log API errors for debugging and monitoring.

Rate Limiting

  • Monitor Rate Limits: Check rate limit headers in responses.
  • Implement Exponential Backoff: Retry failed requests with exponential backoff when rate limited.
  • Cache Responses: Cache API responses when appropriate to reduce API calls.

Performance

  • Validate Input: Validate all parameters before sending API requests.
  • Use Appropriate HTTP Methods: Use GET for retrieval, POST for creation when available.
  • Minimize Requests: Batch operations when possible to reduce API calls.

Support

If you have any questions or need assistance with the SharePanel API, please contact our support team at support@sharepanel.host.

For comprehensive documentation including user guides, admin guides, and feature documentation, visit the Staff Documentation Portal.