Skip to main content

Inventory API

Overview

The Inventory API provides functionalities for managing and retrieving inventories and eSIMs, including pagination and filtering capabilities.

getInventories

This method returns a paginated list of all inventories with optional company filtering.

Parameters

  • count (optional): Number of items to return (defaults to 100)
  • offset (optional): Number of items to skip (defaults to 0)
  • company (optional): Filter by company ID

Return Type:

  • GetInventoriesResponse

Authorization:

  • Requires ApiUserId and ApiKeyAuth

Example

Here's how to use the Inventory API to fetch inventories:

import { InventoryApi, Configuration } from '@betatelltd/esim-sdk';

const config = new Configuration({
apiKey: (name: string) => {
if (name === 'x-api-key') return 'your-api-key';
if (name === 'x-user-id') return 'your-user-id';
return '';
},
basePath: 'base-url',
});
const apiInstance = new InventoryApi(configuration);

let count: number; // Number of items to return (optional) (default to 100)
let offset: number; // Number of items to skip (optional) (default to 0)
let company: number; // Filter by company ID (optional) (optional) (default to undefined)

const { status, data } = await apiInstance.getInventories(
count,
offset,
company
);

Response Codes

  • 200: Success
  • 400: Bad Request - Invalid parameters
  • 401: Unauthorized - Invalid or missing API key
  • 500: Internal Server Error

GetInventoriesResponse

The GetInventoriesResponse object contains the following properties:

NameTypeDescriptionNotes
totalnumberTotal number of inventories available in the system[default to undefined]
countnumberNumber of inventories returned in this response[default to undefined]
offsetnumberNumber of inventories skipped[default to undefined]
inventoriesInventory[]Array of inventory objects[default to undefined]

Example

import { GetInventoriesResponse } from '@betatelltd/esim-sdk';

const instance: GetInventoriesResponse = {
total,
count,
offset,
inventories,
};

getESIMs

This method returns a paginated list of all eSIMs with optional filtering by company and inventory.

Parameters

  • count (optional): Number of items to return (defaults to 100)
  • offset (optional): Number of items to skip (defaults to 0)
  • company (optional): Filter by company ID
  • inventory (optional): Filter by inventory ID

Return Type:

  • GetESIMsResponse

Authorization:

  • Requires ApiUserId and ApiKeyAuth

Example

Here's how to use the Inventory API to fetch eSIMs:

import { InventoryApi, Configuration } from '@betatelltd/esim-sdk';

const config = new Configuration({
apiKey: (name: string) => {
if (name === 'x-api-key') return 'your-api-key';
if (name === 'x-user-id') return 'your-user-id';
return '';
},
basePath: 'base-url',
});
const apiInstance = new InventoryApi(configuration);

let count: number; // Number of items to return (optional) (default to 100)
let offset: number; // Number of items to skip (optional) (default to 0)
let group: number; // Filter by group ID (optional) (optional) (default to undefined)
let inventory: number; // Filter by inventory ID (optional) (optional) (default to undefined)

const { status, data } = await apiInstance.getESIMs(
count,
offset,
group,
inventory
);

Response Codes

  • 200: Success
  • 400: Bad Request - Invalid parameters
  • 401: Unauthorized - Invalid or missing API key
  • 500: Internal Server Error

GetESIMsResponse

The GetESIMsResponse object contains the following properties:

NameTypeDescriptionNotes
totalnumberTotal number of eSIMs available in the system[default to undefined]
countnumberNumber of eSIMs returned in this response[default to undefined]
offsetnumberNumber of eSIMs skipped[default to undefined]
simsESIM[]Array of eSIM objects[default to undefined]

Example

import { GetESIMsResponse } from '@betatelltd/esim-sdk';

const instance: GetESIMsResponse = {
total,
count,
offset,
sims,
};

getESIM

This method validates and returns detailed eSIM information for a specific ICCID.

Parameters

  • iccid (required): The ICCID of the eSIM (19-20 digits)

Return Type:

  • ESIM

Authorization:

  • Requires ApiUserId and ApiKeyAuth

Example

Here's how to use the Inventory API to fetch a specific eSIM:

import { InventoryApi, Configuration } from '@betatelltd/esim-sdk';

const config = new Configuration({
apiKey: (name: string) => {
if (name === 'x-api-key') return 'your-api-key';
if (name === 'x-user-id') return 'your-user-id';
return '';
},
basePath: 'base-url',
});
const apiInstance = new InventoryApi(configuration);

let iccid: string; // The ICCID of the eSIM (19-20 digits) (default to undefined)

const { status, data } = await apiInstance.getESIM(iccid);

Response Codes

  • 200: Success
  • 400: Bad Request - Invalid ICCID format
  • 401: Unauthorized - Invalid or missing API key
  • 404: Not Found - eSIM not found
  • 500: Internal Server Error