Getting started
/docs/agents/quickstart
Your agent's first paid call
In five lines of TypeScript, your agent will pay a live API on Solana devnet and get data back. No wallet code, no blockchain libraries, no seed phrases — just an API key you paste into an env var.
Time to first paid call: ~3 minutes.
Create an agent + grab its API key
- Open the dashboard and sign in with your Solana wallet (Sign-In-With-Solana).
- Press ⌘N (or click + New agent). Name your agent, pick a monthly spend cap in USDC, submit.
- A green banner appears with your agent's plaintext API key (format
pk_…). Copy it now — it's shown only once. Obscura stores only a hash. - Copy the agent's deposit address from its row and send USDC to it on Solana. Obscura sweeps the deposit into the agent's private balance automatically, usually within ~30 seconds.
your-agent/.envbash
OBSCURA_KEY=pk_abc…xyz
OBSCURA_BASE_URL=https://your-obscura-host.example.comWrite five lines
Create agent.ts and paste this in. Swap the URL for any paid
endpoint — here we're hitting a demo merchant we run on Solana devnet
that charges $0.01 per article.
agent.tsts
import { Obscura } from "@obscura-app/sdk";
const agent = new Obscura({
apiKey: process.env.OBSCURA_KEY!,
baseUrl: process.env.OBSCURA_BASE_URL!,
});
const res = await agent.fetch(
"https://your-merchant.example.com/article/42",
);
console.log(await res.json());Run it:
terminalbash
npx tsx --env-file=.env agent.ts
# You should see:
# { id: 42, headline: 'Solana breaks 10k TPS again', body: '…', publishedAt: '2026-04-28T…' }What's next
- How it works — the full x402 handshake, end to end.
- Error handling — every
ObscuraErrorCodeand when to retry. - Advanced usage — custom
fetch, pointing at a local Obscura instance, AbortSignal + RequestInit pass-through.