Skip to content

soga-client-v1 API Documentation ​

Introduction ​

soga-client-v1 is a set of user-facing endpoints used by the soga client. Once the panel implements them according to the documentation below, the client can log in, view subscriptions, buy plans, submit tickets and more.

base_url Configuration ​

The path is customizable. When calling an endpoint, the client automatically joins base_url with the endpoint uri, e.g. https://www.website.com/your/custom/uri/api/v1/me

base_url=https://www.website.com/your/custom/uri/

General Conventions ​

All endpoints exchange data in json format, and the parameters of GET endpoints are passed in the query

Every request includes the following request headers

KeyDescription
AuthorizationBearer <access_token>, required for endpoints that need login; access_token is returned by the login and registration endpoints
Accept-LanguageClient language, e.g. zh-CN en-US; the panel returns message text in this language
User-AgentClient name and version, e.g. soga-client/1.2.0 (windows)

The HTTP status code is normally 200, and whether a request succeeded is determined by success in the response

On success, success is true and the returned data is placed in data

json
{
  "success": true,
  "data": {}
}

For paginated list endpoints, the request parameters are page (starting from 1, default 1) and page_size (default 20, maximum 100), and the response has an additional pagination

json
{
  "success": true,
  "data": [],
  "pagination": {
    "page": 1,
    "page_size": 20,
    "total": 57       // total number of items
  }
}

On failure, success is false and the error information is placed in error

json
{
  "success": false,
  "error": {
    "message": "Incorrect email or password"          // message text shown directly to the user
  }
}

The following errors require special handling by the client, so code must be included in error

json
{
  "success": false,
  "error": {
    "code": 1001,
    "message": "Login expired, please log in again"
  }
}
Error CodeDescription
1001Not logged in or login expired; the client clears the login state and returns to the login page

For other errors, just return message and the client displays it directly

The client also recognizes common HTTP status codes, so the panel can return these status codes directly as well

HTTP Status CodeClient Handling
200Determined by success
401Same as error code 1001; clears the login state and returns to the login page
403Shows an access denied message
404Shows that the panel does not support this feature
429Shows that requests are too frequent
500 502 503 504Shows a server error and asks the user to try again later

For non-200 responses, if the response is json and contains error.message, error.message is displayed in preference

Data format conventions

  • Times are always Unix timestamps, in seconds
  • Amounts are always integers, in cents
  • Traffic is always an integer, in bytes
  • Booleans are always true / false
  • Return null when a value does not exist, and [] when a list is empty

Endpoints that only report success and have no data return

json
{
  "success": true
}

Public Endpoints ​

The following endpoints do not require login

Get Site Config GET <base_url>/api/v1/config ​

Response ​

json
{
  "success": true,
  "data": {
    "site_name": "Example",
    "site_url": "https://www.website.com",          // web panel URL
    "tos_url": "https://www.website.com/tos",       // terms of service, may be null
    "currency": "CNY",                              // currency code
    "currency_symbol": "¥",                         // currency symbol
    "register": {
      "enabled": true,                              // registration is open
      "email_verify": true,                         // registration requires an email verification code
      "invite_required": false,                     // registration requires an invite code
      "email_whitelist": ["gmail.com", "qq.com"]    // email suffixes allowed to register, [] means no restriction
    },
    "telegram": {
      "enabled": true,                              // Telegram bot is enabled
      "bot_username": "example_bot",                // bot username, without @
      "discuss_url": "https://t.me/example_group"   // discussion group, may be null
    },
    "commission": {
      "withdraw_enabled": true,                     // commission withdrawal is open
      "withdraw_methods": ["Alipay", "USDT"],       // withdrawal methods
      "withdraw_minimum": 10000,                    // minimum withdrawal amount
      "distribution_enabled": false,                // three-tier distribution is enabled
      "distribution_rates": [50, 30, 20]            // distribution rates for tiers one to three, in percent
    },
    "features": {                                   // feature switches, missing items are treated as false
      "deposit": true,                              // balance top-up
      "gift_card": true,                            // gift card redemption
      "gift_card_preview": true,                    // gift card preview before redemption, redemption history
      "telegram_unbind": true,                      // unbind Telegram
      "new_period": true,                           // start a new period early after traffic is used up
      "sessions": true                              // view and remove logged-in devices
    }
  }
}

Get Plan List GET <base_url>/api/v1/plans ​

