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.
Request Body
Alphanumeric username of the client
The device name the user tries to authenticate from. (Ex: Liam's iPhone)
200: OK Returns an authorization token to be used as Bearer token for API requests. 422: Unprocessable Entity The given data was invalid. (Ex: Password was not sent) 400: Bad Request Your account has been suspended. 422: Unprocessable Entity The provided credentials are incorrect.
Copy {
"success": true,
"message": null,
"token": "12|TDLLcUvoJlzYKMgMi398WwxjW6tcY8OJtZkWcfTC"
}
Copy {
"message": "The given data was invalid.",
"errors": {
"password": [
"The password field is required."
]
}
}
Copy {
"status": false,
"error": "Your account has been suspended.",
"suspend_reason": null
}
Copy {
"success": false,
"message": "The provided credentials are incorrect."
}
Account Details
GET
/api/account
Retrieve general details of user account
Bearer Authorization-Token-Here
200: OK Return user data 401: Unauthorized Missing or wrong Bearer token
Copy {
"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"
}
}
Copy {
"success": false,
"message": "Unauthenticated."
}
Server List
GET
/api/servers
Get all VPN servers available
Bearer Authorization-Token-Here
Request Body
The results with be paginated by set amount.
200: OK Results paginated to 1 data per page 401: Unauthorized Missing or wrong Bearer token
Copy {
"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
}
Copy {
"success": false,
"message": "Unauthenticated."
}
OpenVPN
OpenVPN Profile
GET
/api/openvpn/profile
Retrieve the OpenVPN profile for specific vpn server.
Bearer Authorization-Token-Here
Request Body
The server id that you want to retrieve OpenVPN profile data.
If you wish to retrieve only the ca.crt content instead of whole profile data, you can send this as True. By default it's False.
200: OK Full OpenVPN profile data 200: OK Certificate only 401: Unauthorized Missing or wrong Bearer token 422: Unprocessable Entity User does not pass checks or operation failed
Copy {
"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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8E\r\nBAMCAQYwCgYIKoZIzj0EAwIDSQAwRgIhAMMyz27x4tc1mWkkMqaPa7WCYJ2hAVCl\r\nsXnxlX+efW1dAiEA24iaSKjJKNsXyyzslTDegu9ktHg2AiHOVdrCIoD1Nk4=\r\n-----END CERTIFICATE-----\r\n"
}
Copy {
"success": false,
"message": "Unauthenticated."
}
Copy {
"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.
Bearer Authorization-Token-Here
200: OK OpenVPN auth details retrieved successfully. 401: Unauthorized Missing or wrong Bearer token 422: Unprocessable Entity You do not have an active service. 422: Unprocessable Entity Your service is not active. 422: Unprocessable Entity Your service is expired. 404: Not Found The server is not found or enabled. 422: Unprocessable Entity The server is not using OpenVPN protocol. 404: Not Found OpenVPN profile is not found for this server.
Copy {
"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"
}
}
Copy {
"success": false,
"message": "Unauthenticated."
}
Copy {
"success": false,
"message": "You do not have any service."
}
Copy {
"success": false,
"message": "Your service is not active."
}
Copy {
"success": false,
"message": "Your service is expired."
}
Copy {
"success": false,
"message": "The server is not found or enabled."
}
Copy {
"success": false,
"message": "The server is not using OpenVPN protocol."
}
Copy {
"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.
Bearer Authorization-Token-Here
200: OK 401: Unauthorized Missing or wrong Bearer token 422: Unprocessable Entity You do not have any service. 422: Unprocessable Entity Your service is not active. 422: Unprocessable Entity Your service is expired. 422: Unprocessable Entity The server is not using WireGuard protocol. 404: Not Found The server is not found or enabled. 404: Not Found No configuration found for this server.
Copy {
"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.
Copy {
"success": false,
"message": "Unauthenticated."
}
Copy {
"success": false,
"message": "You do not have any service."
}
Copy {
"success": false,
"message": "Your service is not active."
}
Copy {
"success": false,
"message": "Your service is expired."
}
Copy {
"success": false,
"message": "The server is not using WireGuard protocol."
}
Copy {
"success": false,
"message": "The server is not found or enabled."
}
Copy {
"success": false,
"message": "No configuration found for this server."
}
WireGuard Configuration
POST
/api/wireguard/create
Create a new WireGuard configuration on specific vpn server.
Bearer Authorization-Token-Here
Request Body
The server id that you want to create a new WireGuard configuration for user.
200: OK 422: Unprocessable Entity You do not have any service. 422: Unprocessable Entity Your service is not active. 422: Unprocessable Entity Your service is expired. 404: Not Found The server is not found or enabled. 422: Unprocessable Entity The server is not using WireGuard protocol. 422: Unprocessable Entity The server has reached the maximum allowed user limit. Please try again later or choose a different server. 422: Unprocessable Entity 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. 401: Unauthorized Missing or wrong Bearer token
Copy {
"status": true,
"message": "WireGuard configuration create job dispatched. It will be completed shortly."
}
Copy {
"success": false,
"message": "You do not have any service."
}
Copy {
"success": false,
"message": "Your service is not active."
}
Copy {
"success": false,
"message": "Your service is expired."
}
Copy {
"success": false,
"message": "The server is not found or enabled."
}
Copy {
"success": false,
"message": "The server is not using WireGuard protocol."
}
Copy {
"success": false,
"message": "The server has reached the maximum allowed user limit. Please try again later or choose a different server."
}
Copy {
"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."
}
Copy {
"success": false,
"message": "Unauthenticated."
}
WireGuard Configuration
DELETE
/api/wireguard/delete
Delete a specific WireGuard configuration.
Bearer Authorization-Token-Here
Request Body
Pass the WireGuard configuration id you would like to delete.
200: OK 401: Unauthorized Missing or wrong Bearer token 404: Not Found The WireGuard configuration is not found. 422: Unprocessable Entity The WireGuard configuration is pending creation or deletion.
Copy {
"success": true,
"message": "WireGuard configuration delete job dispatched. It will be completed shortly."
}
Copy {
"success": false,
"message": "Unauthenticated."
}
Copy {
"success": false,
"message": "The WireGuard configuration is not found."
}
Copy {
"success": false,
"message": "The WireGuard configuration is pending creation or deletion."
}