Skip to content

soga-client-v1 Node API Documentation ​

Introduction ​

The client gets the connection config and routing rules of the nodes through this endpoint and does not request the subscription URL.

For general conventions such as request headers, response format and error handling, see the soga-client-v1 API Documentation.

Get Node Config GET <base_url>/api/v1/servers ​

Login required

The credentials in a node (uuid, password, etc.) are those of the current user. After subscription/reset is called, this endpoint returns the new credentials

When the subscription is unavailable (not purchased, expired or banned), servers is an empty list

Response ​

json
{
  "success": true,
  "data": {
    "servers": [                            // node list, in the order the client displays them
      {
        "id": 1,                            // unique, stays the same after the node is modified
        "name": "Hong Kong 01",
        "type": "vless",                    // protocol, options: shadowsocks vmess vless trojan anytls hysteria2 mieru socks
        "address": "hk01.website.com",      // domain or IP, IPv6 without square brackets
        "port": 443,
        "settings": {},                     // protocol settings, vary by type, see settings
        "transport": null,                  // transport layer, null means plain TCP, see transport
        "tls": null                         // null means disabled, see tls
      }
    ],
    "router": {}                            // routing rules, see router
  }
}

settings ​

shadowsocks ​

transport can be null or ws; tls is optional only when transport is ws, and only its server_name is used

json
{
  "method": "2022-blake3-aes-128-gcm",      // options: aes-128-gcm aes-256-gcm chacha20-poly1305 chacha20-ietf-poly1305 2022-blake3-aes-128-gcm 2022-blake3-aes-256-gcm
  "password": "MTIzNDU2Nzg5MGFiY2RlZg==:YWJjZGVmMDEyMzQ1Njc4OQ==",
  "obfs": {                                 // simple-obfs obfuscation, null means not used, cannot be used together with transport
    "mode": "http",                         // options: http tls
    "host": "www.bing.com"
  }
}

When method is 2022-blake3-*, password is server key:user key, where each part is standard Base64 and decodes to 16 bytes for aes-128 and 32 bytes for aes-256

When transport is ws, it is equivalent to the websocket mode of v2ray-plugin, without multiplexing

vmess ​

transport can be null, ws, grpc or xhttp; tls is optional; reality is not supported

json
{
  "uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
}

Only AEAD authentication is supported, i.e. alterId is 0

vless ​

transport can be null, ws, grpc or xhttp; tls is optional

json
{
  "uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
  "flow": "xtls-rprx-vision",               // null means not used, options: xtls-rprx-vision
  "encryption": null                        // null means not used, format: mlkem768x25519plus.native.0rtt.<public key>
}

flow is available only when transport is null and at least one of tls and encryption is not null

trojan ​

transport can be null, ws, grpc or xhttp; tls is required

json
{
  "password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
}

anytls ​

transport must be null; tls is required

json
{
  "password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
  "idle_session_check_interval": 30,        // interval for checking idle sessions, in seconds, null means the client default is used
  "idle_session_timeout": 30,               // time after which idle sessions are closed, in seconds, null means the client default is used
  "min_idle_session": null                  // number of idle sessions to keep, null means the client default is used
}

hysteria2 ​

transport must be null; tls is required, and only its server_name and insecure are used

json
{
  "password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
  "obfs_password": null,                    // salamander obfuscation password, null means no obfuscation
  "ports": "443,20000-30000",               // port list for port hopping, null means not used, when set the node's port is not used
  "hop_interval": 30,                       // port hopping interval, in seconds, minimum 5, 30 when null
  "up_mbps": null,                          // uplink bandwidth, null means unspecified
  "down_mbps": 200                          // downlink bandwidth, null means unspecified
}

mieru ​

transport and tls must both be null

json
{
  "username": "user1",                      // 1 to 64 bytes
  "password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
  "network": "tcp",                         // options: tcp udp
  "ports": null                             // same format as ports in hysteria2, null means only the node's port is used
}

socks ​

transport must be null; tls is optional; reality is not supported

json
{
  "username": "user1",                      // null means no authentication is required
  "password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
}

transport ​

ws ​

json
{
  "type": "ws",
  "path": "/ws",
  "host": "cdn.website.com"                 // Host request header, null means unspecified
}

grpc ​

json
{
  "type": "grpc",
  "service_name": "GunService"
}

xhttp ​

json
{
  "type": "xhttp",
  "path": "/xhttp",
  "host": null,                             // when null, tls.server_name is used
  "mode": "auto",                           // options: auto packet-up stream-up stream-one
  "headers": {                              // additional request headers, null means none, Host in it has no effect
    "User-Agent": "Mozilla/5.0"
  },
  "no_grpc_header": false,                  // do not send the gRPC request header
  "x_padding_bytes": {                      // range of the padding length, null means the client default is used
    "from": 100,
    "to": 1000
  },
  "sc_max_each_post_bytes": null,           // range of the maximum bytes per uplink request, same format as x_padding_bytes
  "sc_min_posts_interval_ms": null,         // range of the minimum interval between uplink requests, in milliseconds, same format as x_padding_bytes
  "uplink_http_method": null,               // POST when null
  "download": {                             // separate connection for the downlink, null means uplink and downlink use the same address, cannot be used together with stream-one
    "address": "dl.website.com",
    "port": 443,
    "path": null,                           // when null, the outer path is used
    "host": null,                           // when null, the outer host is used
    "headers": null,                        // when null, the outer headers are used
    "tls": null                             // same format as the node's tls, null means disabled
  }
}

When mode is auto, nodes using Reality connect with stream-one (stream-up when download is set), and other nodes connect with packet-up

tls ​