Returns the plans available for purchase. When the request carries Authorization, the currently subscribed plan is also returned even if it has been delisted, as long as renewal is allowed

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Annual Plan",
      "content": "<p>100 GB traffic</p>",  // plan description, HTML, may be null
      "transfer_enable": 107374182400,     // traffic per period, in bytes
      "device_limit": 3,                   // device limit, null means unlimited
      "speed_limit": null,                 // speed limit in Mbps, null means unlimited
      "sold_out": false,                   // sold out, no new purchases
      "prices": [                          // purchasable periods and prices, periods that are not offered are not returned
        { "period": "month", "amount": 1500 },
        { "period": "year", "amount": 15000 },
        { "period": "reset_traffic", "amount": 500 }
      ]
    }
  ]
}

period options: month quarter half_year year two_year three_year onetime reset_traffic (traffic reset pack)

Get Plan Details GET <base_url>/api/v1/plan ​

Request Parameters ​

id=1

Response ​

json
{
  "success": true,
  "data": {
    // same as an item in the plan list
  }
}

Get Client Version GET <base_url>/api/v1/app/version ​

Response ​

json
{
  "success": true,
  "data": {
    "windows": {                                              // null for platforms that are not set
      "version": "1.4.0",                                     // latest version
      "download_url": "https://www.website.com/app.exe"
    },
    "macos": null,
    "android": {
      "version": "1.4.0",
      "download_url": "https://www.website.com/app.apk"
    }
  }
}

Login and Registration ​

Send Email Verification Code POST <base_url>/api/v1/auth/email_code ​

Request Body ​

json
{
  "email": "[email protected]",
  "scene": "register"          // options: register (registration), reset_password (password reset)
}

Response ​

json
{
  "success": true
}

Register POST <base_url>/api/v1/auth/register ​

Request Body ​

json
{
  "email": "[email protected]",
  "password": "password",
  "email_code": "123456",      // optional, required when the site enables email verification
  "invite_code": "abcd"        // optional, required when the site requires an invite code
}

Response ​

json
{
  "success": true,
  "data": {
    "access_token": "xxxxxxxx",       // login credential, sent in subsequent requests as Authorization: Bearer <access_token>
    "expires_at": 1796112000,         // credential expiry time
    "is_admin": false
  }
}

Log In POST <base_url>/api/v1/auth/login ​

Request Body ​

json
{
  "email": "[email protected]",
  "password": "password"
}

Response ​

json
{
  "success": true,
  "data": {
    "access_token": "xxxxxxxx",
    "expires_at": 1796112000,
    "is_admin": false
  }
}

Reset Password POST <base_url>/api/v1/auth/reset_password ​

After a successful reset, all logged-in devices of the account must log in again

Request Body ​

json
{
  "email": "[email protected]",
  "email_code": "123456",
  "password": "new_password"
}

Response ​

json
{
  "success": true
}

Log Out POST <base_url>/api/v1/auth/logout ​

Invalidates the current access_token

Response ​

json
{
  "success": true
}

Account ​

All endpoints below require login

Get User Info GET <base_url>/api/v1/me ​

Response ​

json
{
  "success": true,
  "data": {
    "email": "[email protected]",
    "avatar_url": "https://www.website.com/avatar.png",   // may be null
    "balance": 1000,                                      // balance
    "commission_balance": 500,                            // available commission
    "discount": 90,                                       // user-specific discount percentage, null means none
    "commission_rate": 10,                                // user-specific commission rate percentage, null means the site default is used
    "remind_expire": true,                                // expiry reminder
    "remind_traffic": true,                               // traffic reminder
    "telegram_id": 123456,                                // bound Telegram id, null if not bound
    "created_at": 1700000000,
    "last_login_at": 1764547200
  }
}

Update Reminder Settings POST <base_url>/api/v1/me/update ​

Request Body ​

json
{
  "remind_expire": true,        // optional, omitted means unchanged
  "remind_traffic": false       // optional, omitted means unchanged
}

Response ​

json
{
  "success": true
}

Get Pending Counts GET <base_url>/api/v1/me/stat ​

Response ​

json
{
  "success": true,
  "data": {
    "pending_orders": 1,        // number of orders awaiting payment
    "open_tickets": 0,          // number of open tickets
    "invited_users": 5          // number of invited users
  }
}

Change Password POST <base_url>/api/v1/me/change_password ​

After a successful change, other logged-in devices must log in again

Request Body ​

json
{
  "old_password": "password",
  "new_password": "new_password"
}

Response ​

json
{
  "success": true
}

Get Web Auto-Login Link POST <base_url>/api/v1/me/web_login_url ​

