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. Send POST /api/memory/grant with the required fields grantee and mode and pay $0.002 per call over x402 with USDC on an EVM chain (the paying wallet is the identity). It returns a JSON object with owner, grantee, mode and expiresAt.

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.

Category: Agent memory & coordination · Tags: memory grant sharing coordination multi-agent acl

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
granteestringyes0x wallet to grant access to
modestringyes"read" or "readwrite"
ttlSecondsnumbernoOptional: auto-expire the grant

Example request

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

Without payment this returns HTTP 402 Payment Required with the exact price for memory-grant; any x402 v2 or MPP client pays it and retries.

Example response

{
  "owner": "0x…",
  "grantee": "0x1111…",
  "mode": "readwrite",
  "expiresAt": 1760086400
}
FieldTypeAlways presentIn the example
ownerstringyes0x…
granteestringyes0x1111…
modestringyesreadwrite
expiresAtnumberyes1760086400

From an MCP client

catalog.call {
  "slug": "memory-grant",
  "params": {
    "grantee": "0x1111111111111111111111111111111111111111",
    "mode": "readwrite",
    "ttlSeconds": 86400
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for memory-grant; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY (wallet only for this tool). Local install: npx -y agent402-mcp.

Errors and behavior

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();
client.setSpendControls?.(false); // keep your own spending ceiling in code
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
  }),
});

Related tools

Memory grants list

$0.001 · GET /api/memory/grants

List the wallets you've granted access to your namespace, with their mode and expiry.

Memory revoke

$0.001 · POST /api/memory/revoke

Revoke a previously granted wallet's access to your namespace.

Memory compare-and-set

$0.001 · POST /api/memory/cas

Atomically write (or release) a key only if its current value equals `expected` - the coordination primitive for distrib…

Memory counter

$0.001 · POST /api/memory/incr

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

Memory forget

$0.001 · POST /api/memory/forget

Delete a remembered document by id from the recall store.

Memory audit log

$0.001 · GET /api/memory/log

Tamper-evident history of every change to a namespace - an append-only, hash-chained audit log the server attests to (pr…