API Endpoints

VPN Script comes with API so you can create and integrate with your own applications. You have to use your VPN Script installation link as the base URL for the endpoints.

General

Authenticate User

POST /api/auth/token

You have to authenticate the client and retrieve Bearer token in order to send requests to API Endpoints.

Headers

Request Body

{
    "success": true,
    "message": null,
    "token": "12|TDLLcUvoJlzYKMgMi398WwxjW6tcY8OJtZkWcfTC"
}

Account Details

GET /api/account

Retrieve general details of user account

Headers

{
    "success": true,
    "message": null,
    "data": {
        "user_id": 1,
        "username": "admin",
        "email": "admin@example.com",
        "status": 2,
        "suspend_reason": null,
        "service": [
            {
                "id": 1,
                "user_id": 1,
                "plan_id": 3,
                "name": "Gold Plan",
                "next_payment": "2022-06-15T00:06:00.000000Z",
                "auto_renew": 1,
                "status": 1
            }
        ],
        "created_at": null,
        "updated_at": "2021-12-21T20:16:32.000000Z"
    }
}

Server List

GET /api/servers

Get all VPN servers available

Headers

Request Body

{
    "data": [
        {
            "id": 1,
            "name": "Test Server",
            "country": "Germany",
            "country_slug": "germany",
            "country_iso_code": "de",
            "city": "",
            "state": "Frankfurt",
            "host": "",
            "ipaddr": "127.0.0.1",
            "protocol": "openvpn",
            "config_id": 1,
            "wg_available_slots": 253,
            "wg_slots": 0
        },
        {
            "id": 2,
            "name": "Test Server 2",
            "country": "Germany",
            "country_slug": "germany",
            "country_iso_code": "de",
            "city": "",
            "state": "Frankfurt",
            "host": "",
            "ipaddr": "127.0.0.2",
            "protocol": "wireguard",
            "config_id": null,
            "wg_available_slots": 253,
            "wg_slots": 0
        }
    ]
}

OpenVPN

OpenVPN Profile

GET /api/openvpn/profile

Retrieve the OpenVPN profile for specific vpn server.

Headers

Request Body

{
    "success": true,
    "message": null,
    "data": "client\ndev tun\nproto udp\nremote 127.0.0.1 1194\nresolv-retry infinite\nnobind\npersist-tun\nauth-user-pass\nreneg-sec 0\nblock-outside-dns\ncipher AES-128-GCM\ntls-version-min 1.2\ntls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256\nmute-replay-warnings\nverb 0\nclient-cert-not-required\nignore-unknown-option block-outside-dns\nsetenv opt block-outside-dns # Prevent Windows 10 DNS leak\n<ca>\n-----BEGIN CERTIFICATE-----\r\nMIIB2DCCAX2gAwIBAgIUOgwSKMY1IqPDbjvrVJ5S5/m5IrQwCgYIKoZIzj0EAwIw\r\nHjEcMBoGA1UEAwwTY25fenBnenhZa1J4b2dRNHJ0eTAeFw0yMTEyMjExNTU2MzVa\r\nFw0zMTEyMTkxNTU2MzVaMB4xHDAaBgNVBAMME2NuX3pwZ3p4WWtSeG9nUTRydHkw\r\nWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQ/BGhelZoeNxRn/ppaxxM0b3jZqbHv\r\ny0u8dXIhMWpfw+bM9zEFYxixP24Lqpt7RTiW0ML9pcBSQ/xKQGNQB3nao4GYMIGV\r\nMB0GA1UdDgQWBBSHNinCzJ65lMK0oKaanWtnfbYGvjBZBgNVHSMEUjBQgBSHNinC\r\nzJ65lMK0oKaanWtnfbYGvqEipCAwHjEcMBoGA1UEAwwTY25fenBnenhZa1J4b2dR\r\nNHJ0eYIUOgwSKMY1IqPDbjvrVJ5S5/m5IrQwDAYDVR0TBAUwAwEB/zALBgNVHQ8E\r\nBAMCAQYwCgYIKoZIzj0EAwIDSQAwRgIhAMMyz27x4tc1mWkkMqaPa7WCYJ2hAVCl\r\nsXnxlX+efW1dAiEA24iaSKjJKNsXyyzslTDegu9ktHg2AiHOVdrCIoD1Nk4=\r\n-----END CERTIFICATE-----\r\n\n</ca>\n"
}

OpenVPN Authentication Details

GET /api/openvpn/auth

Retrieve the required username and password to be used with OpenVPN profile files in order to connect to the vpn server.

Headers

{
    "success": true,
    "message": null,
    "data": {
        "id": 1,
        "user_id": 1,
        "service_id": 1,
        "username": "admin",
        "password": "HZovQQZlQori",
        "devices": 10,
        "enabled": 1,
        "created_at": "2021-12-21T20:16:32.000000Z",
        "updated_at": "2021-12-21T20:20:21.000000Z"
    }
}

WireGuard

WireGuard Configurations

GET /api/wireguard/configs

Retrieve all WireGuard configurations for specific vpn server.

Headers

{
    "status": true,
    "message": null,
    "data": [
        {
            "id": 5,
            "config": null,
            "status": 2, // 0 - Pending creation, 1 - Active, 2 - Pending deletion
            "fail_reason": null,
            "created_at": "2021-12-21T21:29:45.000000Z",
            "updated_at": "2021-12-21T21:40:02.000000Z"
        }
    ]
}

When a configuration status is "1" that means it was created on the server and it will set "config" data to connect WireGuard.

WireGuard Configuration

POST /api/wireguard/create

Create a new WireGuard configuration on specific vpn server.

Headers

Request Body

{
    "status": true,
    "message": "WireGuard configuration create job dispatched. It will be completed shortly."
}

WireGuard Configuration

DELETE /api/wireguard/delete

Delete a specific WireGuard configuration.

Headers

Request Body

{
    "success": true,
    "message": "WireGuard configuration delete job dispatched. It will be completed shortly."
}

Last updated