Problem with API
#4632
|
I'm having some difficulties with the api, for some reason most of the methods don't work, let's say the same At the same time, the What can I additionally provide as information to understand what the problem is? xray api statsonline --server=127.0.0.1:10085 --email="full@x7b3f6l0q7c2.seneal.dev"
failed to get stats: rpc error: code = Unknown desc = app/stats/command: user>>>full@x7b3f6l0q7c2.seneal.dev>>>online not found |
Answered by
vrnobody
Apr 21, 2025
Replies: 1 comment 2 replies
|
In order to use the statistics feature, you need to enable the corresponding options in "policy" object and add an empty "stats" object in config file. config.json: {
"log": {
"loglevel": "debug"
},
"api": {
"tag": "api",
"listen": "127.0.0.1:10085",
"services": [
"StatsService"
]
},
"stats": {},
"policy": {
"levels": {
"0": {
"statsUserUplink": true,
"statsUserDownlink": true,
"statsUserOnline": true
}
},
"system": {
"statsInboundUplink": true,
"statsInboundDownlink": true
}
},
"inbounds": [
{
"protocol": "vless",
"listen": "127.0.0.1",
"port": 1080,
"settings": {
"clients": [
{
"id": "5783a3e7-e373-51cd-8642-c83782b807c5",
"level": 0,
"email": "love@xray.com"
}
],
"decryption": "none"
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}Query stats. xray api statsquery -s 127.0.0.1:10085Please note that statistics are not updated in real time. |
2 replies
Answer selected by
seneaLL
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to use the statistics feature, you need to enable the corresponding options in "policy" object and add an empty "stats" object in config file.
I don't know much about the "statsUserOnline" feature, sorry I can't help you with that.
config.json:
{ "log": { "loglevel": "debug" }, "api": { "tag": "api", "listen": "127.0.0.1:10085", "services": [ "StatsService" ] }, "stats": {}, "policy": { "levels": { "0": { "statsUserUplink": true, "statsUserDownlink": true, "statsUserOnline": true } }, "system": { "statsInboundUplink": true, "statsInboundDownlink": true } }, "inbounds": [ …