Skip to main content

Quick Start Guide

Get up and running with the Sakneen API in minutes.

Step 1: Get Your API Key

Contact Sakneen support to obtain your API credentials:

  • Email: [email protected]
  • Provide your company name and intended use case
  • You'll receive your unique API key and assigned domain

Step 2: Test Connection

First, test your API key with a health check:

curl --location "https://your-domain/external/apis/v1.0/healthz" \
--header "api-key: YOUR_API_KEY_HERE"

If successful, you should see: API is healthy

Then test creating a lead:

curl -X POST "https://your-domain/external/apis/v1.0/leads" \
-H "api-key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"name": "Test Lead",
"phoneNumber": "+1234567890",
"project": "Test Project",
"email": "[email protected]"
}'

Note: Replace your-domain with the actual domain provided by Sakneen support.

Step 3: Integrate into Your Application

JavaScript/Node.js

const SAKNEEN_API_KEY = 'your-api-key-here';
const SAKNEEN_DOMAIN = 'your-domain'; // provided by Sakneen support
const BASE_URL = `https://${SAKNEEN_DOMAIN}/external/apis/v1.0`;

async function createLead(leadData) {
const response = await fetch(`${BASE_URL}/leads`, {
method: 'POST',
headers: {
'api-key': SAKNEEN_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify(leadData)
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

return response.text();
}

// Usage
const leadData = {
name: 'John Doe',
phoneNumber: '+1987654321',
project: 'Downtown Tower',
email: '[email protected]'
};

createLead(leadData)
.then(result => console.log('Lead created:', result))
.catch(error => console.error('Error:', error));

Python

import requests
import json

SAKNEEN_API_KEY = 'your-api-key-here'
SAKNEEN_DOMAIN = 'your-domain' # provided by Sakneen support
BASE_URL = f'https://{SAKNEEN_DOMAIN}/external/apis/v1.0'

def create_lead(lead_data):
headers = {
'api-key': SAKNEEN_API_KEY,
'Content-Type': 'application/json'
}

response = requests.post(
f'{BASE_URL}/leads',
json=lead_data,
headers=headers
)

response.raise_for_status()
return response.text

# Usage
lead_data = {
'name': 'John Doe',
'phoneNumber': '+1987654321',
'project': 'Downtown Tower',
'email': '[email protected]'
}

try:
result = create_lead(lead_data)
print(f'Lead created: {result}')
except requests.exceptions.RequestException as e:
print(f'Error: {e}')

PHP

<?php
$sakneenApiKey = 'your-api-key-here';
$sakneenDomain = 'your-domain'; // provided by Sakneen support
$baseUrl = "https://{$sakneenDomain}/external/apis/v1.0";

function createLead($leadData, $apiKey, $baseUrl) {
$headers = [
'api-key: ' . $apiKey,
'Content-Type: application/json'
];

$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $baseUrl . '/leads',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($leadData),
CURLOPT_HTTPHEADER => $headers,
]);

$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

if ($httpCode !== 201) {
throw new Exception("HTTP Error: $httpCode");
}

return $response;
}

// Usage
$leadData = [
'name' => 'John Doe',
'phoneNumber' => '+1987654321',
'project' => 'Downtown Tower',
'email' => '[email protected]'
];

try {
$result = createLead($leadData, $sakneenApiKey, $baseUrl);
echo "Lead created: $result\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
?>

Step 4: Handle Responses

Success Response (201 Created)

Lead created successfully

Error Response (400 Bad Request)

{
"message": ["Validation error message"],
"error": "Bad Request",
"statusCode": 400
}

Step 5: Production Checklist

Before going live, ensure you:

  • Use environment variables for API keys
  • Implement proper error handling
  • Add request timeout and retry logic
  • Use HTTPS in production
  • Monitor API usage and rate limits
  • Test with staging environment first

Next Steps

Need Help?