Marzban CLI
The Marzban CLI consists of 4 main commands, each with sub-commands that serve specific functions. In this section, we will cover the use of each command. Additionally, at the end of this section, you will find examples of some commonly used commands.
1. How to Use
Shows the placement of options and commands for marzban cli
marzban cli [OPTIONS] COMMAND [ARGS]...Tip
In this section, [ARGS], short for Arguments refers to the placement of various sub-command arguments within the main command above, each serving a specific purpose in its respective section.
2. Options
--help
- Used to view the help for
marzban cli
marzban cli --helpTip
If a command has multiple options and you only specify one, it will automatically prompt you for the other options. However, you can include all options in a single command to avoid answering each prompt individually, which allows the command to execute immediately.
For example, in the following command, we set a user's ownership transfer from one admin to another by adding the username, the target admin, and a final confirmation. This allows the command to execute right away:
marzban cli user set-owner -u TEXT --admin TEXT -y- Some options in the command are optional, so their absence will not cause any issues.
3. Commands
admin
marzban cli admincompletion
marzban cli completionsubscription
marzban cli subscriptionuser
marzban cli useradmin
1. How to Use
- Shows the placement of options and commands for the
admincommand.
marzban cli admin [OPTIONS] COMMAND [ARGS]...2. Options
--help
- Used to view the help for the
admincommand.
marzban cli admin --help3. Commands
create
- Used to create an admin.
marzban cli admin createdelete
- Used to delete an admin.
marzban cli admin deleteimport-from-env
- Used to import a
sudoadmin fromenvfile.
marzban cli admin import-from-envlist
- Used to display the list of admins.
marzban cli admin listupdate
- Used to update the details of an admin.
marzban cli admin updateadmin create
- Used to create an admin.
1. How to Use
- Shows the placement of options and commands for the
admin createcommand.
marzban cli admin create [OPTIONS]2. Options
-u, --username TEXT
- Used to set the username for an admin. Replace the phrase
TEXTwith the desired username of your admin. Note that without the--sudophrase at the end of the command, the created admin will not have sudo privileges.
marzban cli admin create -u TEXT--sudo
- Used to create a
sudoadmin.
marzban cli admin create -u TEXT --sudo--no-sudo
- Used to create a
non-sudoadmin, which is the default even if this phrase is not included.
marzban cli admin create -u TEXT --no-sudo-tg, --telegram-id TEXT
- Used to set the ID number of the admin in Telegram.
marzban cli admin create -tg TEXT-dc, --discord-webhook TEXT
- Used for setting the webhook in Discord.
marzban cli admin create -dc TEXT--help
- Used to view the help for the
admin createcommand.
marzban cli admin create --helpadmin delete
- Used to delete an admin.
1. How to Use
- Shows the placement of options and commands for the
admin deletecommand.
marzban cli admin delete [OPTIONS]2. Options
-u, --username TEXT
- Replace the phrase
TEXTwith the admin's username.
marzban cli admin delete -u TEXT-y, --yes
- By adding this option, final confirmation will not be requested from you.
marzban cli admin delete -u TEXT -y--help
- Used to view the help for the
admin deletecommand.
marzban cli admin delete --helpadmin import-from-env
- Used to import a
sudoadmin fromenvfile.
1. How to Use
- Shows the placement of options and commands for the
admin import-from-envcommand.
marzban cli admin import-from-env [OPTIONS]2. Options
-y, --yes
- By adding this option, final confirmation will not be requested from you.
marzban cli admin import-from-env -y--help
- Used to view the help for the
admin import-from-envcommand.
marzban cli admin import-from-env --helpadmin list
- Used to display the list of admins.
1. How to Use
- Shows the placement of options and commands for the
admin listcommand.
marzban cli admin list [OPTIONS]2. Options
-o, --offset INTEGER
- This option is used to view the list of admins starting from a specific number, which you should replace with the phrase
ITEMS. For example, if you enter the number10, it will not display the first ten admins.
marzban cli admin list -o ITEMS-l, --limit INTEGER
- Replace the phrase
ITEMSwith the number of admins you want to display.
marzban cli admin list -l ITEMS-u, --username TEXT
- Replace the phrase
TEXTwith the admin's username.
marzban cli admin list -u TEXT--help
- Used to view the help for the
admin listcommand.
marzban cli admin list --helpadmin update
- Used to update the details of an admin.
1. How to Use
- Shows the placement of options and commands for the
admin updatecommand.
marzban cli admin update [OPTIONS]2. Options
-u, --username TEXT
- Replace the phrase
TEXTwith the username of your admin.
marzban cli admin update -u TEXT--help
- Used to view the help for the
admin updatecommand.
marzban cli admin update --helpsubscription
1. How to Use
- Shows the placement of options and commands for the
subscriptioncommand.
marzban cli subscription [OPTIONS] COMMAND [ARGS]...2. Options
--help
- Used to view the help for the
subscriptioncommand.
marzban cli subscription --help3. Commands
get-config
- Used to get the proxies of a user.
marzban cli subscription get-configget-link
- Used to get a user's subscription link.
marzban cli subscription get-linksubscription get-config
- Used to get the proxies of a user.
1. How to Use
- Shows the placement of options for the
subscription get-configcommand.
marzban cli subscription get-config [OPTIONS]2. Options
-u, --username TEXT
- Replace the phrase
TEXTwith the user's username.
marzban cli subscription get-config -u TEXT-f, --format [v2ray|clash]
- View a user's proxies in the
v2rayorclashformat.
marzban cli subscription get-config -u TEXT -f [v2ray|clash]-o, --output TEXT
- Save a user's proxies in the
v2rayorclashformat to a file.
marzban cli subscription get-config -u TEXT -f v2ray -o v2ray_config.jsonmarzban cli subscription get-config -u TEXT -f clash -o clash_config.yaml--base64
- View a user's proxies in a custom format that is encoded with
base64.
marzban cli subscription get-config -u TEXT -f [v2ray|clash] --base64--help
- Used to view the help for the
subscription get-configcommand.
marzban cli subscription get-config --helpsubscription get-link
- Used to get a user's subscription link.
1. How to Use
- Shows the placement of options for the
subscription get-linkcommand.
marzban cli subscription get-link [OPTIONS]2. Options
-u, --username TEXT
- Replace the phrase
TEXTwith the user's username.
marzban cli subscription get-link -u TEXT--help
- Used to view the help for the
subscription get-linkcommand.
marzban cli subscription get-link --helpuser
1. How to Use
- Shows the placement of options and commands for the
usercommand.
marzban cli user [OPTIONS] COMMAND [ARGS]...2. Options
--help
- Used to view the help for the
usercommand.
marzban cli user --help3. Commands
list
- Used to view the list of users.
marzban cli user listset-owner
- Used to change the ownership of a user from one admin to another.
marzban cli user set-owneruser list
- Used to view the list of users.
1. How to Use
- Shows the placement of options for the
user listcommand.
marzban cli user list [OPTIONS]2. Options
-o, --offset INTEGER
- This option is used to view the list of users starting from a specific number, which you should replace with the phrase
ITEMS. For example, if you enter the number100, it will not display the first hundred users.
marzban cli user list -o ITEMS-l, --limit INTEGER
- Replace the phrase
ITEMSwith the number of users you want to display.
marzban cli user list -l ITEMS-u, --username TEXT
- Replace the phrase
TEXTwith the user's username.
marzban cli user list -u TEXT-s, --search TEXT
- Replace the phrase
TEXTwith the user's username; this option will also search for the entered phrase in the users' notes box.
marzban cli user list -s TEXT--status [active|disabled|limited|expired|on_hold]
- Used to view the list of users who have one of these
5statuses.
marzban cli user list --status [active|disabled|limited|expired|on_hold]--admin, --owner TEXT
- Used to view the list of users of a specific admin, Replace the phrase
TEXTwith the username of your admin.
marzban cli user list --admin TEXT--help
- Used to view the help for the
user listcommand.
marzban cli user list --helpuser set-owner
- Used to change the ownership of a user from one admin to another.
1. How to Use
- Shows the placement of options for the
user set-ownercommand.
marzban cli user set-owner [OPTIONS]2. Options
-u, --username TEXT
- Replace the phrase
TEXTwith the user's username.
marzban cli user set-owner -u TEXT--admin, --owner TEXT
- Replace the phrase
TEXTwith the desired username of your admin.
marzban cli user set-owner --admin TEXT-y, --yes
- By adding this option, final confirmation will not be requested from you.
marzban cli user set-owner -u TEXT --admin TEXT -y--help
- Used to view the help for the
user set-ownercommand.
marzban cli user set-owner --helpcompletion
1. How to Use
- Shows the placement of options and commands for the
completioncommand.
marzban cli completion [OPTIONS] COMMAND [ARGS]...2. Options
--help
- Used to view the help for the
completioncommand.
marzban cli completion --help3. Commands
install
marzban cli completion installshow
marzban cli completion showcompletion install
1. How to Use
- Shows the placement of options for the
completion installcommand.
marzban cli completion install [OPTIONS]2. Options
--shell [bash|zsh|fish|powershell|pwsh]
marzban cli completion install --shell [bash|zsh|fish|powershell|pwsh]--help
- Used to view the help for the
completion installcommand.
marzban cli completion install --helpcompletion show
1. How to Use
- Shows the placement of options for the
completion showcommand.
marzban cli completion show [OPTIONS]2. Options
--shell [bash|zsh|fish|powershell|pwsh]
marzban cli completion show --shell [bash|zsh|fish|powershell|pwsh]--help
- Used to view the help for the
completion showcommand.
marzban cli completion show --helpexamples
Several examples of commonly used commands related to
marzban cliUsed to create a
sudoadmin
marzban cli admin create --sudo- Used to create a
non-sudoadmin
marzban cli admin create- Used to delete an admin
marzban cli admin delete- Used to change the panel password if forgotten
marzban cli admin update- Used to change user ownership from one admin to another
marzban cli user set-owner