SDKs
Official OpenRoam client libraries for eight languages, generated from the API specification.
Private beta
The SDKs are in private beta and not on public package registries yet. OpenRoam sends you the release files to install. Before version 1.0 the API of the clients can change between minor versions.
OpenRoam publishes one client library per language, all generated from the same OpenAPI specification and released together under one version number.
| Language | Package |
|---|---|
| TypeScript and JavaScript | @openroam/sdk |
| Python | openroam |
| Go | github.com/OpenRoamHQ/openroam-go |
| PHP | openroam/sdk |
| Java | com.openroam:openroam-sdk |
| .NET | OpenRoam |
| Dart | openroam |
| Ruby | openroam |
Every SDK:
- names the Sandbox and Production environments and accepts any other base URL;
- sends your key in
X-Partner-Key; - creates an
Idempotency-Keyfor each order and lets you pass your own; - raises one error type with the API's
code,name,message,requestIdanddetails; - has an opt-in retry layer for network errors,
429and502,503and504, which repeats purchases with the sameIdempotency-Key; - includes a helper that verifies webhook signatures.
TypeScript example
import { OpenRoam, OpenRoamError } from '@openroam/sdk';
const openroam = new OpenRoam({
apiKey: process.env.OPENROAM_API_KEY,
environment: 'sandbox', // the default is 'production'
});
const found = await openroam.esims.search({ countryCode: 'JP' });
const offer = found.items[0]?.offers[0];
if (offer) {
const items = [{ publicId: offer.publicId, quantity: 1, inputs: {} }];
const quote = await openroam.esims.quote({ currency: 'USD', items });
try {
const order = await openroam.esims.order(
{ currency: 'USD', items },
{ idempotencyKey: myPurchaseId }, // a UUID you stored for this purchase
);
console.log(order.id, order.status, quote.total);
} catch (error) {
if (error instanceof OpenRoamError && error.code === 16000) {
// The wallet could not pay: top up, then repeat with the same idempotency key.
}
throw error;
}
}Each product is a property of the client: esims, airtime, utilities, giftCards, hotels and flights, plus orders, orderItems, wallets, account, currencies, countries and mobileNetworks. Buying is always search, quote, order.
Each SDK's README covers installation and its own examples.