json
{
  "server_name": "www.website.com",         // SNI
  "insecure": false,                        // do not verify the server certificate
  "alpn": ["h2", "http/1.1"],               // [] means unspecified, when transport is grpc or xhttp the client always uses h2
  "ech": {                                  // null means disabled
    "config": null                          // Base64-encoded ECHConfigList, when null the client queries it from DNS
  },
  "reality": {                              // null means standard TLS, when not null insecure, alpn and ech have no effect
    "public_key": "7xhH4b_VkliBxGulljcyPOH-bYUA2dl-XAdZAsfhk04",     // 32 bytes, URL-safe Base64 (without padding) or hex
    "short_id": "6ba85179e30d4fc2",         // hex, up to 16 characters, may be an empty string
    "spider_x": null                        // null means unspecified
  }
}

router ​

json
{
  "domain_resolve": true,                   // when a domain matches no rule, resolve it to an IP and match once more
  "rules": [                                // matched in order, later rules are not checked after a match
    {
      "target": "direct",                   // where matched connections go, options: proxy (the node selected by the user) direct (direct connection) reject (reject the connection)
      "domain": ["www.website.com"],        // full domain
      "domain_suffix": ["website.com"],     // matches website.com and all its subdomains
      "domain_keyword": ["website"],        // keyword contained in the domain
      "domain_regex": ["^ad[0-9]+\\."],     // case-insensitive
      "geosite": ["cn"],                    // domain category
      "port": ["443", "8000-9000"],         // destination port or port range
      "network": ["tcp"]                    // options: tcp udp
    },
    {
      "target": "direct",
      "ip": ["203.0.113.0/24", "2001:db8::/32"],
      "geoip": ["cn"]                       // country code
    }
  ]
}

All fields other than target are match conditions; conditions that are not used can be omitted

Domain conditions (domain domain_suffix domain_keyword domain_regex geosite) match when any one of their values matches, and the same applies to IP conditions (ip geoip)

When a rule has domain or IP conditions together with port and network, all of them must match

A rule cannot have both domain and IP conditions

Connections that match no rule go through the node selected by the user

Private network addresses and the nodes' own addresses always connect directly, with no rules needed

Compatibility Conventions ​

The client ignores fields it does not recognize, except for fields in rules

When the client does not recognize a node's type, transport.type or another option value, or the combination of transport and tls does not meet the requirements of the protocol, the client ignores that node and the other nodes are not affected

When the client does not recognize a rule's target or a condition field, or the rule has no conditions, the client ignores that rule and the other rules are not affected

Example ​

json
{
  "success": true,
  "data": {
    "servers": [
      {
        "id": 1,
        "name": "Hong Kong 01",
        "type": "vless",
        "address": "hk01.website.com",
        "port": 443,
        "settings": {
          "uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
          "flow": "xtls-rprx-vision",
          "encryption": null
        },
        "transport": null,
        "tls": {
          "server_name": "www.website.com",
          "insecure": false,
          "alpn": [],
          "ech": null,
          "reality": {
            "public_key": "7xhH4b_VkliBxGulljcyPOH-bYUA2dl-XAdZAsfhk04",
            "short_id": "6ba85179e30d4fc2",
            "spider_x": null
          }
        }
      },
      {
        "id": 2,
        "name": "Japan 01",
        "type": "vmess",
        "address": "jp01.website.com",
        "port": 443,
        "settings": {
          "uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11"
        },
        "transport": {
          "type": "ws",
          "path": "/ws",
          "host": "jp01.website.com"
        },
        "tls": {
          "server_name": "jp01.website.com",
          "insecure": false,
          "alpn": [],
          "ech": null,
          "reality": null
        }
      },
      {
        "id": 3,
        "name": "United States 01",
        "type": "shadowsocks",
        "address": "203.0.113.10",
        "port": 8388,
        "settings": {
          "method": "2022-blake3-aes-128-gcm",
          "password": "MTIzNDU2Nzg5MGFiY2RlZg==:YWJjZGVmMDEyMzQ1Njc4OQ==",
          "obfs": null
        },
        "transport": null,
        "tls": null
      },
      {
        "id": 4,
        "name": "Singapore 01",
        "type": "hysteria2",
        "address": "sg01.website.com",
        "port": 443,
        "settings": {
          "password": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
          "obfs_password": null,
          "ports": "443,20000-30000",
          "hop_interval": 30,
          "up_mbps": null,
          "down_mbps": 200
        },
        "transport": null,
        "tls": {
          "server_name": "sg01.website.com",
          "insecure": false,
          "alpn": [],
          "ech": null,
          "reality": null
        }
      },
      {
        "id": 5,
        "name": "Taiwan 01",
        "type": "vless",
        "address": "tw01.website.com",
        "port": 443,
        "settings": {
          "uuid": "3f0c1e8a-6b1d-4c57-9a52-0e3a7d5b9c11",
          "flow": null,
          "encryption": null
        },
        "transport": {
          "type": "xhttp",
          "path": "/xhttp",
          "host": null,
          "mode": "auto",
          "headers": null,
          "no_grpc_header": false,
          "x_padding_bytes": null,
          "sc_max_each_post_bytes": null,
          "sc_min_posts_interval_ms": null,
          "uplink_http_method": null,
          "download": null
        },
        "tls": {
          "server_name": "tw01.website.com",
          "insecure": false,
          "alpn": [],
          "ech": null,
          "reality": null
        }
      }
    ],
    "router": {
      "domain_resolve": true,
      "rules": [
        {
          "target": "reject",
          "domain_keyword": ["adservice"]
        },
        {
          "target": "direct",
          "domain_suffix": ["cn"],
          "geosite": ["cn"]
        },
        {
          "target": "direct",
          "geoip": ["cn"]
        }
      ]
    }
  }
}