SDKs & Libraries
Official SDKs and libraries to integrate KhaleejiAPI into your favorite programming language.
NestJS
Installation
npm install @khaleejiapi/nestjs @nestjs/axios class-transformer class-validatorEnvironment Variable Setup
# .envKHALEEJI_API_KEY=your_api_key_hereQuick Example
import { Module } from '@nestjs/common';import { APP_FILTER } from '@nestjs/core';import { KhaleejiApiExceptionFilter, KhaleejiApiModule,} from '@khaleejiapi/nestjs'; @Module({ imports: [ KhaleejiApiModule.registerAsync({ useFactory: async () => ({ apiKey: process.env.KHALEEJI_API_KEY!, maxRateLimitRetries: 3, }), }), ], providers: [ { provide: APP_FILTER, useClass: KhaleejiApiExceptionFilter, }, ],})export class AppModule {}JavaScript / TypeScript
Installation
npm install @khaleejiapi/sdkEnvironment Variable Setup
# .env (or .env.local in Next.js)KHALEEJI_API_KEY=your_api_key_hereQuick Example
import { KhaleejiAPI } from '@khaleejiapi/sdk'; const apiKey = process.env.KHALEEJI_API_KEY;if (!apiKey) throw new Error('Missing KHALEEJI_API_KEY environment variable. Get your key from https://khaleejiapi.dev/dashboard/api-keys'); const api = new KhaleejiAPI({ apiKey });const result = await api.validation.validateEmail({ email: '[email protected]' }); console.log(result.valid);React Hooks
Installation
npm install @khaleejiapi/react-hooksEnvironment Variable Setup
# Server-only environment variable; never expose it to the browserKHALEEJI_API_KEY=your_api_key_hereBefore using the client example, create an authenticated, rate-limited same-origin server route at /api/khaleejiapi/validate. Setting the environment variable does not create this route. Follow the Secure proxy setup instructions and keep your API key on the server.
Quick Example
'use client'; import { useGCCPhone } from '@khaleejiapi/react-hooks'; export function PhoneForm() { const phone = useGCCPhone(); return ( <form onSubmit={(event) => { event.preventDefault(); void phone.validate(); }}> <input value={phone.value} onChange={(event) => phone.setValue(event.currentTarget.value)} /> {phone.status === 'loading' && <span>Validating…</span>} {phone.status === 'error' && <span role="alert">{phone.error?.message}</span>} <button disabled={!phone.formatValid || phone.status === 'loading'}>Validate</button> </form> );}Python
Installation
pip install khaleejiapiEnvironment Variable Setup
# shell (add to ~/.bashrc or ~/.zshrc to persist)export KHALEEJI_API_KEY=your_api_key_here # .env option (with python-dotenv)KHALEEJI_API_KEY=your_api_key_hereQuick Example
from khaleejiapi import KhaleejiAPIimport os api_key = os.getenv("KHALEEJI_API_KEY")if not api_key: raise ValueError("Missing KHALEEJI_API_KEY environment variable. Get your key from https://khaleejiapi.dev/dashboard/api-keys") api = KhaleejiAPI(api_key=api_key)result = api.validation.validate_email("[email protected]") print(result["valid"])Go
Installation
go get github.com/xidioda/khaleejiapi-goEnvironment Variable Setup
# shellexport KHALEEJI_API_KEY=your_api_key_hereQuick Example
package main import ( "context" "fmt" "os" khaleeji "github.com/xidioda/khaleejiapi-go") func main() { apiKey := os.Getenv("KHALEEJI_API_KEY") if apiKey == "" { panic("Missing KHALEEJI_API_KEY. Get your key from https://khaleejiapi.dev/dashboard/api-keys") } client := khaleeji.New(apiKey) ctx := context.Background() result, err := client.Validation.ValidateEmail(ctx, "[email protected]") if err != nil { panic(err) } fmt.Println("Valid:", result.Valid)}Swift (iOS)
Installation
.package(url: "https://github.com/xidioda/khaleejiapi-swift.git", from: "1.0.0")Environment Variable Setup
# Xcode: Edit Scheme > Run > Arguments > Environment VariablesKHALEEJI_API_KEY=your_api_key_hereQuick Example
import KhaleejiAPI let apiKey = ProcessInfo.processInfo.environment["KHALEEJI_API_KEY"] ?? ""guard !apiKey.isEmpty else { fatalError("Missing KHALEEJI_API_KEY. Get your key from https://khaleejiapi.dev/dashboard/api-keys") } let api = KhaleejiAPI(apiKey: apiKey)let result = try await api.validation.validateEmail("[email protected]") print(result.valid)Kotlin (Android)
Installation
implementation("dev.khaleejiapi:khaleejiapi-sdk:1.0.0")Environment Variable Setup
# runtime environment (local dev / JVM)KHALEEJI_API_KEY=your_api_key_hereQuick Example
import dev.khaleejiapi.KhaleejiAPI val apiKey = System.getenv("KHALEEJI_API_KEY") ?: error("Missing KHALEEJI_API_KEY. Get your key from https://khaleejiapi.dev/dashboard/api-keys") val api = KhaleejiAPI(apiKey)val result = api.validation.validateEmail("[email protected]") println(result.valid)PHP
Installation
composer require khaleejiapi/sdkEnvironment Variable Setup
# .envKHALEEJI_API_KEY=your_api_key_hereQuick Example
<?phpuse KhaleejiAPI\KhaleejiAPI; $apiKey = getenv('KHALEEJI_API_KEY');if (!$apiKey) { throw new RuntimeException('Missing KHALEEJI_API_KEY. Get your key from https://khaleejiapi.dev/dashboard/api-keys');} $api = new KhaleejiAPI($apiKey);$result = $api->validation->validateEmail('[email protected]'); echo $result['valid'];Prefer REST?
Don't see your language listed? No problem! Our APIs are fully RESTful and can be accessed from any language that can make HTTP requests.
View REST API DocsIntegration Guides
Need a focused API integration walkthrough? Start with these guides:
MCP Server integration
Configure VS Code / Claude Desktop and run your first tool call.
LangChain integration
Load KhaleejiAPI tools with get_all_tools and run a minimal agent flow.
Localized API errors
Safely display Arabic or English errors in React, Vue, Flutter, and Swift apps.
Media processing workflows
Copy ready-to-run Node.js and Python examples for image, PDF, and QR pipelines.
Laravel Sharia finance guide
Add a Laravel service layer for zakat, sukuk, takaful, and AED conversion flows.
Kotlin Android Sukuk Tracker
Authenticate through a backend proxy and show Sukuk data in a Compose dashboard.