Read the current account
Section titled “Read the current account”GET
/userReturn the account associated with the tokenThe user model includes login, email, balance in cents, port usage and limit, discount percentage, and connection preferences.
curl "https://api.ltesocks.io/v2/user" \ -H "Authorization: Bearer ${LTESOCKS_API_TOKEN}"Official SDK
Section titled “Official SDK”import { LTESocksClient } from '@ltesocks/sdk';
const client = LTESocksClient.withBearerToken( process.env.LTESOCKS_API_TOKEN, { language: 'en' },);const user = await client.user.get();
console.log(user.login);import os
from ltesocks_sdk import Client
with Client.with_bearer_token( os.environ["LTESOCKS_API_TOKEN"], language="en",) as client: user = client.user.get() print(user.login)<?php
use LTESocks\Client;
require __DIR__ . '/vendor/autoload.php';
$client = Client::builder() ->withBearerToken((string) getenv('LTESOCKS_API_TOKEN')) ->withLanguage('en') ->build();$user = $client->user()->get();
echo $user->getLogin();Update defaults
Section titled “Update defaults”POST
/user/preferencesUpdate connection defaultsPreferences control the default VPN host, proxy host, and proxy protocol used by account tools:
{ "vpnServer": "vpn1.ltesocks.io", "proxyServer": "ap1.ltesocks.io", "proxyProtocol": "socks5"}Allowed proxy protocols in the v2 contract are http, https, and socks5. Obtain current hosts from GET /servers; do not assume the example hosts are available to every account.
Official SDK
Section titled “Official SDK”const user = await client.user.updatePreferences({ body: { vpnServer: 'vpn1.ltesocks.io', proxyServer: 'ap1.ltesocks.io', proxyProtocol: 'socks5', },});from ltesocks_sdk.models import ( UserPreferences, UserPreferencesProxyProtocol,)
user = client.user.update_preferences( body=UserPreferences( vpn_server="vpn1.ltesocks.io", proxy_server="ap1.ltesocks.io", proxy_protocol=UserPreferencesProxyProtocol.SOCKS5, ))<?php
use LTESocks\Dto\UserPreferences;
$user = $client->user()->updatePreferences(new UserPreferences([ 'vpnServer' => 'vpn1.ltesocks.io', 'proxyServer' => 'ap1.ltesocks.io', 'proxyProtocol' => 'socks5',]));The successful response is the updated user object. When updating preferences, send a complete set of values your integration intends to own and verify the returned object.