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; a later page returns an empty list).
limitnumberPage size (default 20, max 50).
GET/user/contractsbiaya 2 creditcache 6 jam

Get the smart contract addresses associated with a user: the 100 most recent, oldest first. `contracts` lists the addresses; `mentioned_contracts` lists the same contracts in the same order, each with its chain, the token symbol and name, and when the account first mentioned it (Unix seconds, null when not known).

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).
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, with the time of each follow. A follow that already existed when we started tracking that key profile has no known time and is not listed.

usernamestringTwitter username. Provide username or twitterId.
twitterIdstringTwitter numeric ID. Provide username or twitterId.
sortstringSort order: "recent" (default) or "oldest".
pagenumberPage number (default: 1). No maximum: page through the full list; a page past the end returns an empty list.
limitnumberPage size (default 20, max 50).
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 menit

Get a user's 50 most recent followers from Twitter in real time. There are no further pages.

twitterIdstringTwitter numeric user ID. Required if username not provided.
usernamestringTwitter handle (without @). Required if twitterId not provided.
GET/x/user/followingbiaya 1 creditcache 15 menit

Get the 50 accounts a user followed most recently on Twitter, in real time. There are no further pages.

twitterIdstringTwitter numeric user ID. Required if username not provided.
usernamestringTwitter handle (without @). Required if twitterId not provided.
GET/x/user/latest-tweetsbiaya 0.1 / hasilcache 1 menit

Get a user's latest tweets in real time (replies excluded): one page of up to 20 tweets (fewer with `count`). There are no further pages.

twitterIdstringTwitter numeric user ID. Required if username not provided.
usernamestringTwitter handle (without @). Required if twitterId not provided.
countnumberNumber of tweets to return, up to 20 (default 20). A larger count returns 20.
rawstringSet to "true" to get the tweets in X's original format.
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.