Core concepts

Transactions & approvals

Every payment attempt is recorded: approved, refused, waiting or failed. These endpoints read that record, let owners decide approvals and report spend.
Code samples in

Transactions#

GET /api/transactions is the transaction terminal. Filters: agent, service, status and network (comma lists), from and to (YYYY-MM-DD, UTC, inclusive), seeded (include, exclude, only) and q (a payment, request or quote id, settlement reference, task id or name). The first page also carries totals for the same filters.

Statuses: requested, awaiting_approval, authorized, submitted, confirmed, delivered, rejected, failed, expired.

const BASE_URL = "https://cortexpay.vercel.app";

const res = await fetch(`${BASE_URL}/api/transactions?status=delivered,failed&from=2026-12-01&seeded=exclude&limit=25`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CORTEXPAY_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
console.log(data);
  • GET /api/transactions/export?format=csv|json returns the same filters as a file, up to 5,000 rows, with metadata only: no request bodies, service responses or signatures. CSV cells are protected against spreadsheet formula injection.
  • POST /api/transactions/:id/receipt publishes a shareable receipt at /r/<slug> for a settled, non-seeded payment; DELETE takes it down.

Approvals#

When a policy asks for approval, the request stops with status: "awaiting_approval" and an approvalId, an approval.requested webhook is sent, and owners see it in the app. An approval request expires after 60 minutes without a decision.

import { CortexPay } from "@cortexpay/sdk";

const cortex = new CortexPay({ apiKey: process.env.CORTEXPAY_API_KEY!, baseUrl: "https://cortexpay.vercel.app" });

const { data } = await cortex.approvals.list({ status: "pending" });
for (const a of data) console.log(a.id, a.agent.name, a.amountBase, a.reason);
Only people decide
POST /api/approvals/:id/approve and /reject (body { note? }) work only for an owner or admin in a signed-in session. An API key, and therefore an agent, always gets 403. Approving re-quotes the price, re-runs the ten checks and then pays; rejecting moves no funds.

Analytics#

GET /api/analytics/expenditure?range=1h|24h|7d|30d|all&agentId= returns spend figures for the workspace or one agent. GET /api/overview?range= returns the command-centre numbers. Both need analytics:read. Sandbox figures include seeded demo history and report how much of them is seeded, so it can be labelled.

import { CortexPay } from "@cortexpay/sdk";

const cortex = new CortexPay({ apiKey: process.env.CORTEXPAY_API_KEY!, baseUrl: "https://cortexpay.vercel.app" });

const spend = await cortex.analytics.expenditure({ range: "7d" });
console.log(spend);

Cortex Intelligence

POST /api/ai/chat answers questions about the workspace with read-only tools, and POST /api/analytics/reports writes a financial report from a fact sheet. Both need ai:use and spend infrastructure credits; GET /api/ai/chat says whether the assistant is available on this deployment and what a question costs. The assistant can explain and suggest, never pay or approve.

Network activity#

GET /api/network/activity lists this workspace's CortexPay events, not total activity on Elysium or HyperEVM. Filters: kind (comma list), agent, service, network, asset, since, until and seeded. Page with cursor (newest first), replay with order=asc, or tail with after=<id>.

Event kinds
request, quote, evaluated, approval_required, authorized, rejected, settled, delivered, failed, paused, resumed, revoked

Live stream

GET /api/network/stream is a Server-Sent Events stream: each message is event: events with a JSON array of events and the last event id. A connection lasts about 55 seconds; reconnect with Last-Event-ID or ?after= to resume where it stopped.

Read the stream
// Server-side (Node 18+). Browsers can use EventSource with the session cookie instead.
const res = await fetch("https://cortexpay.vercel.app/api/network/stream", {
  headers: { Authorization: `Bearer ${process.env.CORTEXPAY_API_KEY}`, Accept: "text/event-stream" },
});
const reader = res.body!.pipeThrough(new TextDecoderStream()).getReader();
let buffer = "";
for (;;) {
  const { value, done } = await reader.read();
  if (done) break; // the server closes after about 55 s: reconnect with ?after=<last id>
  buffer += value;
  const frames = buffer.split("\n\n");
  buffer = frames.pop() ?? "";
  for (const frame of frames) {
    const data = frame.split("\n").find((l) => l.startsWith("data: "));
    if (data) for (const event of JSON.parse(data.slice(6))) console.log(event.id, event.kind);
  }
}

Endpoints#

  • GET/api/transactions

    The transaction terminal: filters, sorting, cursor pagination.

    Key: payments:read · 120/min

  • GET/api/transactions/:id

    One payment with quote, fees, decision, authorization, timeline and delivery.

    Key: payments:read

  • GET/api/transactions/export

    The same filters as a CSV or JSON file (?format=csv|json).

    Key: payments:read · 12/min

  • POST/api/transactions/:id/receipt

    Publish a shareable receipt at /r/<slug> (settled, non-seeded payments).

    Key: payments:write · 30/min

  • DELETE/api/transactions/:id/receipt

    Take the public receipt down.

    Key: payments:write · 30/min

  • GET/api/notifications

    The 30 most recent notifications in the workspace.

    Any key

  • POST/api/notifications/read

    Mark notifications (or all) as read.

    Any key

  • GET/api/approvals

    Approval requests (status=pending|approved|rejected|expired|all; cursor).

    Key: payments:read

  • GET/api/approvals/:idNot available yet

    One approval request.

    Key: payments:read · Use GET /api/approvals?status=all and match the id.

  • POST/api/approvals/:id/approve

    Approve { note? }: re-quotes, re-runs the checks and pays.

    Session · owner/admin · Owners and admins in a signed-in session only; never an API key.

  • POST/api/approvals/:id/reject

    Reject { note? }. No funds move.

    Session · owner/admin · Owners and admins in a signed-in session only; never an API key.

  • GET/api/analytics/expenditure

    Expenditure figures (?range=1h|24h|7d|30d|all&agentId=).

    Key: analytics:read · 120/min

  • GET/api/overview

    Command-centre metrics for a range.

    Key: analytics:read

  • GET/api/analytics/reports

    Stored AI financial reports, newest first.

    Key: analytics:read · key's rate limit

  • POST/api/analytics/reports

    Build a report { range } from a fact sheet (AI; needs ai:use).

    Key: ai:use · 3/min

  • GET/api/analytics/reports/:id

    One stored report.

    Key: analytics:read · key's rate limit

  • GET/api/ai/chat

    Whether the assistant can answer now and what it costs.

    Key: ai:use · key's rate limit

  • POST/api/ai/chat

    Ask Cortex Intelligence { messages } (read-only tools).

    Key: ai:use · 10/min

  • GET/api/weekly

    The public Weekly Cortex Report (?week=YYYY-MM-DD).

    Public

  • GET/api/network/activity

    Workspace network events (kind, agent, service, network, asset, since, until, cursor, after).

    Key: payments:read

  • GET/api/network/activity/graph

    Agent and service nodes with payment edges for a range.

    Key: payments:read

  • GET/api/network/activity/requests

    Service requests between an agent and a service.

    Key: payments:read

  • GET/api/network/stream

    Server-Sent Events tail of network events (?after=<id>).

    Key: payments:read · 30/min

  • GET/api/network/status

    Public RPC health for HyperEVM and Elysium and whether live payments are on.

    Public