Request Body ​

json
{
  "redirect": "plan"            // optional, web panel path to redirect to after login, defaults to the home page
}

Response ​

json
{
  "success": true,
  "data": {
    "url": "https://www.website.com/#/login?verify=xxxx",    // one-time link, valid for 60 seconds
    "expires_at": 1764547260
  }
}

Get Logged-in Devices GET <base_url>/api/v1/me/sessions ​

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": "a1b2c3",                           // session id
      "ip": "1.2.3.4",                          // may be null
      "user_agent": "soga-client/1.2.0 (windows)",  // may be null
      "login_at": 1764547200,
      "last_used_at": 1764550800,               // may be null
      "is_current": true                        // is the current device
    }
  ]
}

Remove Logged-in Device POST <base_url>/api/v1/me/session/remove ​

Request Body ​

json
{
  "id": "a1b2c3"
}

Response ​

json
{
  "success": true
}

Unbind Telegram POST <base_url>/api/v1/me/telegram/unbind ​

Response ​

json
{
  "success": true
}

Subscription ​

All endpoints below require login

Get Subscription Info GET <base_url>/api/v1/subscription ​

Response ​

json
{
  "success": true,
  "data": {
    "plan": {                                     // current plan, null if not purchased
      "id": 1,
      "name": "Annual Plan"
    },
    "upload": 1073741824,                         // upload traffic used in the current period, in bytes
    "download": 5368709120,                       // download traffic used in the current period, in bytes
    "transfer_enable": 107374182400,              // traffic quota, in bytes
    "expired_at": 1811808000,                     // expiry time, null means it never expires
    "is_expired": false,                          // expired or never purchased
    "next_reset_at": 1767225600,                  // next traffic reset time, null means no reset
    "device_limit": 3,                            // device limit, null means unlimited
    "speed_limit": null,                          // speed limit in Mbps, null means unlimited
    "alive_ip": 1,                                // number of devices currently online, may be null
    "subscribe_url": "https://sub.website.com/s/xxxx",
    "can_new_period": false                       // a new period can be started early
  }
}

Reset Subscription URL POST <base_url>/api/v1/subscription/reset ​

Resets the subscription URL and node credentials. The old subscription URL becomes invalid immediately

Response ​

json
{
  "success": true,
  "data": {
    "subscribe_url": "https://sub.website.com/s/yyyy"     // new subscription URL
  }
}

Start a New Period Early POST <base_url>/api/v1/subscription/new_period ​

When traffic is used up, resets the used traffic to zero and moves the expiry time earlier by one traffic reset period. Available only when can_new_period is true

Response ​

json
{
  "success": true
}

Get Subscription Content GET <subscribe_url> ​

For import by other clients, Authorization is not required; the soga client gets nodes through /servers and does not request the subscription URL

Request Parameters ​

flag=sing-box/1.12.0        // config format, options: general clash-meta sing-box, sing-box may include the core version

Response ​

Config text in the corresponding format. The response headers must include

subscription-userinfo: upload=1073741824; download=5368709120; total=107374182400; expire=1811808000

When the subscription is unavailable (not purchased, expired or banned), return

json
{
  "success": false,
  "error": {
    "message": "Subscription expired"
  }
}

Get Traffic Logs GET <base_url>/api/v1/traffic_logs ​

Returns the daily traffic records of the current month, in descending date order

Response ​

json
{
  "success": true,
  "data": [
    {
      "record_at": 1764547200,      // 00:00 of that day
      "upload": 10485760,           // upload traffic, in bytes
      "download": 524288000,        // download traffic, in bytes
      "rate": 1.5                   // node multiplier, traffic counted against the quota = (upload + download) × rate
    }
  ]
}

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

Returns the connection config and routing rules of the nodes, see the soga-client-v1 Node API Documentation

Orders ​

All endpoints below require login

Purchase flow: get the plan list → create an order → pay for the order → poll the order details until the status is neither pending nor processing

Check Coupon POST <base_url>/api/v1/coupon/check ​

Request Body ​

json
{
  "code": "NEWUSER",
  "plan_id": 1,
  "period": "year"
}

Response ​

json
{
  "success": true,
  "data": {
    "name": "10% Off for New Users",
    "type": "percent",          // options: amount (fixed amount off), percent (percentage off)
    "value": 10                 // an amount when type is amount, a percentage when type is percent
  }
}

Create Order POST <base_url>/api/v1/order/create ​

Request Body ​

