Core Concepts
Understand the key concepts behind Agnic - X402, wallets, tokens, and transaction flows.
Core Concepts
Before diving into the API, it helps to understand the key concepts that power Agnic.
The X402 Protocol
X402 is a proposed HTTP status code (like 404 for "Not Found") that means "Payment Required". When an API returns 402, it includes authorization instructions that tell the client how to access the resource.
How X402 Works
Why X402?
| Traditional APIs | X402 APIs |
|---|---|
| Sign up for each service | One wallet for all APIs |
| Manage multiple API keys | Use-per-request, no subscriptions |
| Monthly billing cycles | Instant microtransactions |
| Manual approval needed | Automated transactions |
Authorization Schemes
Agnic supports two X402 authorization schemes:
Exact Scheme (EIP-3009)
- How it works: TransferWithAuthorization - funds transfer exactly on use
- Best for: One-time transactions, precise billing
- Chains: Base (EVM), Solana
Upto Scheme (EIP-2612)
- How it works: Permit - pre-authorize up to an amount
- Best for: Streaming responses, variable costs
- Chains: Base (EVM)
Agnic automatically detects and handles both schemes.
Wallets
Embedded Wallets
When you sign up, Agnic creates an embedded wallet for you using Privy. This wallet:
- Is non-custodial (you control the keys)
- Works on Base and Solana
- Holds USDC for transactions
- Supports delegation for automated signing
Delegation (Session Signers)
To enable automated transactions, you delegate signing authority to Agnic:
- You set spending limits (per-transaction, daily, monthly)
- You sign a delegation message
- Agnic can sign authorizations within your limits
- You can revoke access anytime
Delegation never gives Agnic access to your full balance - only the ability to sign authorizations within your specified limits.
API Tokens
API tokens authenticate requests to Agnic. Each token has:
| Property | Description |
|---|---|
maxPerTransaction | Maximum USD per single transaction |
dailyLimit | Total USD allowed per 24 hours |
monthlyLimit | Total USD allowed per 30 days |
networks | Allowed networks (Base, Solana) |
label | Your custom label |
Token Types
| Prefix | Type | Use Case |
|---|---|---|
agnic_tok_ | API Token | Direct API access |
agnic_at_ | OAuth Access Token | User-authorized apps |
agnic_rt_ | OAuth Refresh Token | Refresh access tokens |
Spending Limits
Spending limits protect you from unexpected charges:
Networks
Agnic supports multiple blockchain networks:
| Network | Token | Use Case |
|---|---|---|
| Base (Mainnet) | USDC | Production transactions |
| Base Sepolia | USDC (testnet) | Development/testing |
| Solana | USDC | Production transactions |
| Solana Devnet | USDC (devnet) | Development/testing |
OAuth tokens are restricted to mainnet networks only (Base, Solana). API tokens can access testnets.
Credits
New users receive $5 in free credits. Credits are used before your wallet balance and:
- Never expire
- Work on all networks
- Are non-transferable
- Don't require funding your wallet