{"@context":"https://schema.org","@type":"TechArticle","headline":"cron402 agent integration guide","description":"How AI agents integrate with cron402: create scheduled webhooks, pay per run via x402 USDC micropayments on Base, and manage jobs with EIP-712 wallet signatures.","proficiencyLevel":"Expert","dependencies":"Any x402 client (e.g. @x402/fetch) and a funded USDC wallet on Base","apiReference":{"@type":"APIReference","url":"https://cron402-api.user-defaults.workers.dev/v1/openapi.json"}}Docs — cron402

Agent integration guide

cron402 is a pure x402 resource server. Every paid endpoint follows the same dance: request → 402 Payment Required → sign USDC payment (EIP-3009) → retry with payment header. Use any x402 client — @x402/fetch is the drop-in option.

1. Create a cron job

npm install @x402/fetch @coinbase/cdp-sdk
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { CdpClient } from "@coinbase/cdp-sdk";
import { applySpendControls, fromCdpEvmAccount } from "@coinbase/cdp-sdk/x402";

// Coinbase Agentic Wallet (no private key handling in your code)
const cdp = new CdpClient();
const account = await cdp.evm.getOrCreateAccount({ name: "my-agent" });

const client = new x402Client().register(
  "eip155:8453",                       // Base mainnet
  // "eip155:8453",                     // base mainnet
  new ExactEvmScheme(fromCdpEvmAccount(account)),
);
applySpendControls(client, { maxAmountPerPayment: { atomic: 100_000n } }); // $0.10 cap

const fetchWithPayment = wrapFetchWithPayment(globalThis.fetch, client);

const res = await fetchWithPayment(`https://cron402-api.user-defaults.workers.dev/v1/crons`, {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    schedule: "*/5 * * * *",
    target: {
      url: "https://your-agent.example/tick",
      method: "POST",
      body: JSON.stringify({ hello: "world" })
    }
  }),
});
const { id } = await res.json();

2. Check status & execution log

const status = await fetch(`https://cron402-api.user-defaults.workers.dev/v1/crons/${id}`).then(r => r.json());
// { credits: 9, status: "active", nextRunAt: 1755000000000,
//   executions: [{ runAt, ok, statusCode, durationMs }, ...] }

3. Top up run credits ($0.008 / run)

await fetchWithPayment(`https://cron402-api.user-defaults.workers.dev/v1/crons/topup/10`, {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ jobId: id }),
});

4. Pause / resume / delete (wallet-signed)

Management actions require an EIP-712 signature over ManageJob { action } from the payer's key.

const message = {
  action: "pause",                      // "pause" | "resume" | "delete"
  jobId: id,
  timestamp: Date.now(),                // valid for ±5 minutes
};
const signature = await account.signTypedData({
  domain: { name: "cron402", version: "1" },
  types: { ManageJob: [
    { name: "action", type: "string" },
    { name: "jobId", type: "string" },
    { name: "timestamp", type: "uint256" },
  ]},
  primaryType: "ManageJob",
  message,
});

await fetch(`https://cron402-api.user-defaults.workers.dev/v1/crons/${id}/pause`, {
  method: "POST",
  headers: {
    "x-cron402-timestamp": String(message.timestamp),
    "x-cron402-signature": signature,
  },
});

API reference

All cron402 endpoints. Machine-readable version: openapi.json
EndpointAuthDescription
POST /v1/cronsx402 · $0.008Create job (includes 1 credit)
POST /v1/crons/topup/1|10|100x402 · $0.008/$0.08/$0.80Add run credits
GET /v1/crons/:idfreeStatus + last executions
GET /v1/openapi.jsonfreeOpenAPI 3.1 machine-readable spec
POST /v1/crons/:id/pausewallet-signedPause job
POST /v1/crons/:id/resumewallet-signedResume job (needs credits)
DELETE /v1/crons/:idwallet-signedDelete job

Limits & policies

  • Min interval 1 minute · max 1,000 active jobs per wallet
  • Failed dispatches retry 3× with backoff, then the job auto-pauses
  • Jobs with zero credits pause automatically; top up to reactivate
  • Execution logs kept: last 100 runs or 30 days per job
  • Live on **Base mainnet** (eip155:8453). Testnet was eip155:84532.
cron402 docs