Examples
Send an SMS
Code examples for sending SMS messages
💬 Send an SMS
Want to see these examples running end to end? Check out the firesms-examples repo on GitHub — fully working apps in Node.js, TypeScript, Python, and PHP.
curl -X POST https://firesms.vercel.app/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_API_KEY",
"to": "27821234567",
"text": "Hello from Fire SMS"
}'const response = await fetch('https://firesms.vercel.app/api/v1/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: 'YOUR_API_KEY',
to: '27821234567',
text: 'Hello from Fire SMS',
}),
});
const data = await response.json();
if (data.status === 'success') {
console.log('Sent! ID:', data.id);
} else {
console.error('Failed:', data.error);
}const response = await fetch('https://firesms.vercel.app/api/v1/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: process.env.FIRESMS_API_KEY!,
to: '27821234567',
text: 'Hello from Fire SMS',
}),
});
const data = await response.json();
if (data.status === 'success') {
console.log('Sent! ID:', data.id);
} else {
console.error('Failed:', data.error);
}import requests
import os
response = requests.post(
'https://firesms.vercel.app/api/v1/send',
json={
'api_key': os.environ['FIRESMS_API_KEY'],
'to': '27821234567',
'text': 'Hello from Fire SMS',
}
)
data = response.json()
if data['status'] == 'success':
print('Sent! ID:', data['id'])
else:
print('Failed:', data['error'])<?php
$response = file_get_contents('https://firesms.vercel.app/api/v1/send', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => json_encode([
'api_key' => getenv('FIRESMS_API_KEY'),
'to' => '27821234567',
'text' => 'Hello from Fire SMS',
]),
],
]));
$data = json_decode($response, true);
if ($data['status'] === 'success') {
echo 'Sent! ID: ' . $data['id'];
} else {
echo 'Failed: ' . $data['error'];
}