Reseller Subscriptions

Subscriptions

This section covers reseller subscription management. You can first retrieve your reseller account information, including your balance, then list subscriptions and manage them by subscription ID.

Important: You must use the API key from your reseller dashboard. The normal API key from the standard account settings does not apply to reseller endpoints.
GET/api/v1.0/resellers
Limit: 10 requests / 60s
Required:API-Key
Note: Use this endpoint to retrieve your reseller account data, including your current balance, before creating or renewing subscriptions.
import requests, json

def get_reseller_info(api_key):
  url = "https://api.ghostealth.com/dev/v1.0/resellers"
  headers = {
    "Content-Type": "application/json",
    "Authorization": f"ApiKey {api_key}"
  }

  res = requests.get(url, headers=headers)
  print("Reseller Info Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
get_reseller_info(api_key)
Example Response:
Toggle Response
Reseller Response: 200
        {
        "data": {
        "id": "rs_69b139e97d16bed7023855d3",
        "balance": {
        "id": "rb_69b139e97d16bed7023855cf",
        "amount": {
        "currency": "USD",
        "value": 0,
        "fee": 0
        }
        },
        "statistic": {
        "id": "rs_69b139e97d16bed7023855d0",
        "totalSubscriptions": 0,
        "activeSubscriptions": 0,
        "stoppedSubscriptions": 0,
        "terminatedSubscriptions": 0,
        "suspendedSubscriptions": 0
        },
        "app": {
        "id": "ap_69b139e97d16bed7023855d2",
        "title": "Reseller-App",
        "description": "Reseller-App for: us_69b139e17d16bed7023855c9",
        "apiKey": "GHO-LSfSJw4r9m-STEA-UbWR69hGWJ-LTH"
        }
        }
        }
      
Get Subscriptions

Get Subscriptions

This endpoint returns your reseller subscriptions. The response contains the subscription IDs required for update, renew, suspend, resume, and cancel requests.

GET/api/v1.0/resellers/subscriptions?page=0&size=20&sortBy=id&direction=DESC
Limit: 10 requests / 60s
Required:API-Key
Important: Copy the subscription "id": "su_69af..." from this response. It is required for update, renew, suspend, resume, and cancel requests.
import requests, json

def get_subscriptions(api_key):
  url = "https://api.ghostealth.com/dev/v1.0/resellers/subscriptions?page=0&size=20&sortBy=id&direction=DESC"
  headers = {
    "Content-Type": "application/json",
    "Authorization": f"ApiKey {api_key}"
  }

  res = requests.get(url, headers=headers)
  print("Get Subscriptions Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
get_subscriptions(api_key)
Example Response:
Toggle Response
{
                  "data": {
                  "id": "su_69afba98bc32119ad6daa8f0",
                  "status": "ACTIVE",
                  "type": "STANDARD",
                  "canceled": false,
                  "period": {
                  "start": {
                  "timestamp": 1773124248080,
                  "date": 1773124248080
                  },
                  "end": {
                  "timestamp": 1773729048080,
                  "date": 1773729048080
                  }
                  },
                  "consumption": {
                  "bytes": 0,
                  "requests": 0
                  },
                  "plan": {
                  "id": "pl_69afba85bc32119ad6daa8e8",
                  "title": "GS-DAT 100",
                  "description": "Weekly billing",
                  "billingCycle": "WEEKLY",
                  "price": {
                  "currency": "USD",
                  "netAmount": 1681,
                  "grossAmount": 2000,
                  "taxAmount": 319,
                  "feeAmount": 0,
                  "taxRate": 19.0
                  },
                  "configuration": {
                  "type": "DATACENTER",
                  "connections": 100,
                  "authentications": 1
                  }
                  },
                  "slots": [
                  {
                  "id": "sl_69afba98bc32119ad6daa8f2",
                  "status": "ENABLED",
                  "state": "UNBOUND",
                  "synchronization": "SYNCED",
                  "type": "IP"
                  }
                  ]
                  }
                }
Create Subscription

Create Subscription

This endpoint creates a new reseller subscription by selecting a billing cycle, connection amount, and authentication count.

Important: Use the reseller API key from your reseller dashboard. Supported billingCycle values are WEEKLY, MONTHLY, and ANNUAL. Supported connections values are 100, 200, 500, 1000, and 2000. Supported authentications values are 1 to 10. The first authentication is free.
POST/dev/v1.0/resellers/subscriptions
Limit: 10 requests / 60s
Required:API-KeybillingCycleconnectionsauthentications
Note: You must send all three fields in the request body: billingCycle, connections, and authentications.
import requests, json

def create_subscription(api_key, billing_cycle, connections, authentications):
  url = "http://91.99.96.73:8080/dev/v1.0/resellers/subscriptions"
  headers = {
    "Content-Type": "application/json",
    "Authorization": f"ApiKey {api_key}"
  }
  payload = {
    "billingCycle": billing_cycle,
    "connections": connections,
    "authentications": authentications
  }

  res = requests.post(url, headers=headers, json=payload)
  print("Create Subscription Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
billing_cycle = "MONTHLY"
connections = 200
authentications = 3

create_subscription(api_key, billing_cycle, connections, authentications)
Example Response:
Toggle Response
Create Subscription Response: 200
{
  "data": {
    "id": "su_69b139e97d16bed7023855d3",
    "status": "ACTIVE",
    "type": "STANDARD",
    "canceled": false,
    "plan": {
      "billingCycle": "MONTHLY",
      "configuration": {
        "connections": 200,
        "authentications": 3
      }
    }
  }
}
Update Subscription

Update Subscription

This endpoint updates an existing reseller subscription by subscription ID using a new billing cycle, connection amount, and authentication count.

POST/dev/v1.0/resellers/subscriptions/{subscriptionId}
Limit: 10 requests / 60s
Required:API-KeysubscriptionIdbillingCycleconnectionsauthentications
Note: Supported billingCycle values are WEEKLY, MONTHLY, and ANNUAL. Supported connections values are 100, 200, 500, 1000, and 2000. Supported authentications values are 1 to 10. The first authentication is free. So "1" should be the default value within the request.
import requests, json

def update_subscription(api_key, subscription_id, billing_cycle, connections, authentications):
  url = f"http://91.99.96.73:8080/dev/v1.0/resellers/subscriptions/{subscription_id}"
  headers = {
    "Content-Type": "application/json",
    "Authorization": f"ApiKey {api_key}"
  }
  payload = {
    "billingCycle": billing_cycle,
    "connections": connections,
    "authentications": authentications
  }

  res = requests.post(url, headers=headers, json=payload)
  print("Update Subscription Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
subscription_id = "su_69b139e97d16bed7023855d3"
billing_cycle = "ANNUAL"
connections = 500
authentications = 4

update_subscription(api_key, subscription_id, billing_cycle, connections, authentications)
Example Response:
Toggle Response
Update Subscription Response: 200
{
  "data": {
    "id": "su_69b139e97d16bed7023855d3",
    "status": "ACTIVE",
    "type": "STANDARD",
    "canceled": false,
    "plan": {
      "billingCycle": "ANNUAL",
      "configuration": {
        "connections": 500,
        "authentications": 4
      }
    }
  }
}
Renew Subscription

Renew Subscription

This endpoint renews an existing reseller subscription by subscription ID.

PUT/api/v1.0/resellers/subscriptions/{subscriptionId}
Limit: 10 requests / 60s
Required:API-KeysubscriptionId
Important: Use a valid subscriptionId from the Get Subscriptions response.
import requests, json

def renew_subscription(api_key, subscription_id):
  url = f"https://api.ghostealth.com/dev/v1.0/resellers/subscriptions/{subscription_id}"
  headers = {"Content-Type": "application/json", "Authorization": f"ApiKey {api_key}"}
  res = requests.put(url, headers=headers)
  print("Renew Subscription Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
subscription_id = "su_69afbaa5bc32119ad6daa8fe"
renew_subscription(api_key, subscription_id)
Example Response:
Toggle Response
{
                        "success": true,
                        "message": "Subscription renewed successfully."
                        }
                      
Suspend Subscription

Suspend Subscription

This endpoint suspends an active reseller subscription by subscription ID.

PUT/api/v1.0/resellers/subscriptions/{subscriptionId}/suspend
Limit: 10 requests / 60s
Required:API-KeysubscriptionId
Important: Use a valid subscriptionId from the Get Subscriptions response.
import requests, json

def suspend_subscription(api_key, subscription_id):
  url = f"https://api.ghostealth.com/dev/v1.0/resellers/subscriptions/{subscription_id}/suspend"
  headers = {"Content-Type": "application/json", "Authorization": f"ApiKey {api_key}"}
  res = requests.put(url, headers=headers)
  print("Suspend Subscription Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
subscription_id = "su_69afbaa5bc32119ad6daa8fe"
suspend_subscription(api_key, subscription_id)
Example Response:
Toggle Response
Suspend Reseller Subscription Response: 200
                          {}
                        
Resume Subscription

Resume Subscription

This endpoint resumes a suspended reseller subscription by subscription ID.

PUT/api/v1.0/resellers/subscriptions/{subscriptionId}/resume
Limit: 10 requests / 60s
Required:API-KeysubscriptionId
Important: Use a valid subscriptionId from the Get Subscriptions response.
import requests, json

def resume_subscription(api_key, subscription_id):
  url = f"https://api.ghostealth.com/dev/v1.0/resellers/subscriptions/{subscription_id}/resume"
  headers = {"Content-Type": "application/json", "Authorization": f"ApiKey {api_key}"}
  res = requests.put(url, headers=headers)
  print("Resume Subscription Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
subscription_id = "su_69afbaa5bc32119ad6daa8fe"
resume_subscription(api_key, subscription_id)
Example Response:
Toggle Response
Resume Reseller Subscription Response: 200
                            {}
                          
Cancel Subscription

Cancel Subscription

This endpoint cancels a reseller subscription by subscription ID.

PUT/api/v1.0/resellers/subscriptions/{subscriptionId}/cancel
Limit: 10 requests / 60s
Required:API-KeysubscriptionId
Important: Use a valid subscriptionId from the Get Subscriptions response.
import requests, json

def cancel_subscription(api_key, subscription_id):
  url = f"https://api.ghostealth.com/dev/v1.0/resellers/subscriptions/{subscription_id}/cancel"
  headers = {"Content-Type": "application/json", "Authorization": f"ApiKey {api_key}"}
  res = requests.put(url, headers=headers)
  print("Cancel Subscription Response:", res.status_code)
  print(json.dumps(res.json(), indent=2))

api_key = "xxx"
subscription_id = "su_69afbaa5bc32119ad6daa8fe"
cancel_subscription(api_key, subscription_id)
Example Response:
Toggle Response
Cancel Reseller Subscription Response: 200
                              {}