API Reference
SDKs & Libraries
What we do and do not publish, and how to generate a client.
We do not currently publish official SDKs for any language. Rather than list packages that do not exist, this page shows how to work with the API directly — which is all an SDK would be doing.
Generate a client from the spec
The API serves an OpenAPI 3.1 document, so you can generate a typed client for most languages:
curl -o silux-openapi.json https://www.siluxcall.co.uk/api/openapi.json
npx @openapitools/openapi-generator-cli generate \
-i silux-openapi.json \
-g typescript-fetch \
-o ./silux-clientA generated client stays closer to the deployed API than a hand-written wrapper, and regenerating picks up changes.
Node.js
const BASE = 'https://www.siluxcall.co.uk/api';
async function silux(path, options = {}) {
const res = await fetch(BASE + path, {
...options,
headers: {
'Authorization': `Bearer ${process.env.SILUX_API_KEY}`,
'Content-Type': 'application/json',
...options.headers,
},
});
if (!res.ok) {
throw new Error(`Silux API ${res.status}: ${await res.text()}`);
}
return res.json();
}
// Recent calls
const calls = await silux('/cdr?limit=50');
// Place a call
await silux('/softphone/originate', {
method: 'POST',
body: JSON.stringify({ to: '+447700900123' }),
});Python
import os
import requests
BASE = "https://www.siluxcall.co.uk/api"
SESSION = requests.Session()
SESSION.headers.update({
"Authorization": f"Bearer {os.environ['SILUX_API_KEY']}",
"Content-Type": "application/json",
})
def silux(path, method="GET", **kwargs):
res = SESSION.request(method, BASE + path, timeout=30, **kwargs)
res.raise_for_status()
return res.json()
calls = silux("/cdr", params={"limit": 50})
silux("/softphone/originate", "POST", json={"to": "+447700900123"})PHP
<?php
function silux(string $path, string $method = 'GET', ?array $body = null): array {
$ch = curl_init('https://www.siluxcall.co.uk/api' . $path);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SILUX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body ? json_encode($body) : null,
]);
$out = curl_exec($ch);
curl_close($ch);
return json_decode($out, true);
}
$calls = silux('/cdr?limit=50');Practical advice
- •Keep the key in an environment variable or secrets manager, never in source
- •Set a request timeout — the default in several HTTP clients is no timeout at all
- •Retry 5xx responses with backoff; do not retry 4xx, which will fail identically
- •Log the response body on failure, since the message explains the cause