Somrat It Solution API
Simple and Powerful API Integration
Your API Key
Please login to generate your API key.
Authentication
Include your API key in every request using one of these methods:
Method 1: Header (Recommended)
Method 2: Query Parameter
API Endpoints
Get your account profile and balance.
Method: GET | Authentication: Required (API Key via header or query parameter)
@php
$apiKey = 'YOUR_API_KEY';
$url = 'https://somratit.com/api/v1/profile?api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Get all active products with categories, prices, and stock.
Method: GET | Authentication: Required (API Key via header or query parameter)
@php
$apiKey = 'YOUR_API_KEY';
$url = 'https://somratit.com/api/v1/products?api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Get details of a specific product. Replace 1 with product ID.
Method: GET | Authentication: Required (API Key via header or query parameter)
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Required | Product ID |
@php
$apiKey = 'YOUR_API_KEY';
$productId = 1;
$url = 'https://somratit.com/api/v1/product/' . $productId . '?api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Calculate final price with discounts and coupons.
Method: GET | Authentication: Required (API Key via header or query parameter)
| Parameter | Type | Required | Description |
|---|---|---|---|
product_id | integer | Required | Product ID |
quantity | integer | Required | Quantity |
coupon_code | string | Optional | Coupon code |
@php
$apiKey = 'YOUR_API_KEY';
$url = 'https://somratit.com/api/v1/calculate-price?product_id=1&quantity=10&api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Place an order (requires sufficient balance).
Method: GET | Authentication: Required (API Key via header or query parameter)
| Parameter | Type | Required | Description |
|---|---|---|---|
product_id | integer | Required | Product ID |
quantity | integer | Required | Quantity |
coupon_code | string | Optional | Coupon code |
@php
$apiKey = 'YOUR_API_KEY';
$url = 'https://somratit.com/api/v1/place-order?product_id=1&quantity=5&api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Get your order history (last 50 orders).
Method: GET | Authentication: Required (API Key via header or query parameter)
@php
$apiKey = 'YOUR_API_KEY';
$url = 'https://somratit.com/api/v1/orders?api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Get your API usage statistics.
Method: GET | Authentication: Required (API Key via header or query parameter)
@php
$apiKey = 'YOUR_API_KEY';
$url = 'https://somratit.com/api/v1/stats?api_key=' . $apiKey;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
Mailbox API
Read mailboxes (Gmail, Hotmail/Outlook, Business Mail) without requiring your main API Key.
What is this for?
This endpoint allows you to check the status of a Gmail account and extract verification codes (e.g., for Instagram, Facebook, Netflix) from its emails. It uses internal tokens to access the mailbox securely.
Method: GET | Authentication: Not required
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Required | Format: email|token. The Gmail address and its access token separated by a pipe. |
@php $email = 'user@gmail.com|token'; $url = 'https://somratit.com/api/v1/public/mailbox/gmail?email=' . urlencode($email); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result);
What is this for?
Check Microsoft Outlook or Hotmail accounts for emails. It supports both OAuth2 tokens and direct Graph API access. You can check multiple accounts at once.
Method: GET | Authentication: Not required
| Parameter | Type | Required | Description |
|---|---|---|---|
accounts[] | array | Required | List of accounts. Format: email|pass|token|client_id||recovery_email |
mode | string | Optional | oauth (default) or graph |
Example: user@outlook.com|password123|token|client_id||recovery@gmail.com
What is this for?
Connect to a Business Email server using a specific access token to retrieve messages.
Method: GET | Authentication: Not required
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Required | The access token string. |
What is this for?
Check if a specific Facebook User ID (UID) is currently live or active. Useful for verifying Facebook account status.
Method: GET | Authentication: Not required
| Parameter | Type | Required | Description |
|---|---|---|---|
uid | string | Required | The Facebook User ID to check. |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://somratit.com/api/v1/public/facebook/live?uid=1000...',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
if ($result['status'] === 'live') {
echo "User is Live!";
}
Refresh Microsoft/Outlook OAuth2 tokens by exchanging a refresh token for a new access token. This endpoint connects directly to Microsoft's Identity Platform.
| Parameter | Type | Required | Description |
|---|---|---|---|
client_id | string | Required | Your Application Client ID (from Azure Portal). |
refresh_token | string | Required | The expired or valid refresh token. |
client_secret | string | Optional | Client Secret (required for Web Apps, optional for Public Clients). |
Live Console
Code Examples
$curl = curl_init();
$postData = array(
'client_id' => 'YOUR_CLIENT_ID',
'refresh_token' => 'YOUR_REFRESH_TOKEN',
'client_secret' => 'YOUR_CLIENT_SECRET' // Optional
);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://somratit.com/api/refresh-token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($postData),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
2FA Generator API
Generate 2FA TOTP codes programmatically.
Generate a current TOTP code from a secret key.
| Parameter | Type | Required | Description |
|---|---|---|---|
key |
String | Yes | The 2FA Secret Key (Base32 encoded) |
curl -X GET "https://somratit.com/api/2fa-generate?key=JBSWY3DPEHPK3PXP"
Error Handling
All API errors follow this standardized format:
Common HTTP Status Codes:
| Code | Meaning | Description |
|---|---|---|
200 |
OK | Request successful |
400 |
Bad Request | Invalid parameters |
401 |
Unauthorized | Invalid or missing API key |
404 |
Not Found | Resource not found |
500 |
Server Error | Internal server error |