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.
/api/v1.0/resellersimport 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)
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
This endpoint returns your reseller subscriptions. The response contains the subscription IDs required for update, renew, suspend, resume, and cancel requests.
/api/v1.0/resellers/subscriptions?page=0&size=20&sortBy=id&direction=DESC"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)
{
"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
This endpoint creates a new reseller subscription by selecting a billing cycle, connection amount, and authentication count.
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. /dev/v1.0/resellers/subscriptionsbillingCycle, 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)
Create Subscription Response: 200
{
"data": {
"id": "su_69b139e97d16bed7023855d3",
"status": "ACTIVE",
"type": "STANDARD",
"canceled": false,
"plan": {
"billingCycle": "MONTHLY",
"configuration": {
"connections": 200,
"authentications": 3
}
}
}
}
Update Subscription
This endpoint updates an existing reseller subscription by subscription ID using a new billing cycle, connection amount, and authentication count.
/dev/v1.0/resellers/subscriptions/{subscriptionId}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)
Update Subscription Response: 200
{
"data": {
"id": "su_69b139e97d16bed7023855d3",
"status": "ACTIVE",
"type": "STANDARD",
"canceled": false,
"plan": {
"billingCycle": "ANNUAL",
"configuration": {
"connections": 500,
"authentications": 4
}
}
}
}
Renew Subscription
This endpoint renews an existing reseller subscription by subscription ID.
/api/v1.0/resellers/subscriptions/{subscriptionId}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)
{
"success": true,
"message": "Subscription renewed successfully."
}
Suspend Subscription
This endpoint suspends an active reseller subscription by subscription ID.
/api/v1.0/resellers/subscriptions/{subscriptionId}/suspendsubscriptionId 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)
Suspend Reseller Subscription Response: 200
{}
Resume Subscription
This endpoint resumes a suspended reseller subscription by subscription ID.
/api/v1.0/resellers/subscriptions/{subscriptionId}/resumesubscriptionId 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)
Resume Reseller Subscription Response: 200
{}
Cancel Subscription
This endpoint cancels a reseller subscription by subscription ID.
/api/v1.0/resellers/subscriptions/{subscriptionId}/cancelsubscriptionId 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)
Cancel Reseller Subscription Response: 200
{}
