Skip to content

Responses and errors

Most successful operations return a JSON object directly. List operations typically use:

{
"data": [],
"page": 1,
"pageSize": 20,
"total": 0
}

VPN configuration operations return an archive rather than JSON. Inspect Content-Type before parsing the body.

Documented failures use an object with an error string:

{
"error": "Human-readable error message"
}

Your client should preserve the HTTP status, request context, and safe response metadata. Do not log the bearer token or proxy password.

Official SDKs normalize these details into a language-specific API error:

import { ApiError } from '@ltesocks/sdk';
try {
await client.ports.get({ id: '10000' });
} catch (error) {
if (error instanceof ApiError) {
console.error(error.statusCode, error.kind, error.detail);
console.error(error.retryAfter, error.retryAt);
}
}
StatusMeaningRecommended action
400 / 422Invalid inputFix the request; do not retry unchanged
401Authentication failedReplace or rotate the token
404Resource not foundVerify the account-scoped identifier
429Rate limit exceededBack off and retry with jitter
5xxService or downstream failureRetry safe operations with bounded backoff and jitter

For a documented mutation that accepts Idempotency-Key, retry an unknown outcome with the same key. If the API returned a definite validation, authentication, or cooldown error, handle that result before sending another request. Read the resulting resource when possible.

See Idempotency and safe retries for the supported operations and decision table. Reset cooldown headers are explained in Port reset and readiness.