Skip to main content
The System API covers plans (public), keys (admin), and payments (admin). client.keys and client.payment require an API key.

Plan API (public)

List API plans — no key required.
const client = alphscan({ apiUrl: "https://api.alphscan.io" });
const { plans } = await client.plan.list();

PlanApi

MethodReturnsDescription
list()Promise<PlansResponse>List plans.

Plan / PlansResponse

  • PlansResponse: { plans: Plan[] }
  • Plan: id, name, requests_per_minute, requests_per_day, allowed_origins, price, price_alph, validity_days

Keys API (admin)

List and create API keys. Requires apiKey.
const client = alphscan({ apiUrl: "https://api.alphscan.io", apiKey: "sk_admin..." });
const { keys } = await client.keys.list();
const created = await client.keys.create({ userId: "user_1", planId: "plan_free", level: "user" });

KeysApi

MethodReturnsDescription
list(params?)Promise<KeysResponse>List keys; optional user_id filter.
create(body)Promise<KeyCreateResponse>Create a key.

Types

  • KeysResponse: { keys: ApiKeyRow[] }
  • ApiKeyRow: id, key_prefix, user_id, level, plan_id, allowed_origins, status, created_at, last_payment_at, valid_until
  • KeyCreateBody: userId, planId, level?: "user" | "alphscan" | "admin"
  • KeyCreateResponse: key, keyId, key_prefix

Payment API (admin)

Payment flow: next index, request, verify, pending, history. Requires apiKey.
const client = alphscan({ apiUrl: "https://api.alphscan.io", apiKey: "sk_admin..." });

const { next_index } = await client.payment.nextIndex();
const request = await client.payment.request({
  derivation_index: next_index,
  deposit_address: "addr...",
  telegram_user_id: "123",
  plan_id: "plan_pro",
  amount_alph_min: 100,
});
const verify = await client.payment.verify({ tx_id: "tx_hash..." });
const { pending } = await client.payment.pending("telegram_user_id");
const { history } = await client.payment.history("telegram_user_id");

PaymentApi

MethodReturnsDescription
nextIndex()Promise<{ next_index: number }>Next derivation index.
request(body)Promise<PaymentRequestResponse>Create payment request.
verify(body)Promise<PaymentVerifyResponse>Verify payment by tx_id.
pending(telegram_user_id)Promise<{ pending: PendingItem[] }>Pending payments.
history(telegram_user_id?)Promise<{ history: HistoryItem[] }>Payment history.

Types

  • PaymentRequestBody: derivation_index, deposit_address, telegram_user_id, plan_id, key_id?, amount_alph_min
  • PaymentRequestResponse: id, deposit_address, amount_alph_min, plan_id
  • PaymentVerifyResponse: success, upgraded?, plan_id?, key_prefix?, key?, keyId?
  • PendingItem / HistoryItem: see SDK types.