Priors API

The credit record of any agent enrolled in Priors: who backs it, its line, what it has repaid, its score, and the pool's and the stock vault's figures; and images and 5-second video clips made to order. Each endpoint has its own price, from 0.02 to 0.45 USDG a call on Robinhood Chain, paid per request with x402 v2. No account, no key.

Endpoints

requestpricereturns
GET /v1/report/:agentId0.03 USDGPriors credit report: identity, backer, line, available, record, score, open loans and recent history of one ERC-8004 agent, and the stock collateral behind a stock line
GET /v1/score/:agentId0.03 USDGPriors score of one ERC-8004 agent, with its default and freeze flags, and the Priors Score v2 breakdown (rung, components, x402 income) when published
GET /v1/file/:agentId0.10 USDGPriors due-diligence file on one ERC-8004 agent: its credit report, repayment profile, Score v2 and next rung, its owner's other agents and record, its backer's ledger, and the flags to read before a deal
GET /v1/explain/:agentId0.02 USDGPriors Score v2 of one agent explained: each part with its points, its maximum and the room left, and the next rung with what it still needs, in plain words
POST /v1/screen0.05 USDGPriors screen of up to 50 agent ids or owner addresses in one call: for each, whether Priors knows it, a verdict (defaulted, late, frozen, borrowing, repaid, enrolled, unknown), its score and Score v2 rung
GET /v1/wallet/:address0.03 USDGPriors footprint of one address: the agents it owns and their verdicts, the loans it took as an owner, whether a default marked it, what it lent to the pool or staked, and its owner's Ethos score
GET /v1/income/:agentId0.03 USDGPriors income statement of one agent: the fees it paid as a borrower, its fee share as a backer, its x402 income over 30 days (from Score v2), and month by month for the last 6 months
GET /v1/pool/day0.02 USDGPriors pool figures for one UTC day (today so far by default): loans borrowed and repaid, fees and their split, defaults, agents active and joined, lenders' deposits, and for today the pool now
POST /v1/watch0.03 USDGPriors watch on up to 50 agents: each one's open loans with their due dates and state (on time, due within 24 hours, late, defaultable) and its last default
GET /v1/late0.02 USDGEvery Priors loan past due now (late, or defaultable after its grace), with its agent and backer, and the defaults of the last 30 days
GET /v1/backer/:agentId0.05 USDGPriors ledger of one backer (a pool root): the loans it backed, repaid, late and defaulted, the agents it backs now with their lines and state, and its fee share
GET /v1/stock-line/:symbol0.02 USDGPriors stock line sizing: how many tokens of one stock the vault needs for a line of that size (?line=<USDG>), at the token's loan-to-value and the vault's own valuation, and whether it fits the vault's limits and holds now
GET /v1/stocks/holds0.02 USDGPriors stock vault holds: each accepted stock token, whether it takes new lines now and why not (its hold), its loan-to-value, its room under its cap, and the vault's largest line and room this week
GET /v1/credit/:agentId0.03 USDGPriors credit history of one agent: every loan on both pools, newest first, 100 a page (?page=), each with its dates, state and the transactions that prove it on Robinhood Chain
POST /v1/media/image0.05 USDGPriors image from a text prompt (Higgsfield Soul 2, 1080p, one image), under strict content rules checked before payment: answers a media id at once, and GET /v1/media/{id} (free) gives the image's URL when it is done
POST /v1/media/video0.45 USDGPriors 5-second video clip from a text prompt, or from an image Priors made (image_id), under strict content rules checked before payment (Higgsfield Kling 2.5 Turbo): answers a media id at once, and GET /v1/media/{id} (free) gives the clip's URL when it is done
GET /v1/media/:idfreea media id's status, and when it is done its output URLs and when they expire
GET /healthfreestatus, snapshot block and age, payment settings and each route's price
GET /openapi.jsonfreethese routes as OpenAPI 3.1, each with its price
GET /freethis page

Data comes from what Priors publishes: the snapshot of the pool (priors.trade/api/snapshot, at most about 30 seconds old), Score v2, the desk ledger, the stock vault's tokens and the owners' Ethos scores, each read at most once a minute. Every answer says which block it reflects in asOf. USDG amounts are decimal strings.

Every route checks its input and its data before it asks for payment: a malformed input is a 400, what Priors does not know a 404 (an agent not enrolled, an address with no agent, loan, deposit or stake, a stock the vault does not take, a backer that is not a pool root), and data that is not there a 503 with Retry-After. Nothing is charged for any of them.

A line backed by the stock vault (the agent's own stock tokens) carries collateral in the report: token, symbol, amount (in tokens), value (what the vault values them at, null while it will not), ltvBps, borrowRoom, hold (0, or why new loans wait: 1 a price jump, 2 a multiplier change, 3 a paused token, 4 a blocked vault), status and closing. Its available is the smaller of the pool's figure and borrowRoom. borrowRoom is 0, with refused saying why, when every loan would be refused whatever the vault's own figure: the agent changed hands since its position opened, defaulted, is frozen, or its owner has a default. Every other line has collateral: null. On any line, a default marked on the owner's account (on any of its agents) makes available 0 and adds ownerDefaulted: true: the pool lends to none of that owner's agents.

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, and the stock collateral behind a stock line",
    "mimeType": "application/json",
    "serviceName": "Priors"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:4663",
      "amount": "30000",
      "asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
      "payTo": "0x949206e4aF666C9FA5BfD527c7822358dB648Cf8",
      "maxTimeoutSeconds": 300,
      "extra": {
        "name": "Global Dollar",
        "version": "1"
      }
    }
  ]
}

Send the signed payment in PAYMENT-SIGNATURE, with the same request (for a POST, the same body). 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. Requests carrying a payment are limited per address: past the limit you get 429 with Retry-After, and nothing is charged.

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.10" }); // the dearest credit route (a video clip is 0.45); each call pays its own price
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 (100000 = 0.10, the dearest credit route;
  // 450000 for a video clip)
  spendControls: { allowedAssets: [{ network: "eip155:4663", asset: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", maxAmountPerPayment: "100000" }] },
});
const paid = wrapFetchWithPayment(fetch, client);
const score = await paid("https://api.priors.trade/v1/score/462");
const screen = await paid("https://api.priors.trade/v1/screen", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ agents: [462, 7633] }) });

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.