json
{
  "plan_id": 1,
  "period": "year",
  "coupon_code": "NEWUSER"      // optional
}

Response ​

json
{
  "success": true,
  "data": {
    "trade_no": "2026120108300012345"     // order number
  }
}

Create Top-up Order POST <base_url>/api/v1/order/deposit ​

Available when features.deposit is true

Request Body ​

json
{
  "amount": 10000               // top-up amount
}

Response ​

json
{
  "success": true,
  "data": {
    "trade_no": "2026120108300012346"
  }
}

Get Order List GET <base_url>/api/v1/orders ​

Request Parameters ​

status=pending              // optional, options: pending processing completed cancelled
page=1
page_size=20

Response ​

json
{
  "success": true,
  "data": [
    // same as the order details
  ],
  "pagination": {
    "page": 1,
    "page_size": 20,
    "total": 3
  }
}

Get Order Details GET <base_url>/api/v1/order ​

Request Parameters ​

trade_no=2026120108300012345

Response ​

json
{
  "success": true,
  "data": {
    "trade_no": "2026120108300012345",
    "plan": {                       // null for top-up orders
      "id": 1,
      "name": "Annual Plan"
    },
    "period": "year",               // null for top-up orders
    "status": "pending",            // options: pending (awaiting payment), processing (activating), completed (completed), cancelled (cancelled), discounted (credited toward a new order)
    "total_amount": 13500,          // amount payable
    "discount_amount": 1500,        // discount amount
    "surplus_amount": 0,            // amount credited from the old subscription
    "balance_amount": 0,            // amount paid from balance
    "handling_amount": 0,           // payment handling fee
    "created_at": 1764547200,
    "paid_at": null
  }
}

Cancel Order POST <base_url>/api/v1/order/cancel ​

Request Body ​

json
{
  "trade_no": "2026120108300012345"
}

Response ​

json
{
  "success": true
}

Get Payment Methods GET <base_url>/api/v1/payment_methods ​

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Alipay",
      "icon": "https://www.website.com/alipay.png",   // may be null
      "handling_fee_fixed": 0,                        // fixed handling fee
      "handling_fee_percent": 0,                      // percentage handling fee
      "stripe_public_key": null                       // public key for Stripe credit card payment, null for other payment methods
    }
  ]
}

Pay for Order POST <base_url>/api/v1/order/checkout ​

Request Body ​

json
{
  "trade_no": "2026120108300012345",
  "method": 1,                  // payment method id, optional when the amount payable is 0
  "stripe_token": "tok_xxx"     // optional, required for Stripe credit card payment
}

Response ​

json
{
  "success": true,
  "data": {
    "type": "redirect",                          // options: paid (already paid, no redirect needed), qrcode (show a QR code), redirect (open the link)
    "url": "https://pay.website.com/xxxx"        // null when type is paid
  }
}

Gift Cards ​

All endpoints below require login

Preview Gift Card POST <base_url>/api/v1/gift_card/check ​

Available when features.gift_card_preview is true

Request Body ​

json
{
  "code": "GIFT-XXXX-XXXX"
}

Response ​

json
{
  "success": true,
  "data": {
    "name": "30-Day Trial Card",
    "description": "Adds 30 days of validity",    // may be null
    "can_redeem": true,                           // whether the current account can redeem it
    "reason": null,                               // reason it cannot be redeemed
    "balance": null,                              // balance reward
    "transfer_enable": null,                      // traffic reward, in bytes
    "expire_days": 30,                            // days of validity added
    "device_limit": null,                         // number of devices added
    "plan_name": null,                            // name of the plan activated
    "plan_days": null,                            // number of days of the plan activated
    "reset_traffic": false                        // reset used traffic to zero
  }
}

Redeem Gift Card POST <base_url>/api/v1/gift_card/redeem ​

Request Body ​

json
{
  "code": "GIFT-XXXX-XXXX"
}

Response ​

json
{
  "success": true
}

Get Redemption History GET <base_url>/api/v1/gift_card/history ​

Available when features.gift_card_preview is true

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "code": "GIFT-****-XXXX",     // partially masked redemption code
      "name": "30-Day Trial Card",
      "created_at": 1764547200
    }
  ]
}

Referrals ​

All endpoints below require login

Get Referral Info GET <base_url>/api/v1/invite ​

Response ​

json
{
  "success": true,
  "data": {
    "codes": [                          // unused invite codes
      {
        "code": "abcd",
        "pv": 12,                       // number of visits
        "created_at": 1764547200
      }
    ],
    "invited_users": 5,                 // number of invited users
    "commission_rate": 10,              // commission rate, in percent
    "total_commission": 3000,           // total commission earned
    "pending_commission": 500,          // commission pending confirmation
    "available_commission": 2500        // available commission
  }
}

