celitech-sdk
v2.0.10
Published
Welcome to the CELITECH API documentation! Useful links: [Homepage](https://www.celitech.com) | [Support email](mailto:[email protected]) | [Blog](https://www.celitech.com/blog/) # Introduction This is the reference documentation and schemas
Readme
Celitech TypeScript SDK 2.0.10
Welcome to the Celitech SDK documentation. This guide will help you get started with integrating and using the Celitech SDK in your project.
Versions
- API version:
2.0.10 - SDK version:
2.0.10
About the API
Welcome to the CELITECH API documentation!
Useful links: Homepage | Support email | Blog
Introduction
This is the reference documentation and schemas for the CELITECH API and webhooks. For tutorials and other documentation please refer to the CELITECH Documentation.
"Partners" refers to online service providers that use our eSIM API. Access levels include Gold, Platinum, and Diamond.
API
The CELITECH API is designed for use by partner platforms, including both web and mobile applications. It's assumed all endpoint calls are initiated from the backend of an integrated platform.
API URL: https://api.celitech.net/v1
Authentication & Authorization
CELITECH API uses the OAuth 2.0 protocol for authentication and authorization. The endpoints are protected using client credentials flow which is based on a token exchange. The token has a defined life span (typically 1 hour), after which a new token must be obtained.
To begin, obtain OAuth 2.0 client credentials ( CLIENT_ID & CLIENT_SECRET ) from the CELITECH Dashboard. Then your client application requests an access token from the CELITECH Authorization Server, extracts a token from the response, and sends the token to the CELITECH API that you want to access.
Security Scheme Type: OAuth2
Flow type: clientCredentials
Token URL: https://auth.celitech.net/oauth2/token
Table of Contents
Setup & Configuration
Supported Language Versions
This SDK is compatible with the following versions: TypeScript >= 4.8.4
Installation
To get started with the SDK, we recommend installing using npm or yarn:
npm install celitech-sdkor
yarn add celitech-sdkRuntime Compatibility
The SDK works in the following runtimes:
- Node.js 18+
- Vercel
- Cloudflare Workers
- Deno v1.25+
- Bun 1.0+
- React Native
Authentication
OAuth Authentication
The Celitech API uses OAuth 2.0 for authentication.
You need to provide your OAuth credentials when initializing the SDK. Tokens are automatically fetched, cached, and refreshed — you do not need to manage them yourself.
const sdk = new Celitech({ clientId: 'CLIENT_ID', clientSecret: 'CLIENT_SECRET' });If you need to set or update the OAuth credentials after the SDK initialization, you can use:
const sdk = new Celitech();
sdk.clientId = 'CLIENT_ID';
sdk.clientSecret = 'CLIENT_SECRET';Environment Variables
These are the environment variables for the SDK:
| Name | Description | | :------------ | :---------------------- | | CLIENT_ID | Client ID parameter | | CLIENT_SECRET | Client Secret parameter |
Environment variables are a way to configure your application outside the code. You can set these environment variables on the command line or use your project's existing tooling for managing environment variables.
If you are using a .env file, a template with the variable names is provided in the .env.example file located in the same directory as this README.
Setting a Custom Timeout
You can set a custom timeout for the SDK's HTTP requests as follows:
const celitech = new Celitech({ timeoutMs: 10000 });Sample Usage
Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:
import { Celitech } from 'celitech-sdk';
(async () => {
const celitech = new Celitech({
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
});
const data = await celitech.destinations.listDestinations();
console.log(data);
})();Services
The SDK provides various services to interact with the API.
| Name | | :------------------------------------------------------------------- | | DestinationsService | | PackagesService | | PurchasesService | | ESimService | | IFrameService |
Models
The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.
| Name | Description | | :------------------------------------------------------------------------------------------- | :---------- | | ListDestinationsOkResponse | | | ErrorResponse | | | ListPackagesOkResponse | | | ErrorResponse | | | CreatePurchaseV2OkResponse | | | CreatePurchaseV2Request | | | ErrorResponse | | | ListPurchasesOkResponse | | | CreatePurchaseOkResponse | | | CreatePurchaseRequest | | | TopUpEsimOkResponse | | | TopUpEsimRequest | | | EditPurchaseOkResponse | | | EditPurchaseRequest | | | GetPurchaseConsumptionOkResponse | | | GetEsimOkResponse | | | ErrorResponse | | | GetEsimDeviceOkResponse | | | GetEsimHistoryOkResponse | | | SuspendEsimOkResponse | | | TokenOkResponse | | | ErrorResponse | | | GrantType | |
License
This SDK is licensed under the MIT License.
See the LICENSE file for more details.
