SDK Quickstart
NestJS Module Quickstart
Install @khaleejiapi/nestjs, configure your API key, and make your first authenticated API call.
1) Install
bash
npm install @khaleejiapi/nestjs @nestjs/axios class-transformer class-validator2) Environment variable setup
bash
# .envKHALEEJI_API_KEY=your_api_key_here3) Minimal working example
typescript
import { Module } from '@nestjs/common';import { APP_FILTER } from '@nestjs/core';import { GccPhoneDto, KhaleejiApiExceptionFilter, KhaleejiApiModule, KhaleejiApiService,} from '@khaleejiapi/nestjs'; @Module({ imports: [ KhaleejiApiModule.registerAsync({ useFactory: async () => ({ apiKey: process.env.KHALEEJI_API_KEY!, timeout: 10_000, maxRateLimitRetries: 3, }), }), ], providers: [ { provide: APP_FILTER, useClass: KhaleejiApiExceptionFilter, }, ],})export class AppModule {} export class ValidatePhoneRequestDto extends GccPhoneDto {} export class ValidationService { constructor(private readonly khaleejiApi: KhaleejiApiService) {} async validatePhone(dto: ValidatePhoneRequestDto) { return this.khaleejiApi.validateGccPhone(dto.phone); }}Next steps
Test your key with a real endpoint from the API reference.
Use retries/rate-limit handling for production workloads.
Review authentication and rate limits before going live.