Sync your SIM list
If your own system (a fleet platform, a CRM, a billing system) keeps a list of SIMs, here's how to keep it in step with Axis without hammering the API.
A full sync once a day catches everything, and webhooks keep you current in between.
Full sync: page through every SIM
Ask for 100 at a time and keep going while pagination.hasMore is true. A few thousand SIMs takes a few dozen
requests, comfortably within the rate limit.
- Node.js
- Python
- C#
async function* allSims() {
for (let page = 1; ; page++) {
const res = await fetch(`https://app.zentarinetworks.com/api/v1/sims?pageSize=100&page=${page}`, {
headers: { Authorization: `Bearer ${process.env.AXIS_API_KEY}` },
});
if (!res.ok) throw new Error(`Axis said ${res.status}: ${(await res.json()).detail}`);
const { data, pagination } = await res.json();
yield* data;
if (!pagination.hasMore) return;
}
}
for await (const sim of allSims()) {
await db.upsertSim(sim.id, sim); // your code
}
def all_sims():
page = 1
while True:
res = requests.get(
"https://app.zentarinetworks.com/api/v1/sims",
params={"pageSize": 100, "page": page},
headers={"Authorization": f"Bearer {os.environ['AXIS_API_KEY']}"},
)
res.raise_for_status()
body = res.json()
yield from body["data"]
if not body["pagination"]["hasMore"]:
return
page += 1
for sim in all_sims():
db.upsert_sim(sim["id"], sim) # your code
async IAsyncEnumerable<JsonElement> AllSimsAsync(HttpClient http)
{
for (var page = 1; ; page++)
{
var body = await http.GetFromJsonAsync<JsonElement>($"sims?pageSize=100&page={page}");
foreach (var sim in body.GetProperty("data").EnumerateArray()) yield return sim;
if (!body.GetProperty("pagination").GetProperty("hasMore").GetBoolean()) yield break;
}
}
await foreach (var sim in AllSimsAsync(http))
{
await db.UpsertSimAsync(sim.GetProperty("id").GetInt64(), sim); // your code
}
Match on the SIM's id (it never changes). The iccid is also unique and is what's printed on the card. A SIM that
was in your copy but isn't returned any more has left your account.
:::tip Only need some?
Filters cut the work: ?poolId=7, ?status=suspended, ?type=digital, ?onPlan=false, or ?search= for an ICCID,
IMSI, phone number or tag.
:::
In between: react to webhooks
ticket.completed/ticket.failed: a SIM changed (status, plan, Fixed Public IP). Fetch it again withGET /sims/{simId}.watchdog.*: usage passed a rule; the payload carries the usage, so you may not need to fetch anything.order.updatedwith"status": "completed": new SIMs may have arrived. Run the full sync, or fetchGET /sims?onPlan=false.
Looking a SIM up
The activity log
For an audit trail of what happened on the account (who changed what, tickets raised and finished, billing, the Watchdog), read the event log. It's the same as the portal's Events page.
Newest first; filter with type (sim, pool, billing, user, account, system, watchdog), severity
(success, info, warning, danger), date (yyyy-MM-dd) and search.