Skip to main content

API Reference

On-chain vs API

amser gives you two ways to read protocol state. Direct on-chain calls via viem or ethers are authoritative and trustless — but they require an RPC endpoint and extra infrastructure. The amser Indexer API reads state from the chain, requires only an API key, and returns pre-computed fields like next_charge_date and status that would otherwise require multiple contract calls to derive. Both approaches are correct. Choose based on your trust requirements and operational constraints.

TaskOn-chainAPI
Check if a subscriber is activeisActive(address, planId)GET /v0/auth/check
List all subscriptions for a merchantMultiple contract readsGET /v0/subscriptions/:merchant
Get plan detailsgetPlan(planId)GET /v0/modules/:moduleAddress/plans
Monitor payment historyParse eventsGET /v0/activity/:merchant
Check failed paymentsParse eventsGET /v0/failures/:merchant

Conventions

  • All response body fields use snake_case.
  • All query parameters use snake_case.
  • All webhook payload fields use snake_case.
  • Numeric values that exceed JavaScript's safe integer range (> 2^53) are returned as strings. This applies to on-chain IDs, amounts, and block numbers.
  • Amounts are always returned in token base units as strings (e.g. USDC with 6 decimals: "10000000" = 10 USDC). Use token_decimals to format for display.

Base URL

https://api.amser.io

Authentication

All endpoints except GET /v0/tokens and GET /v0/auth/check require authentication. Two auth methods are accepted:

API key (recommended for server-side read operations):

Authorization: Bearer amsr_live_xxxxxxxxxxxxx

SIWE session (required for write operations and the dashboard):

Cookie: sid=<jwt>

API keys are read-only — they work for GET requests only. Creating webhooks, API keys, or modifying settings requires a SIWE session. This is enforced server-side; a 403 is returned if a write is attempted with an API key.

See the API Keys page for key generation, rotation, and security guidelines.

Endpoint reference

PageEndpoints
SubscriptionsSubscription state and authorization checks
PlansPlan details by merchant or module
ActivityPayment history, failures, and revenue reporting
TokensSupported payment tokens and per-token constraints
  • API Keys — Generate and manage server-side credentials
  • Authentication — SIWE, API keys, and on-chain gating patterns
  • Webhooks — Receive real-time event notifications