Generate Invite Code POST <base_url>/api/v1/invite/create ​

Response ​

json
{
  "success": true
}

Get Commission Records GET <base_url>/api/v1/invite/commissions ​

Request Parameters ​

page=1
page_size=20

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "trade_no": "2026120108300012345",
      "order_amount": 15000,          // order amount
      "get_amount": 1500,             // commission earned
      "created_at": 1764547200
    }
  ],
  "pagination": {
    "page": 1,
    "page_size": 20,
    "total": 1
  }
}

Transfer Commission to Balance POST <base_url>/api/v1/invite/transfer ​

Request Body ​

json
{
  "amount": 1000                  // amount to transfer
}

Response ​

json
{
  "success": true
}

Request Withdrawal POST <base_url>/api/v1/invite/withdraw ​

Withdraws all available commission. The panel creates a ticket that is processed manually

Request Body ​

json
{
  "method": "Alipay",              // taken from commission.withdraw_methods in the site config
  "account": "[email protected]"     // receiving account
}

Response ​

json
{
  "success": true
}

Announcements and Knowledge Base ​

All endpoints below require login

Get Announcements GET <base_url>/api/v1/notices ​

Request Parameters ​

page=1
page_size=20

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "title": "System Maintenance Notice",
      "content": "<p>Maintenance tonight at 22:00</p>",     // HTML
      "img_url": null,
      "created_at": 1764547200
    }
  ],
  "pagination": {
    "page": 1,
    "page_size": 20,
    "total": 1
  }
}

Get Knowledge Base GET <base_url>/api/v1/knowledge ​

Returns the article index in the current language, grouped by category, without the body text

Request Parameters ​

keyword=windows             // optional, searches titles and body text

Response ​

json
{
  "success": true,
  "data": [
    {
      "category": "Tutorials",
      "articles": [
        {
          "id": 1,
          "title": "Windows Tutorial",
          "updated_at": 1764547200
        }
      ]
    }
  ]
}

Get Knowledge Base Article GET <base_url>/api/v1/knowledge/article ​

Request Parameters ​

id=1

Response ​

json
{
  "success": true,
  "data": {
    "id": 1,
    "category": "Tutorials",
    "title": "Windows Tutorial",
    "body": "<p>After downloading the client...</p>",     // HTML
    "updated_at": 1764547200
  }
}

Tickets ​

All endpoints below require login

Get Ticket List GET <base_url>/api/v1/tickets ​

Request Parameters ​

page=1
page_size=20

Response ​

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "subject": "Cannot connect",
      "level": 1,                   // 0 low, 1 medium, 2 high
      "is_closed": false,
      "is_replied": true,           // support has replied
      "created_at": 1764547200,
      "updated_at": 1764550800
    }
  ],
  "pagination": {
    "page": 1,
    "page_size": 20,
    "total": 1
  }
}

Get Ticket Details GET <base_url>/api/v1/ticket ​

Request Parameters ​

id=1

Response ​

json
{
  "success": true,
  "data": {
    "id": 1,
    "subject": "Cannot connect",
    "level": 1,
    "is_closed": false,
    "is_replied": true,
    "created_at": 1764547200,
    "updated_at": 1764550800,
    "messages": [                   // in ascending time order
      {
        "id": 1,
        "is_me": true,              // true if sent by the user, false if sent by support
        "message": "I cannot connect to any node",
        "created_at": 1764547200
      },
      {
        "id": 2,
        "is_me": false,
        "message": "Please update your subscription and try again",
        "created_at": 1764550800
      }
    ]
  }
}

Create Ticket POST <base_url>/api/v1/ticket/create ​

Request Body ​

json
{
  "subject": "Cannot connect",
  "level": 1,                       // 0 low, 1 medium, 2 high
  "message": "I cannot connect to any node"
}

Response ​

json
{
  "success": true,
  "data": {
    "id": 1                         // ticket id
  }
}

Reply to Ticket POST <base_url>/api/v1/ticket/reply ​

Request Body ​

json
{
  "id": 1,
  "message": "I have updated it, but it still does not work"
}

Response ​

json
{
  "success": true
}

Close Ticket POST <base_url>/api/v1/ticket/close ​

Request Body ​

json
{
  "id": 1
}

Response ​

json
{
  "success": true
}