Introduction
Welcome to the documentation for GP reseller API. This guide provides detailed information on how to use and integrate with the GP Reseller API.
Getting Started
To get started using the GP API, you have to sign up for GP Reseller Program and get your API key.
The GP API allows you to perform operations and actions within GP Firewall from external third party and custom code. The API should be used when your system needs to remotely call GP Website Firewall.
Authenticating & Security
API requests will be authenticated based on the request parameter hash along with a restriction to the source request ip.Any API request must include authentication with 3 parameters:
- domain
- hash
- timestamp
The API Key is bound to one authorized ip. This should be your server ip from which you are to send requests to the api endpoint.
To know what is your server ip, there is only ONE unique trustful method. Any other method may fail to output the correct ip: You have to create a curl post request from page1.php hosted in your server to page2.php hosted in the same server and which will display $_SERVER['REMOTE_ADDR']
Once you have the true server ip, fill the dedicated ip address field within your Client Area reseller profile to get authorized to make API requests.
Your hash should be a unique result of double one way encryption through SHA1. The hash syntax is SHA1 (SHA1 API Key + domain name + timestamp).
Basic authentication example
$key = sha1(trim('YOUR_API_KEY')); $domain = 'example.com'; //package domain name $timestamp = str_shuffle(time()); $hash = sha1($key . $domain . $timestamp); $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
API Endpoints
The reseller API provides the following endpoints request objective:
- Authorized ip Test Connection (endpoint: connection)
- Reseller Credit Balance (endpoint: getcredit)
- Get Available Actions/Package Status (endpoint: list)
- Create Package (endpoint: autoregister)
- Suspend Package (endpoint: suspended)
- Unsuspend Package (endpoint: active)
- Delete Package (endpoint: delete)
- Upgrade Package (endpoint: packageupdate)
- Dashboard Password Change (endpoint: passwordreset)
- Renew Package (endpoint: renew)
- Admin Dashboard Auto Login
- Admin GP Account Auto Login
- Client Dashboard Auto Login
All listed parameters for each endpoint are required. The API accepts only POST requests to the API endpoint.
- scheme: https
- host: www.geniusplugin.com
- basePath: api/v1
- path: endpoint
All requests must be sent to <scheme>://<host>/<basePath>/<path>/ (with ending slash)
connection: Authorized ip Test Connection
- Endpoint URL: https://www.geniusplugin.com/api/v1/connection/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: OK or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'connection'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Request Missing data!"}
{"status":"Request Missing data! hash"}
getcredit : Reseller Credit Balance
- Endpoint URL: https://www.geniusplugin.com/api/v1/getcredit/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: string or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'getcredit'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"OK - 1500.26"}
- Example Error Responses
{"status":"Request Missing data!"}
{"status":"Connection failed"}
list: Get Available Actions/Package Status
- Endpoint URL: https://www.geniusplugin.com/api/v1/list/
- Parameters
Parameter Type Description domain string request package domain name hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: Package status: active, suspended exist string Package found: exists Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'list'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"active","exist":"exists"}
- Example Error Responses
{"status":"Package not Found!"}
{"status":"Error"}
autoregister: Create Package
- Endpoint URL: https://www.geniusplugin.com/api/v1/autoregister/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer package string Package name: Free, 10k, 20k, 40k, 100k, 200k..etc password string Encrypted password with gpfPassEncrypt() * uemail string User email notification destination.
/** * Function used to encrypt the user password * We encourage you to strengthen the password. We can refuse weaker * @param [string] $key = your apikey * @param [string] $string = user password * @return string */ function gpfPassEncrypt($key, $string) { if(empty($key) ||empty($string) ) return null; $ivlen = openssl_cipher_iv_length($cipher = "AES-128-CBC"); $iv = openssl_random_pseudo_bytes($ivlen); $ciphertext_raw = openssl_encrypt($string, $cipher, $key, $options = OPENSSL_RAW_DATA, $iv); $hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary = true); $ciphertext = base64_encode($iv . $hmac . $ciphertext_raw); return $ciphertext; }
Response Parameters
Parameter Type Description status string Result of the request: OK or an error message token string License token Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'autoregister'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp, 'password' => gpfPassEncrypt($API_KEY, $password), 'package' = '100k', 'uemail' => 'client.email@example.com', ];
Example Response JSON
{"status":"ok","token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
- Example Error Responses
{"status":"Invalid package name"}
{"status":"Missing Password"}
suspended: Suspend Package
- Endpoint URL: https://www.geniusplugin.com/api/v1/suspended/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: OK or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'suspended'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Request Missing data!"}
{"status":"Package not Found!"}
active: Unsuspend Package
- Endpoint URL: https://www.geniusplugin.com/api/v1/active/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: OK or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'active'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Request Missing data! domain"}
{"status":"Package not found!"}
delete: Delete Package
- Endpoint URL: https://www.geniusplugin.com/api/v1/delete/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: OK or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'delete'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Package not found!"}
{"status":"Error deleting example.com"}
packageupdate: Upgrade Package
- Endpoint URL: https://www.geniusplugin.com/api/v1/packageupdate/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer status string Package status: active, suspended, cancelled package string Package name: Free, 10k, 20k, 40k, 100k ..etc Response Parameters
Parameter Type Description status string Result of the request: OK or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'packageupdate'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp, 'status' => 'active', 'package' => '40k' ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Package is suspended. Please unsuspend it to continue."}
{"status":"Downgrade not allowed."}
passwordreset: Dashboard Password Change
- Endpoint URL: https://www.geniusplugin.com/api/v1/passwordreset/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer password string Encrypted password with gpfPassEncrypt() *
/** * Function used to encrypt the user password * We encourage you to strengthen the password. We can refuse weaker * @param [string] $key = your apikey * @param [string] $string = user password * @return string */ function gpfPassEncrypt($key, $string) { if(empty($key) ||empty($string) ) return null; $ivlen = openssl_cipher_iv_length($cipher = "AES-128-CBC"); $iv = openssl_random_pseudo_bytes($ivlen); $ciphertext_raw = openssl_encrypt($string, $cipher, $key, $options = OPENSSL_RAW_DATA, $iv); $hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary = true); $ciphertext = base64_encode($iv . $hmac . $ciphertext_raw); return $ciphertext; }
Response Parameters
Parameter Type Description status string Result of the request: OK or an error message
Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'connection'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp, 'password' => gpfPassEncrypt($API_KEY, $password) ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Invalid Password"}
{"status":"Error changing password. No active package found!"}
renew: Renew a package subscription
- Endpoint URL: https://www.geniusplugin.com/api/v1/renew/
- Parameters
Parameter Type Description domain string request package domain name | example.com for N/A hash string SHA1 (SHA1 API Key + domain name + timestamp) timestamp int shuffled timestamp integer Response Parameters
Parameter Type Description status string Result of the request: OK or an error message Example Request
$key = sha1(trim('API_KEY')); $timestamp = str_shuffle(time()); $domain = 'example.com'; $hash = sha1($key . $domain . $timestamp); $endpoint = 'renew'; $data = [ 'domain' => $domain, 'hash' => $hash, 'timestamp' => $timestamp ];
Example Response JSON
{"status":"ok"}
- Example Error Responses
{"status":"Request Missing data!"}
{"status":"Request Missing data! hash"}
Frequently Asked Questions (FAQ)
For common questions please visit the main reseller page.
Support and Contact
If you have any questions or need assistance with the reseller API, please contact our support team rising a ticket.
Conclusion
Congratulations! You now have the necessary information to start integrating with the reseller API. If you have any further questions or feedback, please don't hesitate to reach out to our support team.
We hope you find the reseller API powerful and easy to use. Happy coding!