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"
}
{
"message": "The given data was invalid.",
"errors": {
"password": [
"The password field is required."
]
}
}
{
"status": false,
"error": "Your account has been suspended.",
"suspend_reason": null
}
{
"success": false,
"message": "The provided credentials are incorrect."
}
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"
}
}
{
"success": false,
"message": "Unauthenticated."
}
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
}
]
}
{
"current_page": 1,
"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
}
],
"first_page_url": "http://127.0.0.1:8000/api/servers?page=1",
"from": 1,
"last_page": 2,
"last_page_url": "http://127.0.0.1:8000/api/servers?page=2",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "http://127.0.0.1:8000/api/servers?page=1",
"label": "1",
"active": true
},
{
"url": "http://127.0.0.1:8000/api/servers?page=2",
"label": "2",
"active": false
},
{
"url": "http://127.0.0.1:8000/api/servers?page=2",
"label": "Next »",
"active": false
}
],
"next_page_url": "http://127.0.0.1:8000/api/servers?page=2",
"path": "http://127.0.0.1:8000/api/servers",
"per_page": "1",
"prev_page_url": null,
"to": 1,
"total": 2
}
{
"success": false,
"message": "Unauthenticated."
}
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\nMB0GA1UdDgQWBBSHNinCzJ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1Nk4=\r\n-----END CERTIFICATE-----\r\n"
}
{
"success": false,
"message": "Unauthenticated."
}
{
"success": false,
"message": "You do not have an active service."
}
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"
}
}
{
"success": false,
"message": "Unauthenticated."
}
{
"success": false,
"message": "You do not have any service."
}
{
"success": false,
"message": "Your service is not active."
}
{
"success": false,
"message": "Your service is expired."
}
{
"success": false,
"message": "The server is not found or enabled."
}
{
"success": false,
"message": "The server is not using OpenVPN protocol."
}
{
"success": false,
"message": "OpenVPN profile is not found for this server."
}
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.
{
"success": false,
"message": "Unauthenticated."
}
{
"success": false,
"message": "You do not have any service."
}
{
"success": false,
"message": "Your service is not active."
}
{
"success": false,
"message": "Your service is expired."
}
{
"success": false,
"message": "The server is not using WireGuard protocol."
}
{
"success": false,
"message": "The server is not found or enabled."
}
{
"success": false,
"message": "No configuration found for this server."
}
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."
}
{
"success": false,
"message": "You do not have any service."
}
{
"success": false,
"message": "Your service is not active."
}
{
"success": false,
"message": "Your service is expired."
}
{
"success": false,
"message": "The server is not found or enabled."
}
{
"success": false,
"message": "The server is not using WireGuard protocol."
}
{
"success": false,
"message": "The server has reached the maximum allowed user limit. Please try again later or choose a different server."
}
{
"success": false,
"message": "Looks like you reached maximum allowed device limit on your plan. Please retry after disconnecting from OpenVPN or deleting WireGuard configurations that you have generated before."
}
{
"success": false,
"message": "Unauthenticated."
}
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."
}
{
"success": false,
"message": "Unauthenticated."
}
{
"success": false,
"message": "The WireGuard configuration is not found."
}
{
"success": false,
"message": "The WireGuard configuration is pending creation or deletion."
}
Last updated