POST /api/send
E-posta veya SMS gönderimi için tek endpoint. İstek gövdesi JSON olmalıdır.
Content-Type: application/json
Parametreler
| Parametre | Zorunlu | Açıklama |
|---|---|---|
| apiKey | Evet | API anahtarı |
| programKey | Evet | Program anahtarı |
| type | Evet | "email" veya "sms" |
| message | SMS için evet; email için message veya html’den en az biri | Düz metin gövde (SMS metni veya e-posta text). E-posta için html ile birlikte veya yalnız biri kullanılabilir |
| phones | type=sms için | Telefon numaraları (+ olmaz, en az 10 hane; başında 90 yoksa eklenir). Örnek: 905111111111 |
| emails | type=email için | E-posta adresleri dizisi |
| subject | type=email için evet | E-posta konusu (type=email için zorunlu) |
| ccs | Hayır | CC e-posta adresleri (email için). Dizi veya virgülle ayrılmış metin |
| bccs | Hayır | BCC e-posta adresleri (email için). Dizi veya virgülle ayrılmış metin |
| replyTo | Hayır | Reply-To adresi veya adresleri (email için) |
| from | Hayır | Gönderen (From) adresi (email için; yoksa SMTP ayarı kullanılır) |
| html | Hayır (email için message veya html’den en az biri zorunlu) | E-posta HTML gövdesi (email için). Sadece html, sadece message (text) veya ikisi birden gönderilebilir |
E-posta gövdesi (text / HTML)
E-posta için message (düz metin) veya html alanlarından en az biri zorunludur. İkisi birden gönderilebilir (çift parçalı e-posta). Sadece text, sadece HTML veya her ikisi kabul edilir.
Telefon numarası formatı (SMS)
- Formatta + kullanılmaz.
- En az 10 hane (sadece rakam) girin.
- Başında 90 yoksa otomatik eklenir.
- Geçerli örnek:
905111111111(90 + 10 hane).
Örnek girişler: 5111111111 → 905111111111, 05511111111 → 905511111111. Geçersiz numara gönderilirse 400 döner.
Örnek istekler
SMS gönderimi:
{
"apiKey": "nk_...",
"programKey": "my-program",
"type": "sms",
"phones": ["905551234567"],
"message": "Merhaba, bu bir test mesajıdır."
}E-posta gönderimi (temel):
{
"apiKey": "nk_...",
"programKey": "my-program",
"type": "email",
"emails": ["alici@ornek.com"],
"message": "E-posta gövdesi",
"subject": "Konu (zorunlu)"
}E-posta gönderimi (CC, BCC, Reply-To, From, HTML):
{
"apiKey": "nk_...",
"programKey": "my-program",
"type": "email",
"emails": ["alici@ornek.com"],
"ccs": ["cc@ornek.com"],
"bccs": ["gizli@ornek.com"],
"replyTo": ["cevap@ornek.com"],
"from": "gonderici@ornek.com",
"subject": "Konu",
"message": "Düz metin gövde",
"html": "<p>HTML gövde (opsiyonel)</p>"
}E-posta yalnız HTML ile (message olmadan):
{
"apiKey": "nk_...",
"programKey": "my-program",
"type": "email",
"emails": ["alici@ornek.com"],
"subject": "Konu",
"html": "<p>Yalnızca HTML gövde</p>"
}Olası cevaplar
Tüm cevaplarda success, requestId ve message alanları bulunur.
200Başarılı gönderim
{
"success": true,
"requestId": "uuid",
"message": "sent"
}400Validasyon hatası
Örnek: type=email için en az bir alıcı veya konu eksik
{
"success": false,
"requestId": "uuid",
"message": "type=email için en az bir alıcı zorunludur: emails alanına bir veya daha fazla e-posta adresi girin."
}Örnek: geçersiz telefon (en az 10 hane, örnek: 905111111111)
{
"success": false,
"requestId": "uuid",
"message": "Geçersiz telefon numarası. En az 10 hane girin; başında 90 yoksa eklenir. Örnek: 905111111111"
}401Geçersiz API anahtarı veya program
{
"success": false,
"requestId": "uuid",
"message": "Geçersiz API anahtarı veya program"
}403Bu API anahtarı pasif durumdadır
{
"success": false,
"requestId": "uuid",
"message": "Bu API anahtarı pasif durumdadır."
}403API anahtarının süresi dolmuş
{
"success": false,
"requestId": "uuid",
"message": "API anahtarının süresi dolmuş"
}429İstek limiti aşıldı
{
"success": false,
"requestId": "uuid",
"message": "İstek limiti aşıldı"
}502Gönderim sağlayıcı hatası
{
"success": false,
"requestId": "uuid",
"message": "Gönderim sağlayıcı hatası"
}500Sunucu hatası
{
"success": false,
"requestId": "uuid",
"message": "Sunucu hatası"
}