NAV
bash javascript php

Info

Welcome to the VPNresellers API version 3.1. Visit the API access page to get the access token.

Accounts

Check an username

Before account creating this method can check that the username is able to be used and it does not exist in our database.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/accounts/check_username?username=deleniti" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/check_username");

    let params = {
            "username": "deleniti",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/accounts/check_username", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
    'query' => [
            "username" => "deleniti",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "message": "The username is not taken."
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "username": [
            "The username has already been taken."
        ]
    }
}

HTTP Request

GET v3_1/accounts/check_username

Query Parameters

Parameter Status Description
username required A checked username

List accounts

The response contains the following information:

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/accounts" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/accounts", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": [
        {
            "id": 9,
            "username": "plmkojnhbgv",
            "status": "Active",
            "wg_ip": "10.250.121.219",
            "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
            "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
            "updated": "2017-03-28 17:44:21",
            "created": "2017-03-24 19:26:24"
        },
        {
            "id": 10,
            "username": "wokreiru",
            "status": "Active",
            "wg_ip": "10.250.121.219",
            "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
            "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
            "updated": "2017-04-23 09:06:45",
            "created": "2017-03-27 17:22:45"
        }
    ],
    "links": {
        "first": "https://api.vpnresellers.com/v3_1/accounts?page=1",
        "last": "https://api.vpnresellers.com/v3_1/accounts?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://api.vpnresellers.com/v3_1/accounts",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

GET v3_1/accounts

Query Parameters

Parameter Status Description
page optional A number of page

Create an account

This method requires following parameters:

Example request:

curl -X POST "https://api.vpnresellers.com/v3_1/accounts" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{"username":"eius","password":"nemo"}'
const url = new URL("https://api.vpnresellers.com/v3_1/accounts");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

let body = {
    "username": "eius",
    "password": "nemo"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post("https://api.vpnresellers.com/v3_1/accounts", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
            "Content-Type" => "application/json",
        ],
    'json' => [
            "username" => "eius",
            "password" => "nemo",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):

{
    "data": {
        "id": 9,
        "username": "plmkojnhbgv",
        "status": "Active",
        "wg_ip": "10.250.121.219",
        "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
        "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
        "updated": "2017-03-28 17:44:21",
        "created": "2017-03-24 19:26:24"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (402):

{
    "message": "Insufficient Balance."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "username": [
            "The username has already been taken."
        ]
    }
}

HTTP Request

POST v3_1/accounts

Body Parameters

Parameter Type Status Description
username string required Username
password string required Password

Retrieve an account

The response contains the following information:

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/accounts/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/accounts/1", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "id": 9,
        "username": "plmkojnhbgv",
        "status": "Active",
        "wg_ip": "10.250.121.219",
        "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
        "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
        "updated": "2017-03-28 17:44:21",
        "created": "2017-03-24 19:26:24"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (403):

{
    "message": "Forbidden."
}

Example response (404):

{
    "message": "Not Found."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

GET v3_1/accounts/{account}

Delete an account

This method will delete an account from our database.

Example request:

curl -X DELETE "https://api.vpnresellers.com/v3_1/accounts/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->delete("https://api.vpnresellers.com/v3_1/accounts/1", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": null
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (403):

{
    "message": "Forbidden."
}

Example response (404):

{
    "message": "Not Found."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

DELETE v3_1/accounts/{account}

Enable an account

This method enables the account which was disabled using Disable an account method.

Example request:

curl -X PUT "https://api.vpnresellers.com/v3_1/accounts/1/enable" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1/enable");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "PUT",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->put("https://api.vpnresellers.com/v3_1/accounts/1/enable", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "id": 9,
        "username": "plmkojnhbgv",
        "status": "Active",
        "wg_ip": "10.250.121.219",
        "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
        "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
        "updated": "2017-03-28 17:44:21",
        "created": "2017-03-24 19:26:24"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (403):

{
    "message": "Forbidden."
}

Example response (404):

{
    "message": "Not Found."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

PUT v3_1/accounts/{account}/enable

Disable an account

This method can be used for disabling VPN service for this account without deleting it from our database.

Example request:

curl -X PUT "https://api.vpnresellers.com/v3_1/accounts/1/disable" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1/disable");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "PUT",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->put("https://api.vpnresellers.com/v3_1/accounts/1/disable", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "id": 9,
        "username": "plmkojnhbgv",
        "status": "Disabled",
        "wg_ip": "10.250.121.219",
        "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
        "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
        "updated": "2017-03-28 17:44:21",
        "created": "2017-03-24 19:26:24"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (403):

{
    "message": "Forbidden."
}

Example response (404):

{
    "message": "Not Found."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

PUT v3_1/accounts/{account}/disable

Change password

This method requires following parameter:

Example request:

curl -X PUT "https://api.vpnresellers.com/v3_1/accounts/1/change_password" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{"password":"reprehenderit"}'
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1/change_password");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

let body = {
    "password": "reprehenderit"
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->put("https://api.vpnresellers.com/v3_1/accounts/1/change_password", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
            "Content-Type" => "application/json",
        ],
    'json' => [
            "password" => "reprehenderit",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "id": 9,
        "username": "plmkojnhbgv",
        "status": "Active",
        "wg_ip": "10.250.121.219",
        "wg_private_key": "XE1pI01BnHB1EmidlHdm55r2qHKBSWCCJtXeS9gC+WU=",
        "wg_public_key": "w4oWBcymg+W+24NTb7FolqW9sumDnO0vhXXP19iQomM=",
        "updated": "2017-03-28 17:44:21",
        "created": "2017-03-24 19:26:24"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (403):

{
    "message": "Forbidden."
}

Example response (404):

{
    "message": "Not Found."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "password": [
            "The password must be at least 6 characters."
        ]
    }
}

HTTP Request

PUT v3_1/accounts/{account}/change_password

Body Parameters

Parameter Type Status Description
password string required Password

Configuration

List ports

This method is used for retrieving list of all ports which are using in Get configuration and Download a configuration methods.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/ports" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/ports");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/ports", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": [
        {
            "id": 1,
            "protocol": "udp",
            "number": 1194,
            "default": 1
        },
        {
            "id": 2,
            "protocol": "udp",
            "number": 118,
            "default": 0
        },
        {
            "id": 3,
            "protocol": "udp",
            "number": 123,
            "default": 0
        }
    ]
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

GET v3_1/ports

Get an openvpn configuration

Retrieving of the openvpn configuration to access the VPN server. The server_id and the port_id parameters can be got in the List servers and the List ports methods.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/configuration?server_id=1&port_id=1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/configuration");

    let params = {
            "server_id": "quis",
            "port_id": "corrupti",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/configuration", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
    'query' => [
            "server_id" => "quis",
            "port_id" => "corrupti",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "download_url": "http:\/\/api.vpnressellers.local\/v3\/configuration\/download?server_id=3&port_id=3",
        "file_body": "client\ndev tun\nremote bkk-s02.321inter.net\nport 123\nproto udp\npersist-key\npersist-tun\ncomp-lzo\nauth-user-pass\nnobind\nca ca.crt\nauth SHA256\ncipher AES-256-CBC\nkeysize 256\nfloat\ntun-mtu 48000\nfragment 0\nmssfix 0\n\n<ca>\n    -----BEGIN CERTIFICATE-----\n    MIIE3zCCA8egAwIBAgIJAKJYeXSXJzkNMA0GCSqGSIb3DQEBCwUAMIGlMQswCQYD\n    VQQGEwJVUzELMAkGA1UECBMCVVMxEDAOBgNVBAcTB1ZQTkFzaXYxEDAOBgNVBAoT\n    B1ZQTkFzaWExHTAbBgNVBAsTFE15T3JnYW5pemF0aW9uYWxVbml0MREwDwYDVQQD\n    EwhjaGFuZ2VtZTEQMA4GA1UEKRMHRWFzeVJTQTEhMB8GCSqGSIb3DQEJARYSbWVA\n    bXlob3N0Lm15ZG9tYWluMB4XDTE2MDIxNTIwMzIzNVoXDTI2MDIxMjIwMzIzNVow\n    gaUxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJVUzEQMA4GA1UEBxMHVlBOQXNpdjEQ\n    MA4GA1UEChMHVlBOQXNpYTEdMBsGA1UECxMUTXlPcmdhbml6YXRpb25hbFVuaXQx\n    ETAPBgNVBAMTCGNoYW5nZW1lMRAwDgYDVQQpEwdFYXN5UlNBMSEwHwYJKoZIhvcN\n    AQkBFhJtZUBteWhvc3QubXlkb21haW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\n    ggEKAoIBAQC3Qjh2JiLulXZkyjB9xb136o\/hy3UbHA0lnIovO1RI320TeOIbgfNr\n    3ZWcnNc1Fh4+SZbD4nZwe5Zk8PHdrm6dFM16CYU+vxaAnao8dbLRKnJq076zLzHr\n    Wb12BI+yBr605cFqIFVYNtnPvzKYVd2vPGkA7BrZ7qUPMMPqaopQFUOfNh0QRTqp\n    gcrAgexvkn3ia3IbEfd3OeFzU333buSu7\/+O55yS1\/lybfJyXQsxIDIPKe\/ZcIoL\n    M9oK2x1uIHDcNa2uCsbphXVuuhtNgKDDU3AIga4MO\/5KpApFJfRLkCv7J+sAzVj1\n    UwCcuqqNoY3CgKKsHwWlWgpN++KVGvLbAgMBAAGjggEOMIIBCjAdBgNVHQ4EFgQU\n    QN6oOLM0U3kbaL\/y8Z2ZTZOJ7W4wgdoGA1UdIwSB0jCBz4AUQN6oOLM0U3kbaL\/y\n    8Z2ZTZOJ7W6hgaukgagwgaUxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJVUzEQMA4G\n    A1UEBxMHVlBOQXNpdjEQMA4GA1UEChMHVlBOQXNpYTEdMBsGA1UECxMUTXlPcmdh\n    bml6YXRpb25hbFVuaXQxETAPBgNVBAMTCGNoYW5nZW1lMRAwDgYDVQQpEwdFYXN5\n    UlNBMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW6CCQCiWHl0lyc5\n    DTAMBgNVHRMEBTADAQH\/MA0GCSqGSIb3DQEBCwUAA4IBAQCFE5WZ5M0yid0ow\/7Z\n    \/X4UIGvgvLwMK8JXkomcleRpVCXz2s55C6Huo0\/v\/UyOjP\/VU+MhKQrAgNmDPHwL\n    2Q+b6m3hxLiQ96C3j7nhqnRNsuU3Dm8KEOXC45QPFJZx5tCeqTCBPb874RdY\/vWg\n    ZafdHFiCYxjiMnLk00I2DInVG5GDnwjQt6hqAN\/t+i\/q+Gl9fZXOP5CLIp7pxAmQ\n    5IAQSz4jnNHBtggS3h0055coNSMfGPS3z4jX8MMdEkXCGuLQW01mTZ+KuluWCo\/4\n    PUuYbrMZW\/gQ\/T4hVgxYgraL0scjXidJhEJSgj4k3niJHcF\/j0mjZAYInv+d5UCv\n    FjHt\n    -----END CERTIFICATE-----\n\n<\/ca>",
        "file_name": "TH-123.ovpn"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "server_id": [
            "The server id field is required."
        ],
        "port_id": [
            "The selected port id is invalid."
        ]
    }
}

HTTP Request

GET v3_1/configuration

Query Parameters

Parameter Status Description
server_id required Server ID
port_id optional Port ID

Download an openvpn configuration

Downloading of the openvpn configuration file to access the VPN server. The server_id and the port_id parameters can be got in the List servers and the List ports methods.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/configuration/download?server_id=1&port_id=1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: text/html; charset=UTF-8"
const url = new URL("https://api.vpnresellers.com/v3_1/configuration/download");

    let params = {
            "server_id": "voluptas",
            "port_id": "sint",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "text/html; charset=UTF-8",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/configuration/download", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "text/html; charset=UTF-8",
        ],
    'query' => [
            "server_id" => "voluptas",
            "port_id" => "sint",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

File output

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "server_id": [
            "The server id field is required."
        ],
        "port_id": [
            "The selected port id is invalid."
        ]
    }
}

HTTP Request

GET v3_1/configuration/download

Query Parameters

Parameter Status Description
server_id required Server ID
port_id optional Port ID

Get a wireguard configuration

Retrieving of the wireguard configuration to access the VPN server. The server_id parameter can be got in the List servers method.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/accounts/{account_id}/wireguard-configuration?server_id=1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1/wireguard-configuration");

    let params = {
            "server_id": "3",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/accounts/1/wireguard-configuration", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
    'query' => [
            "server_id" => "3",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "download_url": "http:\/\/api.vpnressellers.local\/v3_1\/accounts\/1\/wireguard-configuration\/download?server_id=3",
        "file_body": "[Interface]\nPrivateKey = zUv7atadVRGOx58h\nAddress = 240.170.225.79\nDNS = 172.16.0.1\n\n[Peer]\nPublicKey = WxwZf+b2RTA0ixXq\/j6z9oVdnS75HxXDVadM1nC36BY=\nAllowedIPs = 0.0.0.0\/0,::\/0\nEndpoint = eu-de-fra.321inter.net:55888\n",
        "file_name": "wg0.conf"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "server_id": [
            "The server id field is required."
        ]
    }
}

HTTP Request

GET v3_1/accounts/{account_id}/wireguard-configuration

Query Parameters

Parameter Status Description
server_id required Server ID

Download a wireguard configuration

Downloading of the wireguard configuration file to access the VPN server. The server_id parameter can be got in the List servers method.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/accounts/1/wireguard-configuration/download?server_id=1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: text/html; charset=UTF-8"
const url = new URL("https://api.vpnresellers.com/v3_1/accounts/1/wireguard-configuration/download");

    let params = {
            "server_id": "3",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "text/html; charset=UTF-8",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/accounts/1/wireguard-configuration/download", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "text/html; charset=UTF-8",
        ],
    'query' => [
            "server_id" => "3",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

File output

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "server_id": [
            "The server id field is required."
        ]
    }
}

HTTP Request

GET v3_1/accounts/1/wireguard-configuration/download

Query Parameters

Parameter Status Description
server_id required Server ID

Geo Location

Get geo info

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/geoip" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/geoip");

let headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/geoip", [
    'headers' => [
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "ip": "127.0.0.0",
        "country": "United States",
        "iso_code": "US",
        "city": "New Haven",
        "lat": 41.31,
        "lon": -72.92,
        "continent": "NA"
    }
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

GET v3_1/geoip

Servers

List servers

This method is used for retrieving list of all servers which are used in Get configuration and Download a configuration methods.

Example request:

curl -X GET -G "https://api.vpnresellers.com/v3_1/servers" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json"
const url = new URL("https://api.vpnresellers.com/v3_1/servers");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.vpnresellers.com/v3_1/servers", [
    'headers' => [
            "Authorization" => "Bearer {token}",
            "Accept" => "application/json",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": [
        {
            "id": 1,
            "name": "ams-s02.321inter.net",
            "ip": "46.249.36.188",
            "country_code": "NL",
            "city": "Amsterdam",
            "capacity": 0
        },
        {
            "id": 2,
            "name": "rtm-s01.321inter.net",
            "ip": "213.163.64.39",
            "country_code": "NL",
            "city": "Rotterdam",
            "capacity": 0
        },
        {
            "id": 3,
            "name": "bkk-s02.321inter.net",
            "ip": "45.64.186.109",
            "country_code": "TH",
            "city": "Bangkok",
            "capacity": 0
        },
        {
            "id": 4,
            "name": "yvr-s01.321inter.net",
            "ip": "71.19.251.107",
            "country_code": "CA",
            "city": "Vancouver",
            "capacity": 0
        }
    ]
}

Example response (400):

{
    "message": "Bad Request."
}

Example response (401):

{
    "message": "Unauthorized."
}

Example response (405):

{
    "message": "Method Not Allowed."
}

HTTP Request

GET v3_1/servers