Dokumentasi lengkap REST API Alight Motion Premium. Creator & domain mengikuti config.js.
API memproxy request ke layanan AM Premium. Alur standar:
action=send)action=verif)| Param | Type | Wajib | Keterangan |
|---|---|---|---|
action | string | Ya | Harus send |
email | string | Ya | Email target verifikasi |
| Param | Type | Wajib | Keterangan |
|---|---|---|---|
action | string | Ya | Harus verif |
email | string | Ya | Email yang sama saat send |
link | string | Ya | URL magic link dari email |
Semua endpoint mengembalikan format yang sama:
{
"status": true,
"creator": "LittleEkz",
"result": {
"message": "Link berhasil dikirim."
}
}
{
"status": false,
"creator": "LittleEkz",
"result": {
"message": "Email tidak valid."
}
}
| Field | Type | Keterangan |
|---|---|---|
status | boolean | true sukses, false gagal |
creator | string | Dari config.js (default: LittleEkz) |
result.message | string | Pesan hasil proses |
Pilih bahasa, lalu salin contoh untuk Send atau Verif.
Send magic link
curl "BASE/api/amprem?action=send&email=user@gmail.com"
Verifikasi link
curl "BASE/api/amprem?action=verif&email=user@gmail.com&link=https://example.com/verify/xxx"
Send magic link (fetch)
const base = "BASE";
async function sendMagicLink(email) {
const url = `${base}/api/amprem?action=send&email=${encodeURIComponent(email)}`;
const res = await fetch(url);
const data = await res.json();
if (data.status) {
console.log("OK:", data.result.message);
console.log("Creator:", data.creator);
} else {
console.error("Gagal:", data.result.message);
}
return data;
}
sendMagicLink("user@gmail.com");
Verifikasi link
const base = "BASE";
async function verifMagicLink(email, link) {
const params = new URLSearchParams({
action: "verif",
email,
link
});
const res = await fetch(`${base}/api/amprem?${params}`);
const data = await res.json();
if (data.status) {
console.log("Verified:", data.result.message);
} else {
console.error("Gagal:", data.result.message);
}
return data;
}
verifMagicLink("user@gmail.com", "https://example.com/verify/xxx");
Send magic link (requests)
import requests
BASE = "BASE"
def send_magic_link(email: str) -> dict:
r = requests.get(
f"{BASE}/api/amprem",
params={"action": "send", "email": email},
timeout=25,
)
data = r.json()
if data.get("status"):
print("OK:", data["result"]["message"])
print("Creator:", data.get("creator"))
else:
print("Gagal:", data.get("result", {}).get("message"))
return data
send_magic_link("user@gmail.com")
Verifikasi link
import requests
BASE = "BASE"
def verif_magic_link(email: str, link: str) -> dict:
r = requests.get(
f"{BASE}/api/amprem",
params={"action": "verif", "email": email, "link": link},
timeout=25,
)
data = r.json()
if data.get("status"):
print("Verified:", data["result"]["message"])
else:
print("Gagal:", data.get("result", {}).get("message"))
return data
verif_magic_link("user@gmail.com", "https://example.com/verify/xxx")
Send magic link
<?php
$base = "BASE";
$email = "user@gmail.com";
$url = $base . "/api/amprem?" . http_build_query([
"action" => "send",
"email" => $email,
]);
$json = file_get_contents($url);
$data = json_decode($json, true);
if (!empty($data["status"])) {
echo "OK: " . $data["result"]["message"] . PHP_EOL;
echo "Creator: " . $data["creator"] . PHP_EOL;
} else {
echo "Gagal: " . ($data["result"]["message"] ?? "unknown") . PHP_EOL;
}
Verifikasi link
<?php
$base = "BASE";
$email = "user@gmail.com";
$link = "https://example.com/verify/xxx";
$url = $base . "/api/amprem?" . http_build_query([
"action" => "verif",
"email" => $email,
"link" => $link,
]);
$json = file_get_contents($url);
$data = json_decode($json, true);
if (!empty($data["status"])) {
echo "Verified: " . $data["result"]["message"] . PHP_EOL;
} else {
echo "Gagal: " . ($data["result"]["message"] ?? "unknown") . PHP_EOL;
}
Mengembalikan creator, domain, version, dan daftar endpoint.
{
"status": true,
"creator": "LittleEkz",
"service": "Alight Motion Premium",
"version": "1.0.0",
"domain": "https://your-domain.com",
"endpoints": { "...": "..." }
}
Semua setting ada di file config.js atau environment variable.
module.exports = {
creator: 'LittleEkz', // nama di response API & website
domain: '', // kosong = auto dari request host
port: 3000,
serviceName: 'Alight Motion Premium',
version: '1.0.0'
// upstream API hanya di server / env (tidak dipublikasikan)
};
Env opsional (publik): CREATOR, DOMAIN. Upstream API hanya diset di server/env privat.