Account Management API
Use this API to create and manage VPN accounts and aliases.
Important Notes​
Successful responses are marked as {"status":"success"}.
Error responses are marked as {"status":"error"} together with an error code and a detailed error message.
A strong password must contain at least 10 characters from three of the following categories:
2.1. Must have at least one digit
2.2. Must have at least one letter
2.3. Must have at least one uppercase letter
2.4. Must have at least one special character
Except AddClient, all requests must meet one of the following conditions:
3.1. Include the end-user's password in the request
3.2. Pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
3.3. Include your server-side secret key in the request (it must never be sent from the client-side!)
3.4. Send the request from a white-listed IP address
AddClient​
Create a new account for an end-user together with a new active product
caution
The AddClient endpoint is rate-limited for 1 client per 10 seconds unless it is sent from a whitelisted IP address or together with secret key (remember - never send a secret key from the client-side!).
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/AddClient
curl -X POST -d "apikey=YOUR_API_KEY&\country=US&\type=1&\email=email@example.com&\password=Str0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/AddClient
Request Parameters:
- apikey - Your API key
- country - The end-user country's code (2 letter ISO code)
- type - Product type ID to create - you can find the ID’s listed under the Plans page (1/6/12/24/36)
- email - The end-user’s email address
- password (optional) - A strong password. If this field is not specified, then the platform will auto-generate a password.
- first_name (optional) - The end-user's first name
- last_name (optional) - The end-user's last name
- company_name (optional) - The end-user's company name
- state (optional) - The end-user's state
- zip_code (optional) - The end-user's postal code
- auto_terminate (optional) - Place 1 to disable automatic plan renewal.
- test_user (optional) - Place 1 to create a non-billable testing user (only for QA and Development purposes).
Response:
- Success (Whitelisted IP address)
- Success
- Failure
{
"status": "success",
"username": "email@example.com",
"password": "Strong_Password!123",
"vpn_username": "openvpn_user",
"vpn_password": "openvpn_pass",
"short_token": "0x12908c192d1374006e4e38bec50597682",
"short_token_expire": "2022-01-26 03:45:34",
"short_token_expire_ts": 1643168734,
"long_token": "0x2342b73638cd4258667e61f955f6ce73f",
"long_token_expire": "2022-06-30 00:00:00",
"long_token_expire_ts": 1656547200
}
{
"status": "success",
"username": "email@example.com",
"password": "Strong_Password!123",
"vpn_username": "openvpn_user",
"vpn_password": "openvpn_pass"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
TokenRefresh​
Creates new tokens for the account
https://{vpn-brand}.vpngn.com/api/amapi/TokenRefresh
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/TokenRefresh
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/TokenRefresh
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- long_token - pass an Authorization header carrying the Bearer <Long-Token-Here>, with the end-user’s current long-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success",
"last_product_change_ts": 1643133080,
"short_token": "0x1f206afdacae2dc0174bf6ee08069bc18",
"short_token_expire": "2022-01-26 03:46:18",
"short_token_expire_ts": 1643168778,
"long_token": "0x29b6fc951f5afd10a40e3497646b60059",
"long_token_expire": "2022-11-05 00:00:00",
"long_token_expire_ts": 1667606400,
"last_product_change_ts": 1643303863
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
CloseClient​
Terminate the end-user's main account immediately, including all products and aliases.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/CloseClient
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/CloseClient
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
CancelRequest​
Terminate the end-user's main account at next cron run (midnight) or at the end of the billing period (at_due_date), including all products and aliases.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/CancelRequest
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\type=immediate&\reason=expired&\product_id=123" \ https://{vpn-brand}.vpngn.com/api/amapi/CancelRequest
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
- type - Apply cancellation in the next cron run (midnight) or at the end of the billing period (at_due_date)
- reason (optional) - The cancellation reason
- product_id (optional) - Specify a product in case that the User's Account has more than one Active product
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
GetProducts​
Get a list of all products associated with the main end-user's account.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/GetProducts
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/GetProducts
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success",
"result": "success",
"response": [
{
"product_id": "12345",
"product_type": "1 Month",
"product_status": "Active",
"username": "openvpn_user",
"password": "openvpn_pass",
"nextduedate":"2024-02-27"
}
]
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
NewProduct​
Create a new product and associate it with the end-user's account.
Do not use this endpoint on existing clients with an active product
A VPN client should only have a maximum of one active VPN product at any given time. Therefore, please use UpgradeProduct in case that the client already has an active product.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/NewProduct
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\"type=12" \ https://{vpn-brand}.vpngn.com/api/amapi/NewProduct
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
- type - Create this product type ID (listed under the Plans page - 1/6/12/24/36)
- force_upgrade - If active products already exist, use this argument to upgrade the most recent existing active product rather than returning an error.
- auto_terminate (optional) - Place 1 to disable automatic plan renewal.
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success (Whitelisted IP address)
- Success
- Failure
{
"status": "success",
"username": "user@example.com",
"vpn_username": "openvpn_new_prod",
"vpn_password": "openvpn_new_pass",
"short_token": "0x12908c192d1374006e5e38bec60592682",
"short_token_expire": "2022-01-26 03:45:34",
"short_token_expire_ts": 1643168734,
"long_token": "0x2342b73638cd4258667e71f955f7ce63f",
"long_token_expire": "2022-06-30 00:00:00",
"long_token_expire_ts": 1656547200
{
"status": "success",
"username": "user@example.com",
"vpn_username": "openvpn_new_prod",
"vpn_password": "openvpn_new_pass",
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
UpgradeProduct​
Upgrade or downgrade an existing product ID to a new product type.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/UpgradeProduct
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\product_id=123&\new_product_plan=24" \ https://{vpn-brand}.vpngn.com/api/amapi/UpgradeProduct
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
- product_id - Product ID to update (retrieved using the GetProducts endpoint)
- new_product_plan - Upgrade to this product type ID (listed under the Plans page - 1/6/12/24/36)
- auto_terminate (optional) - Place 1 to disable automatic plan renewal.
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success (Whitelisted IP address)
- Success
- Failure
{
"status": "success",
"short_token": "0x12908c192d1374006e4e38bec50597682",
"short_token_expire": "2022-01-26 03:45:34",
"short_token_expire_ts": 1643168734,
"long_token": "0x2342b73638cd4258667e61f955f6ce73f",
"long_token_expire": "2022-06-30 00:00:00",
"long_token_expire_ts": 1656547200
}
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
SetPassword​
Set a new password for the main account.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/SetPassword
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\setpassword=4n0th3rStr0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/SetPassword
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
- setpassword - New strong password to use
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error,
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
ResetPassword​
Send a password reset email to the email address associated with the account. Note: this endpoint must be used from white-listed IP address.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/ResetPassword
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com" \ https://{vpn-brand}.vpngn.com/api/amapi/ResetPassword
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
Unless the request is sent from a white-listed IP address, the request will need to meet the condition below:
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
ListAliases​
List all aliases associated with the end-user's main account.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/ListAliases
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/ListAliases
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success",
"response": [
{
"email": "alias@example.com",
"first_name": "First",
"last_name": "Last"
}
]
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
AddAlias​
Add an alias to the end-user's account.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/AddAlias
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\setemail=email_2@example.com&\setpassword=Str0ngP@ssw0rd23&\first_name=John&\last_name=Doe" \ https://{vpn-brand}.vpngn.com/api/amapi/AddAlias
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
- setemail - New alias email address
- setpassword (Optional) - New strong password for the alias. A random password will be created if value is not set.
- auto_passreset (Optional) - Send in a password reset request immediately after the add alias request is successful.
- first_name - (Optional) - New alias first name
- last_name - (Optional) - New alias last name
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
DelAlias​
Delete an alias from the end-user's main account.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/DelAlias
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\alias=email_2@example.com" \ https://{vpn-brand}.vpngn.com/api/amapi/DelAlias
Request Parameters:
- apikey - Your API key
- email - The end-user’s email address
- alias - The email address associated with the alias to delete
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
SetAliasPassword​
Change the password for an alias.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/SetAliasPassword
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com&\password=Str0ngP@ssw0rd23&\setpassword=4n0th3rStr0ngP@ssw0rd23" \ https://{vpn-brand}.vpngn.com/api/amapi/SetAliasPassword
Request Parameters:
- apikey - Your API key
- email - The ALIAS email address
- setpassword - New strong password for the alias
Unless the request is sent from a white-listed IP address, the request will need to meet one of the conditions below:
- password - include the end-user's password in the request
- short_token - pass an Authorization header carrying the Bearer <Short-Token-Here> with the end-user’s current short-token value
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}
ResetAliasPassword​
Send a password reset email to the email address associated with the alias. Note: this endpoint must be used from white-listed IP address.
- Endpoint
- cURL Sample
https://{vpn-brand}.vpngn.com/api/amapi/ResetAliasPassword
curl -X POST -d "apikey=YOUR_API_KEY&\email=email@example.com" \ https://{vpn-brand}.vpngn.com/api/amapi/ResetAliasPassword
Request Parameters:
- apikey - Your API key
- email - The alias's email address
Unless the request is sent from a white-listed IP address, the request will need to meet the condition below:
- secret_key - include your server-side secret key in the request (never send this key from the client-side!)
Response:
- Success
- Failure
{
"status": "success"
}
{
"status": "error",
"code": ERROR_CODE,
"message": DETAILED_ERROR_MESSAGE
}