POST /api/memory/recallRecall remembered text by similarity to a query (ranked by cosine similarity), not by exact key. Returns the top-k matches with scores. The retrieval half of the wallet-scoped semantic memory.
| Field | Type | Description |
|---|---|---|
query * | string | Natural-language query |
k | number | How many matches (1-50, default 5) |
owner | string | Optional 0x namespace (requires a grant) |
{
"query": "why did the deployment break",
"results": [
{
"id": "abc123",
"score": 0.62,
"text": "The deploy failed because…"
}
]
}
curl -i -X POST https://agent402.tools/api/memory/recall \
-H "Content-Type: application/json" \
-d '{"query":"why did the deployment break","k":3}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/memory/recall", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"query": "why did the deployment break",
"k": 3
}),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).
POST /api/memoryPersistent key-value memory for agents, scoped to the paying wallet. Your x402 payment IS your authentication: the walle…
GET /api/memoryRead from a wallet-scoped namespace. ?key=… returns the stored value; omit key to list keys. Reads your own namespace by…
POST /api/memory/incrAtomically increment (or decrement) a numeric key and return the new value — a coordination primitive for counters, lock…