Overview
The Klein Gmail API provides access to email verification codes and account management functionality. This RESTful API returns JSON responses and uses HTTP status codes for error handling.
Authentication
Authentication is required for most endpoints using API keys. Include your API key in the request header:
X-API-Key: your_api_key_here
Base URL
https://klein-gmail.com
API Endpoints
Status & Info
GET /api/status No Auth
Check API operational status.
Test this endpoint:
GET /api No Auth
Get API information and available endpoints.
Test this endpoint:
Products
GET /api/products No Auth
Retrieve a list of all available products with pricing and stock status.
Sample Response:
{
"success": true,
"data": [
{
"id": 8,
"name": "Apple",
"price": 0.065
},
{
"id": 13,
"name": "Amazon",
"price": 0.035
},
{
"id": 15,
"name": "Paypal",
"price": 0.04
}
]
}
Test this endpoint:
Stock Information
GET /api/stock/simple No Auth
Get simplified stock information showing only product ID, name, and available count.
Test this endpoint:
Orders
GET /api/orders Auth Required
Retrieve all orders for the authenticated user.
Test this endpoint:
POST /api/orders Auth Required
Create a new order for a product.
Request Body:
{
"product_id": 8,
"quantity": 1
}
Test this endpoint:
Wallet
GET /api/balance Auth Required
Get the user's current account balance.
Test this endpoint:
GET /api/transactions Auth Required
Get transaction history for the authenticated user.
Test this endpoint:
Verification
GET /api/verification/email/{email}/code No Auth
Retrieve verification code for a specific email address (public endpoint).
Test this endpoint:
API Testing
HTTP Status Codes
Success
Bad Request
Unauthorized
Not Found
Code Examples
JavaScript/Node.js
// Get products (no auth required)
fetch('https://klein-gmail.com/api/products')
.then(response => response.json())
.then(data => console.log(data));
// Create order (auth required)
fetch('https://klein-gmail.com/api/orders', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
product_id: 8,
quantity: 1
})
})
.then(response => response.json())
.then(data => console.log(data));
PHP
8,
'quantity' => 1
]));
$response = curl_exec($ch);
curl_close($ch);
$order = json_decode($response, true);
?>
Python
import requests
api_key = 'your_api_key_here'
base_url = 'https://klein-gmail.com/api'
# Get products
response = requests.get(f'{base_url}/products')
products = response.json()
# Create order
headers = {
'X-API-Key': api_key,
'Content-Type': 'application/json'
}
data = {
'product_id': 8,
'quantity': 1
}
response = requests.post(f'{base_url}/orders', headers=headers, json=data)
order = response.json()