AlphagateDocsMasuk
alphagate gateway / dokumentasi

Panggil Alphagate, bayar lebih sedikit.

Gateway ini pengganti langsung untuk API Alphagate. Path, query, dan bentuk respons persis sama — yang berubah cuma host dan isi header x-api-key.

Mulai

Kamu butuh satu client key dari operator gateway, bentuknya agk_…. Itu bukan kunci Alphagate: kunci yang asli tidak pernah keluar dari server gateway dan kamu tidak akan pernah melihatnya. Kalau key-mu bocor, operator bisa mencabutnya tanpa mengganggu pemakai lain.

# sebelumnya
curl "https://api.alphagate.io/api/v2/user/alpha?username=elonmusk" \
  -H "x-api-key: KUNCI_ALPHAGATE"

# lewat gateway
curl "$GATEWAY/api/v2/user/alpha?username=elonmusk" \
  -H "x-api-key: agk_45a18cd75a7a1e83…"
const res = await fetch(
  `${GATEWAY}/api/v2/user/alpha?username=${encodeURIComponent(name)}`,
  { headers: { 'x-api-key': process.env.GATEWAY_KEY } },
)
const { data } = await res.json()
x-cache: hit            hit | miss | stale | bypass | error
x-cache-age: 1841       detik sejak data ini diambil dari Alphagate
x-credits-charged: 0    credit yang terpotong untuk permintaan ini
x-credits-saved: 6      credit yang tidak jadi terpotong karena cache
hitDari cache. Alphagate tidak disentuh, 0 credit.
missDiambil dari Alphagate, credit terpotong.
staleAlphagate sedang gagal — ini salinan lama. Cek x-cache-age.
bypassSengaja tidak di-cache: route bertarif nol, _fresh=1, atau route yang belum dikenal.
errorPermintaan gagal, tidak ada yang tersaji.

Beda dari memanggil Alphagate langsung

situasilangsunglewat gateway
Data masih segar di cacheselalu bayar0 credit
50 permintaan identik bersamaan50 kali bayar1 kali bayar
Kuota habis, kena limit, atau 5xxerrorsalinan lama kalau ada
Key salah401 dari Alphagate401 sebelum Alphagate dihubungi
Metode selain GETtergantung endpoint405

Bentuk error tetap sama seperti Alphagate, {"message":"…"}, termasuk 401 dan 502 yang berasal dari gateway sendiri. Dua pengecualian yang bodinya kosong:404 untuk path di luar /api/v2/ dan 405 untuk metode selain GET — keduanya salah alamat, bukan jawaban API.

Yang perlu diketahui

Butuh data terbaru? Tambahkan _fresh=1. Cache dilewati, credit terpotong, isi cache ikut diperbarui, dan parameter itu tidak diteruskan ke Alphagate. Jangan dijadikan kebiasaan — kalau semua permintaanmu memakainya, kamu membayar penuh seperti tanpa gateway.

Query yang beda tulisan tapi sama maksudnya dianggap satu. Urutan parameter tidak berpengaruh, username tidak peka huruf besar-kecil, dancount dianggap sama dengan limit pada endpoint yang menerima keduanya. Kamu tidak perlu menyeragamkan sendiri untuk mendapat hit.

404 ikut di-cache sebentar. Username yang tidak ada dijawab langsung tanpa memanggil Alphagate. Ini tidak memakan credit — Alphagate memang tidak menagih 404 — hanya menghemat waktu tunggu.

Kolom TTL di bawah adalah setelan gateway ini sekarang, bukan angka contoh. Operator bisa mengubahnya kapan saja, jadi jangan menanam asumsi umur data di kodemu; baca x-cache-age kalau kesegarannya penting bagimu.

Database

GET/user/alphabiaya 6 creditcache 6 jam

Get key intelligence on a user: contract activity, community creation, and name changes.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
GET/user/bio-historybiaya 2 creditcache 6 jampaginasi page

Get bio change history for a user. Returns previous and new bio values with timestamps.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
pagenumberPage number (default: 1, max: 30).
limitnumberPage size (alias: count). Capped by server maxPageSize.
countnumberSame as limit when provided; must be a positive integer (≥ 1).
GET/user/contractsbiaya 2 creditcache 6 jam

Get all smart contract addresses associated with a user.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
GET/user/deleted-tweetsbiaya 4 creditcache 1 jam

Get deleted tweets from a user.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
limitnumberMax tweets to return (default 100, max 100).
countnumberAlias for limit when provided; must be a positive integer (≥ 1).
GET/user/first-followsbiaya 3 creditcache 30 hari

Get the first accounts that followed this user (early supporters).

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
GET/user/key-followersbiaya 4 creditcache 6 jampaginasi page

Get key followers (influencers/KOLs) that follow this user.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
sortstringSort order: "recent" (default) or "oldest".
pagenumberPage number (default: 1).
limitnumberPage size. Capped by server maxPageSize (default 20).
countnumberSame as limit when provided; must be a positive integer (≥ 1).
GET/user/prev-usernamesbiaya 0.5 creditcache 12 jam

Get previous usernames for a user.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.

Live Twitter

GET/user/idbiaya 0.1 creditcache 30 hari

Convert a Twitter username to a numeric user ID in real time.

usernamestring · wajibTwitter handle (without @).
GET/x/user/followersbiaya 1 creditcache 15 menitpaginasi cursor

Get a user's followers from Twitter in real time.

twitterIdstringTwitter numeric user ID. Required if username not provided.
usernamestringTwitter handle (without @). Required if twitterId not provided.
cursorstringPagination cursor from previous response (forwarded to proxy). Page size is set by the proxy.
GET/x/user/followingbiaya 1 creditcache 15 menitpaginasi cursor

Get accounts a user follows on Twitter in real time.

twitterIdstringTwitter numeric user ID. Required if username not provided.
usernamestringTwitter handle (without @). Required if twitterId not provided.
cursorstringPagination cursor from previous response (forwarded to proxy). Page size is set by the proxy.
GET/x/user/latest-tweetsbiaya 0.1 / hasilcache 1 menitpaginasi cursor

Get a user's latest tweets in real time (no replies). When billed as perResult, cost = amount × tweets returned (see route cost type in this response).

twitterIdstringTwitter numeric user ID. Required if username not provided.
usernamestringTwitter handle (without @). Required if twitterId not provided.
countnumberIf provided, positive integer; forwarded to proxy (default set by proxy).
cursorstringPagination cursor from previous response.
rawstringSet to "true" to return upstream tweet JSON without normalization.
GET/x/user/overviewbiaya 0.1 creditcache 5 menit

Get a full Twitter user profile in real time.

usernamestring · wajibTwitter handle (without @).

Account

GET/balancebiaya gratiscache tidak pernah

Get current credit balance and plan info.

Tanpa parameter.

GET/usage/historybiaya gratiscache tidak pernahpaginasi page

Paginated log of all API calls made.

pagenumberPage number (default: 1).
GET/usage/summarybiaya gratiscache tidak pernah

Aggregated usage stats for the last 30 days.

Tanpa parameter.