Priors API

The credit record of any agent enrolled in Priors: who backs it, its line, what it has repaid, its score. 0.01 USDG a call on Robinhood Chain, paid per request with x402 v2. No account, no key.

Endpoints

requestpricereturns
GET /v1/report/:agentId0.01 USDGPriors credit report: identity, backer, line, available, record, score, open loans and recent history of one ERC-8004 agent
GET /v1/score/:agentId0.01 USDGPriors score of one ERC-8004 agent, with its default and freeze flags
GET /healthfreestatus, snapshot block and age, payment settings
GET /freethis page

Data comes from the public snapshot of the pool (priors.trade/api/snapshot), at most about 30 seconds old; every answer says which block it reflects in asOf. USDG amounts are decimal strings. An unknown agent is a 404 and a malformed id a 400, both before any payment is asked.

Payment

{
  "x402Version": 2,
  "error": "Payment required",
  "resource": {
    "url": "https://api.priors.trade/v1/report/462",
    "description": "Priors credit report: identity, backer, line, available, record, score, open loans and recent history of one ERC-8004 agent",
    "mimeType": "application/json",
    "serviceName": "Priors"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:4663",
      "amount": "10000",
      "asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
      "payTo": "0x949206e4aF666C9FA5BfD527c7822358dB648Cf8",
      "maxTimeoutSeconds": 300,
      "extra": {
        "name": "Global Dollar",
        "version": "1"
      }
    }
  ]
}

Send the signed payment in PAYMENT-SIGNATURE. The API verifies it, builds the answer, settles, and returns 200 with a PAYMENT-RESPONSE header (the settlement: transaction hash, payer, network). If settlement fails you get a 402 and no data; if the answer cannot be built nothing is settled.

Pay with @priors/x402

import { ethers } from "ethers";
import { createPayer, robinhood } from "@priors/x402";

const signer = new ethers.Wallet(process.env.AGENT_KEY, new ethers.JsonRpcProvider(robinhood.rpcUrl));
const { pay } = createPayer({ signer, maxPrice: "$0.01" });
const { response } = await pay("https://api.priors.trade/v1/report/462");
console.log(await response.json());

It can also borrow the gap from the agent's own Priors line when its wallet is short (see the package README).

Pay with any x402 v2 client

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = x402Client.fromConfig({
  schemes: [{ network: "eip155:4663", client: new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)) }],
  // USDG is not one of @x402's built-in assets: allow it, capped per payment
  spendControls: { allowedAssets: [{ network: "eip155:4663", asset: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", maxAmountPerPayment: "10000" }] },
});
const res = await wrapFetchWithPayment(fetch, client)("https://api.priors.trade/v1/score/462");

Why pay for this

A Priors score is earned by borrowing and repaying real USDG under a backer whose stake pays if the agent defaults. It cannot be bought or farmed, so it is a useful thing to check before you trust, pay or lend to an agent.