Automated VPN Setup Made Simple

AutoScript VPN provides easy-to-use scripts for quick VPN server deployment. Secure your connections with just a few commands.

Fast Setup
5 minutes
Secure
Military Grade
Open Source
Free to use

Why Choose AutoScript VPN?

Our automated scripts make VPN server deployment fast, secure, and hassle-free. No technical expertise required.

Quick Setup

Deploy your VPN server in minutes with our automated scripts. No technical expertise required.

Enhanced Security

Military-grade encryption and secure protocols to protect your data and privacy.

Global Access

Access content from anywhere in the world with our global server network.

High Performance

Optimized for speed and reliability, ensuring smooth browsing and streaming.

Open Source

Completely open source, transparent, and community-driven development.

24/7 Support

Active community and documentation to help you with any issues.

Easy Installation Process

Get your VPN server up and running in just a few simple steps with our automated installation script.

1

Download the Script

Clone the repository from GitHub to your server.

git clone https://github.com/farelvpn/autoscript.git
2

Run the Installation

Execute the main script with root privileges.

cd autoscript && sudo ./install.sh
3

Configure Your VPN

Follow the interactive setup to configure your VPN settings.

sudo ./config-vpn.sh
4

Connect & Enjoy

Use the generated configuration files to connect your devices.

# Download .ovpn files and import to your client

API Documentation

Complete API reference for managing your VPN users programmatically.

Overview
Authentication
Trojan API
Vmess API
Vless API
Error Handling

API Overview

The AutoScript VPN Web API provides a RESTful interface for managing VPN users programmatically. All endpoints require Bearer Token authentication.

Base URLs

HTTPS: https://your-domain.com/api/

HTTP: http://your-domain.com:9000/

Note: The internal API server runs on port 9000. Nginx is configured to proxy requests from the HTTPS endpoint.

Request Format

All API requests must:

  • Use HTTP POST method
  • Include Content-Type: application/json header
  • Include valid Bearer token in Authorization header
  • Send JSON data in request body

Response Format

All API responses follow this structure:

{ "status": "true|false", "code": 200, "message": "Descriptive message", "data": { ... } }

Authentication

All API endpoints require Bearer Token authentication. The token must be included in the Authorization header of every request.

Header Format

Authorization: Bearer your_token_here

Managing API Tokens

You can manage your API tokens using the interactive menu on your server:

menu-api

Or manually edit the token file:

nano /etc/api/key

Example cURL Request

curl -X POST 'https://your-domain.com/api/add-trojan' \ -H 'Authorization: Bearer your_token_here' \ -H 'Content-Type: application/json' \ -d '{"username": "new_user", "quota": 10}'

Trojan API Endpoints

Endpoint Method Description
/api/add-trojan POST Create new Trojan account
/api/delete-trojan POST Delete Trojan account
/api/cek-trojan POST Check account details
/api/add-quota-trojan POST Add quota to account
POST
/api/add-trojan
Create a new Trojan account.

Request Body

{ "username": "user_trojan_1", "quota": 10, "uuid": "optional-custom-uuid" }

Parameters:

  • username (required): Unique username for the account
  • quota (required): Data quota in GB (0 for unlimited)
  • uuid (optional): Custom UUID (generated automatically if not provided)

Response (Success)

{ "status": "true", "code": 201, "message": "Trojan account created successfully", "data": { "username": "user_trojan_1", "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "domain": "your-domain.com", "limits": { "quota_gb": 10, "quota_display": "10 GB", "quota_bytes": 10737418240 }, "ports": { "trojan_ws_tls": 443, "trojan_ws_http": 80 }, "links": { "trojan_ws_tls": "trojan://...#user_trojan_1" } } }
POST
/api/delete-trojan
Delete a Trojan account permanently.

Request Body

{ "username": "user_trojan_1" }

Response (Success)

{ "status": "true", "code": 200, "message": "Account 'user_trojan_1' deleted permanently", "data": { "username": "user_trojan_1", "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "files_removed": ["database", "quota_limit"] } }

Vmess API Endpoints

Endpoint Method Description
/api/add-vmess POST Create new Vmess account
/api/delete-vmess POST Delete Vmess account
/api/cek-vmess POST Check account details
/api/add-quota-vmess POST Add quota to account
POST
/api/add-vmess
Create a new Vmess account.

Request Body

{ "username": "user_vmess_1", "quota": 10, "uuid": "optional-custom-uuid" }

Response (Success)

{ "status": "true", "code": 201, "message": "Vmess account created successfully", "data": { "username": "user_vmess_1", "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "domain": "your-domain.com", "limits": { "quota": 10, "quota_display": "10 GB", "quota_bytes": 10737418240 }, "ports": { "vmess_ws_tls": 443, "vmess_ws_http": 80 }, "links": { "vmess_ws_tls": "vmess://...", "vmess_ws_http": "vmess://..." } } }

Vless API Endpoints

Endpoint Method Description
/api/add-vless POST Create new Vless account
/api/delete-vless POST Delete Vless account
/api/cek-vless POST Check account details
/api/add-quota-vless POST Add quota to account
POST
/api/add-vless
Create a new Vless account.

Request Body

{ "username": "user_vless_1", "quota": 10, "uuid": "optional-custom-uuid" }

Response (Success)

{ "status": "true", "code": 201, "message": "Vless account created successfully", "data": { "username": "user_vless_1", "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "domain": "your-domain.com", "limits": { "quota": 10, "quota_display": "10 GB", "quota_bytes": 10737418240 }, "ports": { "vless_ws_tls": 443, "vless_ws_http": 80 }, "links": { "vless_ws_tls": "vless://...", "vless_ws_http": "vless://..." } } }

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests.

Common Error Responses

401 Unauthorized - Invalid or missing Bearer token

{ "message": "Unauthorized: Missing or invalid Bearer token" }

400 Bad Request - Invalid JSON or missing required fields

{ "status": "false", "code": 400, "message": "Invalid JSON input. 'username' and 'quota' are required." }

404 Not Found - User not found

{ "status": "false", "code": 404, "message": "User 'username' not found." }

409 Conflict - User already exists

{ "status": "false", "code": 409, "message": "Username already exists." }

500 Internal Server Error - Server-side error

{ "error": "Script execution failed", "details": "...", "stderr": "..." }

MIT License

AutoScript VPN is open source and free to use under the permissive MIT License.

MIT License

Copyright (c) 2023 AutoScript VPN

Commercial Use

Use in commercial projects

Modification

Modify and customize the code

Distribution

Distribute your changes

Private Use

Use in private projects

License Terms

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

What Users Say

Hear from our community of users who have successfully deployed their VPN servers with AutoScript.

"AutoScript VPN saved me hours of configuration time. The setup was incredibly smooth, and my VPN has been running flawlessly for months."
JD

John Doe

System Administrator

"As someone with limited technical knowledge, I was able to set up my own VPN server thanks to these scripts. The documentation is excellent!"
AS

Alice Smith

Freelancer

"The performance is outstanding! I'm getting faster speeds with my self-hosted VPN than with commercial services, at a fraction of the cost."
RJ

Robert Johnson

Developer

Ready to Secure Your Connection?

Join thousands of users who have deployed their own VPN servers with AutoScript VPN.

Get Started on GitHub