Order port
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.ltesocks.io/v2/ports/order");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Authorization: Bearer <token>");headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"plan\": \"5349b4ddd2781d08c09890f3\", \"tarification\": { \"time\": 2592000, \"traffic\": 51200, \"price\": 14500 } }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.ltesocks.io/v2/ports/order"), Headers = { { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"plan\": \"5349b4ddd2781d08c09890f3\", \"tarification\": { \"time\": 2592000, \"traffic\": 51200, \"price\": 14500 } }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.ltesocks.io/v2/ports/order"
payload := strings.NewReader("{ \"plan\": \"5349b4ddd2781d08c09890f3\", \"tarification\": { \"time\": 2592000, \"traffic\": 51200, \"price\": 14500 } }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ltesocks.io/v2/ports/order")) .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"plan\": \"5349b4ddd2781d08c09890f3\", \"tarification\": { \"time\": 2592000, \"traffic\": 51200, \"price\": 14500 } }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"plan\": \"5349b4ddd2781d08c09890f3\", \"tarification\": { \"time\": 2592000, \"traffic\": 51200, \"price\": 14500 } }");Request request = new Request.Builder() .url("https://api.ltesocks.io/v2/ports/order") .post(body) .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'POST', url: 'https://api.ltesocks.io/v2/ports/order', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, data: { plan: '5349b4ddd2781d08c09890f3', tarification: {time: 2592000, traffic: 51200, price: 14500} }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.ltesocks.io/v2/ports/order';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"plan":"5349b4ddd2781d08c09890f3","tarification":{"time":2592000,"traffic":51200,"price":14500}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"plan\": \"5349b4ddd2781d08c09890f3\", \"tarification\": { \"time\": 2592000, \"traffic\": 51200, \"price\": 14500 } }")val request = Request.Builder() .url("https://api.ltesocks.io/v2/ports/order") .post(body) .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.ltesocks.io/v2/ports/order";
let payload = json!({ "plan": "5349b4ddd2781d08c09890f3", "tarification": json!({ "time": 2592000, "traffic": 51200, "price": 14500 }) });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Authorization", "Bearer <token>".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.post(url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request POST \ --url https://api.ltesocks.io/v2/ports/order \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "plan": "5349b4ddd2781d08c09890f3", "tarification": { "time": 2592000, "traffic": 51200, "price": 14500 } }'wget --quiet \ --method POST \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --body-data '{ "plan": "5349b4ddd2781d08c09890f3", "tarification": { "time": 2592000, "traffic": 51200, "price": 14500 } }' \ --output-document \ - https://api.ltesocks.io/v2/ports/orderLegacy JSON and HTTP statuses are preserved, including error objects and HTTP 500 for insufficient balance and validation failures. Idempotency uses the configured TTL and lock timeout; server errors are not cached by default. Optional X-LTESocks-Order-State is not-created, created, or unknown. Only not-created proves that this attempt did not create an order. A missing response or unknown state must not be treated as a safe retry. X-LTESocks-Error-Code can be priceChanged, insufficientBalance, validationFailed, unauthorized, forbidden, portDetailsUnavailable, upstreamError, or idempotencyConflict. These headers are additive and do not change the handling of another POST.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Optional UUID that identifies one mutation request. Reuse it only when retrying the same request.
Request Bodyrequired
Section titled “Request Bodyrequired”Plan parameters
object
Plan ID
Example
5349b4ddd2781d08c09890f3object
Plan duration time in seconds
Example
2592000Plan traffic amount in megabytes
Example
51200Plan price in cents
Example
14500Responses
Section titled “Responses”Successful operation
object
Port number
Port current IP address (0.0.0.0 if not available)
object
Port status
Current status
Port reset token
Port signature
Indicates whether port has access to the VPN server
Port auto reset interval in seconds, 0 means disabled
Port tags
object
Plan ID
Plan title
Plan country code
Indicates whether plan is active
Indicates whether plan auto renewal is active
Plan activation time
Plan expiration time
Remaining traffic amount in megabytes
object
Plan duration time in seconds
Plan traffic amount in megabytes
Plan price in cents
object
object
Example
{ "port": 10000, "ip": "1.1.1.1", "geoip": { "continentCode": "NA", "continentName": "North America", "countryCode2": "US", "countryCode3": "United States", "latitude": "38.89037", "longitude": "-77.03196", "isp": "T-Mobile USA, Inc." }, "status": "active", "currentStatus": "active", "resetToken": "6015510d206e4d7b023e5f978a56e3cf49d7e79bc26cf28c69b75314e098a61b", "signature": "Windows", "vpnAccess": true, "plan": { "id": "5349b4ddd2781d08c09890f3", "name": "UK Three", "countryCode": "UK", "enabled": true, "autoRenew": true, "activatedAt": "2022-04-02T05:57:29.054Z", "expiresAt": "2022-05-02T05:57:29.054Z", "trafficRemains": 51200, "tarification": { "time": 2592000, "traffic": 51200, "price": 14500 } }, "credentials": { "ip": [ "2.2.2.2" ], "password": [ { "login": "login", "password": "password" } ] }}Headers
Section titled “Headers”Unauthenticated (legacy error object).
object
Error text representation
Error code representation
Example
{ "error": "example error", "code": 400}Price changed; legacy error object without quote data. Reload plans before confirming again.
object
Error text representation
Error code representation
Example
{ "error": "example error", "code": 400}Headers
Section titled “Headers”Legacy error. Optional retry headers are preserved.
object
Error text representation
Error code representation
Example
{ "error": "example error", "code": 400}