API v1.0 • Live
API Reference
Connect your application to HostFree's high-speed email delivery network. Use our REST API to manage user verification seamlessly with just a few lines of code.
Send OTP Email
This endpoint generates a secure 6-digit code and sends it to the specified email address. The OTP expires after 10 minutes.
POST
https://emailapi.hostfree.site/v1/send.php
$data = [
'api_key' => 'YOUR_API_KEY',
'email' => 'user@example.com'
];
$ch = curl_init('https://emailapi.hostfree.site/v1/send.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
echo $response;
const axios = require('axios');
const sendData = {
api_key: 'YOUR_API_KEY',
email: 'user@example.com'
};
axios.post('https://emailapi.hostfree.site/v1/send.php', sendData)
.then(res => console.log(res.data))
.catch(err => console.error(err));
import requests
data = {
'api_key': 'YOUR_API_KEY',
'email': 'user@example.com'
}
response = requests.post(
'https://emailapi.hostfree.site/v1/send.php',
data=data
)
print(response.json())
Verify OTP Code
Validate the code provided by your user against our records. Each code can only be verified once.
POST
https://emailapi.hostfree.site/v1/verify.php
// Using Java HttpClient
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://emailapi.hostfree.site/v1/verify.php"))
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(BodyPublishers.ofString("api_key=KEY&email=USER&otp=123456"))
.build();
HttpResponse<String> response = client.send(
request, BodyHandlers.ofString()
);
curl -X POST https://emailapi.hostfree.site/v1/verify.php \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "api_key=YOUR_API_KEY" \
-d "email=user@example.com" \
-d "otp=123456"
Response Codes
All API responses return a JSON object with a status and message. Here's what to expect:
| Status | Message | Description |
|---|---|---|
| success | OTP sent successfully |
Email was delivered to the recipient |
| success | OTP verified |
The provided OTP code is valid |
| error | Invalid API Key |
The API key provided is incorrect or expired |
| error | Daily limit reached |
You've exceeded your daily email quota |
| error | Invalid OTP |
The OTP code is incorrect or expired |
{
"status": "success",
"message": "OTP sent successfully",
"data": {
"email": "user@example.com",
"expires_at": "2026-01-15T10:30:00Z"
}
}