API Use Cases
Real end-to-end scenarios that combine services, call detail records and routing into working automations.
Have a scenario you'd like help wiring up?
Log in to the ConsoleThis page brings the individual endpoints together into complete workflows. If you need a refresher on any building block, see Your services, Call detail records, Read call routing, Manage forwarding and Call recording.
1. Billing reconciliation
A monthly job that verifies your invoice against the raw call data.
const token = "st_your_token_here";
const base = "https://api.simpletelecom.com.au/v1";
const auth = { headers: { Authorization: `Bearer ${token}` } };
async function pullAll(params) {
const url = new URL(`${base}/api/cdrs`);
Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
let page = 1, all = [];
while (true) {
url.searchParams.set("page", page);
const { data, meta } = await fetch(url, auth).then(r => r.json());
all.push(...data);
if (page >= meta.total_pages) break;
page += 1;
}
return all;
}
// Sum every call for the number for the month.
const cdrs = await pullAll({
service_number: "1300858751",
start_date: "2026-07-01",
end_date: "2026-07-31",
page_size: 100,
});
const total = cdrs.reduce((sum, c) => sum + parseFloat(c.cost), 0);
console.log(`Reconciled: ${cdrs.length} calls, charged $${total.toFixed(2)}`);
The pattern: paginate the full month (GET /api/cdrs), sum cost as a decimal, and compare to your invoice total for that service_number.
2. After-hours routing switch
A scheduled job that repoints numbers to an on-call mobile after hours, and back during business hours.
const token = "st_your_token_here";
const base = "https://api.simpletelecom.com.au/v1";
const auth = { headers: { Authorization: `Bearer ${token}` } };
async function setDestination(serviceId, phoneNumber, displayName) {
const { forwarding_numbers } =
await fetch(`${base}/api/services/${serviceId}/routing`, auth).then(r => r.json());
for (const fwd of forwarding_numbers) {
await fetch(`${base}/api/services/${serviceId}/routing/forwarding`, {
method: "PUT",
headers: { ...auth.headers, "Content-Type": "application/json" },
body: JSON.stringify({
current_phone_number: fwd.phone_number,
phone_number: phoneNumber,
display_name: displayName,
}),
});
}
console.log(`Service ${serviceId} now forwards to ${phoneNumber}`);
}
// Business hours: phones forward to the office.
await setDestination(123, "0298765432", "Office");
The pattern: read the current routing, then PUT each forwarding destination. Pair this with your after-hours calendar.
3. Call-volume dashboard
A live view of how a marketing campaign is performing across your 1300 / Line Hunt numbers.
const token = "st_your_token_here";
const base = "https://api.simpletelecom.com.au/v1";
const auth = { headers: { Authorization: `Bearer ${token}` } };
// Pull all services and bucket call volume per number.
const { data: services } = await fetch(`${base}/api/services`, auth).then(r => r.json());
const counts = [];
for (const svc of services) {
const res = await fetch(
`${base}/api/cdrs?service_number=${svc.service_number}&start_date=2026-07-01&end_date=2026-07-31&page_size=1`,
auth
).then(r => r.json());
counts.push({ number: svc.service_number, calls: res.meta.total_records });
}
counts.sort((a, b) => b.calls - a.calls);
counts.forEach(c => console.log(`${c.number}: ${c.calls} calls`));
The pattern: iterate your services, use the CDR meta.total_records to get call counts without paginating every record.
4. CRM call logging
Log each inbound call into your CRM so your sales team has a full call history beside every lead.
const token = "st_your_token_here";
const base = "https://api.simpletelecom.com.au/v1";
const auth = { headers: { Authorization: `Bearer ${token}` } };
const params = new URLSearchParams({
service_number: "1300858751",
start_date: "2026-07-28",
end_date: "2026-07-28",
order: "asc",
});
const { data } = await fetch(`${base}/api/cdrs?${params}`, auth).then(r => r.json());
// For each inbound call, find the contact by caller ID and append a note.
for (const cdr of data.reverse()) {
const contact = await findContactByPhone(cdr.source_number);
if (contact) {
await crm.note(contact.id,
`Inbound call ${cdr.duration_sec}s on ${cdr.service_number} — cost $${cdr.cost}`);
}
}
The pattern: batch pull the day's CDRs, match source_number to your CRM contacts, and write a note per call.
5. Combined: compliance recording policy
Ensure call recording is switched on across every voice service at the start of the month.
const token = "st_your_token_here";
const base = "https://api.simpletelecom.com.au/v1";
const auth = { headers: { Authorization: `Bearer ${token}` } };
const { data: services } = await fetch(`${base}/api/services`, auth).then(r => r.json());
for (const svc of services) {
await fetch(`${base}/api/services/${svc.service_id}/routing/recording`, {
method: "PUT",
headers: { ...auth.headers, "Content-Type": "application/json" },
body: JSON.stringify({ enabled: true }),
});
console.log(`Recording enabled on ${svc.service_number}`);
}
The pattern: list services, then set enabled: true on each — see Call recording.
Picking the right starting point
| I want to… | Start here | |---|---| | Verify what I'm billed | Call detail records | | Repoint numbers automatically | Manage forwarding | | Monitor marketing demand | Call detail records + Your services | | Meet compliance requirements | Call recording | | Make it reliable under load | Error handling |
