Agent402 / tools / memory-grant

Memory grant

$0.002 per call · USDC via x402 · POST /api/memory/grant

Share your namespace with another wallet so different agents can coordinate through it. Grant read or readwrite access to a grantee wallet, optionally with a TTL. This is the cross-agent sharing a single agent cannot provide for itself.

Input

FieldTypeDescription
grantee *string0x wallet to grant access to
mode *string"read" or "readwrite"
ttlSecondsnumberOptional: auto-expire the grant

Example output

{
  "owner": "0x…",
  "grantee": "0x1111…",
  "mode": "readwrite",
  "expiresAt": 1760086400
}

Try it — see the 402 challenge (free)

curl -i -X POST https://agent402.tools/api/memory/grant \
  -H "Content-Type: application/json" \
  -d '{"grantee":"0x1111111111111111111111111111111111111111","mode":"readwrite","ttlSeconds":86400}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

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/grant", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "grantee": "0x1111111111111111111111111111111111111111",
    "mode": "readwrite",
    "ttlSeconds": 86400
  }),
});

Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

Memory write

USDC $0.002 · POST /api/memory

Persistent key-value memory for agents, scoped to the paying wallet. Your x402 payment IS your authentication: the walle…

Memory read

USDC $0.001 · GET /api/memory

Read from a wallet-scoped namespace. ?key=… returns the stored value; omit key to list keys. Reads your own namespace by…

Memory counter

USDC $0.001 · POST /api/memory/incr

Atomically increment (or decrement) a numeric key and return the new value — a coordination primitive for counters, lock…