Hello World

Hello World: Your First KhaleejiAPI Call

Make your first successful API call in under 60 seconds. We'll validate an email address — one of the simplest endpoints — so you can confirm your auth, path, and response format are all correct before building further.

1

Get your API key

Every request must carry your API key in the Authorization header using the Bearer scheme. Do not omit the Bearer prefix or send the key via the x-api-key header — both return 401 Unauthorized.

Authorization: Bearer your_api_key_here
2

Install an SDK (optional — skip if using cURL or fetch)

The official SDKs handle auth, retries, and type safety automatically. All examples in Step 3 produce the same result — pick the one that fits your stack.

bash
# JavaScript / TypeScript
npm install @khaleejiapi/sdk
# Python
pip install khaleejiapi
# Go
go get github.com/khaleejiapi/sdk-go
3

Make the call

Replace your_api_key_here with your real key from the dashboard.

Endpoint: GET https://khaleejiapi.dev/api/v1/email/[email protected]

cURL

bash
curl -X GET "https://khaleejiapi.dev/api/v1/email/[email protected]" \
-H "Authorization: Bearer your_api_key_here"

TypeScript SDK

typescript
import { KhaleejiAPI } from '@khaleejiapi/sdk';
const client = new KhaleejiAPI('your_api_key_here');
const result = await client.validation.validateEmail('[email protected]');
console.log(result.valid); // true
console.log(result.deliverabilityScore); // 98

TypeScript (fetch)

typescript
const response = await fetch(
'https://khaleejiapi.dev/api/v1/email/[email protected]',
{ headers: { 'Authorization': 'Bearer your_api_key_here' } }
);
const { data } = await response.json();
console.log(data.valid); // true
console.log(data.deliverabilityScore); // 98

Python SDK

python
from khaleejiapi import KhaleejiAPI
with KhaleejiAPI('your_api_key_here') as client:
result = client.validation.validate_email('[email protected]')
print(result['valid']) # True
print(result['deliverabilityScore']) # 98

Python (requests)

python
import requests
response = requests.get(
"https://khaleejiapi.dev/api/v1/email/validate",
params={"email": "[email protected]"},
headers={"Authorization": "Bearer your_api_key_here"}
)
data = response.json()["data"]
print(data["valid"]) # True
print(data["deliverabilityScore"]) # 98

Go

go
package main
import (
"context"
"fmt"
khaleejiapi "github.com/khaleejiapi/sdk-go"
)
func main() {
client := khaleejiapi.New("your_api_key_here")
result, err := client.Validation.ValidateEmail(
context.Background(), "[email protected]",
)
if err != nil {
panic(err)
}
fmt.Println("Valid:", result.Valid) // Valid: true
fmt.Println("Score:", result.DeliverabilityScore) // Score: 98
}

PHP

php
<?php
$key = 'your_api_key_here';
$email = '[email protected]';
$ch = curl_init(
"https://khaleejiapi.dev/api/v1/email/validate?email=" . urlencode($email)
);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["Authorization: " . $key],
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
echo $response['data']['valid']; // true
echo $response['data']['deliverabilityScore']; // 98
4

Read the response

Every KhaleejiAPI response wraps results in a data key. For email validation you receive:

json
{
"data": {
"email": "[email protected]",
"valid": true,
"deliverabilityScore": 98,
"reason": "Valid email address",
"checks": {
"syntax": true,
"disposable": false,
"mx": true,
"role": false,
"freeProvider": false
},
"domain": "example.com",
"localPart": "hello"
},
"meta": {
"timestamp": "2026-01-01T00:00:00.000Z"
}
}
  • data.valid — boolean; the primary signal you need
  • data.deliverabilityScore — 0–100 confidence score
  • data.checks — granular sub-checks (syntax, MX, disposable, role account)
  • meta.timestamp — ISO 8601 server timestamp

Common first-call errors

401Key sent without the Bearer prefix, as a raw value, or via the x-api-key header. Use Authorization: Bearer your_api_key_here.
404Wrong endpoint path. The API base is /api/v1/ — not /v1/.
429Rate limit reached. The free tier allows 1,000 requests/month. See Rate Limits.

Next steps