Akses Khusus Bot
Butuh API Key Bot Otomasi?
API Key dibuatkan langsung oleh Owner via Telegram: @TrustaryStoree.
Integrasi Bot & Otomasi
Dokumentasi REST API Bot.
Integrasikan Trustary Tmail ke dalam bot Telegram, skrip Python, atau sistem otomasi backend Anda.
Base URL API
https://trustarytmail.my.id/api/v1
Python 3 · Generate Email & Tunggu Kode OTP
import requests
# Dapatkan API Key resmi Anda dari Owner via Telegram (@TrustaryStoree)
API_KEY = "YOUR_API_KEY_DARI_OWNER"
BASE_URL = "https://trustarytmail.my.id/api/v1"
HEADERS = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}
# 1. Buat alamat email sementara baru
res = requests.post(f"{BASE_URL}/emails/generate", headers=HEADERS, json={
"prefix": "botuser",
"domain": "trustarytmail.my.id"
})
data = res.json()
email_address = data["email"]
print(f"[*] Email dibuat: {email_address}")
# 2. Tunggu kode OTP masuk (Long-polling - server langsung merespon begitu email tiba)
print("[*] Menunggu kode verifikasi OTP masuk...")
otp_res = requests.get(f"{BASE_URL}/inbox/wait-otp?email={email_address}&timeout=60", headers=HEADERS)
otp_data = otp_res.json()
if otp_data.get("ok") and otp_data.get("otp"):
print(f"[+] KODE OTP DITERIMA: {otp_data['otp']}")
print(f"[+] Pengirim: {otp_data['from']}")
print(f"[+] Subjek: {otp_data['subject']}")
else:
print("[-] Waktu tunggu habis (timeout).")
Daftar Endpoint REST API v1
Seluruh endpoint mendukung autentikasi via header X-Api-Key atau Authorization: Bearer <KEY>.
| Metode | Endpoint | Parameter / Body | Keterangan | Autentikasi |
|---|---|---|---|---|
| POST | /api/v1/emails/generate |
{ prefix, domain } |
Membuat alamat email sementara baru sesuai prefix dan domain pilihan. | Wajib Key |
| GET | /api/v1/inbox?email=... |
email (query) |
Mengambil seluruh daftar pesan masuk untuk suatu email. | Wajib Key |
| GET | /api/v1/inbox/latest-otp?email=... |
email (query) |
Mengambil kode OTP verifikasi terakhir (4-8 digit) langsung tanpa parsing manual. | Wajib Key |
| GET | /api/v1/inbox/wait-otp?email=...&timeout=60 |
email, timeout |
Long-polling: Menahan request dan segera merespon begitu kode OTP tiba di server. | Wajib Key |
| GET | /api/v1/messages/:id |
id (path) |
Mengambil detail lengkap satu email (HTML, teks, subjek, raw MIME). | Wajib Key |
| DELETE | /api/v1/inbox?email=... |
email (query) |
Membersihkan semua pesan masuk untuk alamat email yang ditentukan. | Wajib Key |
| GET | /api/v1/domains |
- | Melihat daftar seluruh domain aktif (Cloudflare resmi & sumbangan). | Publik |
| POST | /api/v1/domains/contribute |
{ domain } |
Sumbang domain otomatis via Cloudflare Email Routing. | Publik |
| GET | /api/v1/subscription/verify-key |
- (Header Key) | Memeriksa status aktif dan masa berlaku API Key resmi dari Owner. | Wajib Key |
Kode Status HTTP Standar
| Status | Arti | Keterangan |
|---|---|---|
200 OK |
Berhasil | Permintaan berhasil diproses. Objek respon mengandung {"ok": true}. |
400 Bad Request |
Parameter Tidak Valid | Format prefix, email, atau JSON body salah. |
401 Unauthorized |
API Key Tidak Valid | Header X-Api-Key tidak ada, salah, atau masa aktif telah berakhir. Hubungi Owner untuk perpanjangan. |
404 Not Found |
Pesan Tidak Ditemukan | ID email yang diminta tidak ditemukan di database server. |
500 Server Error |
Kesalahan Server | Terjadi gangguan internal pada server. |