Get started

Accounts, keys and balances.

Sign in, link a wallet, fund a balance, and give each key its own limits.

On this page

An account gives you API keys, its own Foundry wallet, a Foundry balance, credits, claim links, and a linked X account and wallet. Buying, swapping, redeeming and pay per request work with a wallet alone.

Sign in at /auth. Each section below names the dashboard tab that does the same with no code.

The samples show the calls themselves. Each one takes the signed-in session's access token as a Bearer token:

Authorization: Bearer <session token>

  • Samples read the token from $SESSION. The SDK reads USDF_SESSION_TOKEN, and the command line stores one with usdf login --token -.
  • GET /v1/auth names the sign-in in force and the endpoints it takes.
  • A session lasts about an hour. An expired or signed-out one gets 401: sign in again.
  • Managing keys, withdrawing and creating links take a session, not an API key.

A linked wallet is where deposits come from and withdrawals go to. Linking it takes one signature. On the dashboard: Balance.

1. Ask for the message

Request

curl
curl -X POST https://api.usdf.fi/v1/account/wallet/nonce \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"address": "<wallet address>"}'

Response

{ "nonce": "<nonce>", "message": "<message to sign>", "expires_in_seconds": … }

2. Sign it

Sign message with personal_sign from the wallet.

Request

curl
curl -X POST https://api.usdf.fi/v1/account/wallet \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "<wallet address>",
    "signature": "<personal_sign of the message>",
    "nonce": "<nonce>"
  }'

Response

{
  "wallet_address": "<wallet address>",
  "credited_units": "<units>",
  "signature": { "kind": "eoa" }
}

The rules:

  • One wallet per account, and a wallet belongs to one account.
  • It can be replaced only while the account and the agents it owns together hold under 0.10 USDF. Withdraw first, then link the new wallet.
  • Contract wallets (a Safe, a smart account) link through ERC-1271.
  • USDF sent from a wallet that is not linked is held until that wallet is linked.

Four ways to add to the balance. Sending USDF is on the dashboard under Balance.

WayHowCredited
Send USDFTo your own Foundry wallet: its address is deposit.to in GET /v1/account, null until you turn the wallet on. Foundry's own wallets take no deposits.After confirmations, usually within a minute or two
The Buy page/buyAs the transaction confirms
Any tokenPay with any tokenAs the swap confirms
Buy by cardGET /v1/account/deposit/card returns the card widget's settings for the account and the purchase the payment becomes; /history lists purchasesOnce the USDG it delivers is converted to USDF

A card purchase is paid in the card provider's own window; the gateway never sees the card. Its status moves through pending, paid, swapping, delivered, minted and credited, or ends failed or refunded with nothing credited. Foundry charges no fee: what arrives is credited 1:1 as USDF, and the provider's own fee is in its quote before you pay. GET /v1/account/deposit/card/history lists each purchase with what was paid, delivered and credited.

Integrators never handle USDG themselves. A wallet with USDC or PYUSD on Ethereum, or USDC on Arbitrum, adds to a balance in one flow, and a balance or a payout goes back out as USDC or USDG on Arbitrum or Ethereum. The wallet signs and sends every order itself, so the funds go from the wallet to the recipient, never through Foundry. The gateway quotes each order and follows it until it lands.

StepCall
The routes served now, each with its minimumGET /v1/transit/routes, with ?purpose=deposit or ?purpose=cashout
A quote: the transaction to sign, what is received, the fee and the expected timePOST /v1/transit/quote
The quote recorded as the account's order, before the wallet sends itPOST /v1/transit/orders with quote_token and purpose
The hash of the transaction the wallet sentPOST /v1/transit/orders/{id}/submitted
The order until it landsGET /v1/transit/orders/{id}, or any order on the network: GET /v1/transit/network/orders/{order_id}

Send exactly the quote's transaction.value: the messaging fee on a route between chains, 0 on one chain. An order moves through quoted, submitted and stuck, and ends fulfilled, failed or expired.

Payouts as USDC

Providers, Mac operators and marketplace sellers are paid on Robinhood Chain. PUT /v1/account/payout-preference sets how payouts are converted: USDC or USDG on Arbitrum (42161) or Ethereum (1), to the linked wallet's own address there, or to an address set from the signed-in session after a recent sign-in. With a preference, each paid payout carries convert, the conversion filled in. GET /v1/transit/payout/steps returns what the wallet holds and the steps it signs in order: USDF redeemed 1:1 for USDG when needed, the approval when needed, then the order with exactly its value. Record the order with purpose payout before the wallet sends it.

In the SDKs: usdf.transit.depositFrom adds funds in one call, usdf.transit.cashout cashes out, usdf.transit.payoutPreference sets how payouts are converted, and usdf.transit.wait follows an order until it lands. See SDKs.

Create keys on the dashboard (API Keys), or with the API under a session. A key is shown once; only its hash is kept.

Create a key

curl
curl -X POST https://api.usdf.fi/v1/account/keys \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "research",
    "budget_units": "5000000"
  }'

Response, 201

{
  "object": "api_key",
  "key_id": "<key_id>",
  "api_key": "sk_…",
  "prefix": "<prefix>",
  "note": "Shown once: store the key now. It spends from this account's balance."
}

The key endpoints:

EndpointWhat it does
POST /v1/account/keysCreates a key: label, budget_units (a lifetime spend limit), rate_limit_rpm, and project_id to make it in a project.
GET /v1/account/keysActive keys. ?state=revoked lists revoked ones; ?count=1 counts them.
PATCH /v1/account/keys/{id}Changes label, budget_units or rate_limit_rpm; clear_budget removes the budget; project_id moves the key (null takes it out of its project).
POST /v1/account/keys/{id}/rotateA new key with the old one's controls; the old key is revoked in the same step. See Rotate a key.
DELETE /v1/account/keys/{id}Revokes the key.

An account's active keys, the keys it creates in an hour and each key's requests a minute have their limits; a key's is No limit (1–5999 req/min, configurable)

Each key can carry hourly, daily and monthly caps, a model allowlist, a pause, privacy flags and a webhook. Set them with PATCH /v1/keys/{id} under the session. On the dashboard: API Keys, then Key controls.

ParameterTypeNotes
spend_limit_hour_units, spend_limit_day_units, spend_limit_month_unitsString of units, or nullTrailing hour, day and 30 days. Null clears the cap.
allowed_modelsArray, or nullModel ids, or a prefix ending in *. Null allows every listed model; [] allows none.
pausedBooleanA manual pause is never lifted by the gateway. Requests get 403 key_paused.
no_logsBooleanWhile true, prompt and completion text are never written anywhere. True unless the key opts in with retain.
retainBooleantrue keeps this key's requests in the account's request logs; false keeps the key in no-logs mode whatever the account's setting.
private_tierBooleanEvery request runs on attested routes. Implies no_logs.
webhook_urlString, or nullHttps on a public host. Receives pause and resume events.
guardrailsObject, or nullThe key's own rules: allowed_providers, blocked_providers, max_price, zdr_only, redact and injection. The account's guardrails apply too, and the stricter wins. Null removes the key's.
expires_atTime, or nullWhen the key stops serving. See Expiry.
ip_allowlistArray, or nullThe addresses the key serves from. See IP allowlist.

An unknown field refuses the whole request, and everything is checked before anything is written. A request for a model the list does not allow gets 403 model_not_allowed and costs nothing.

Set caps and an allowlist

curl
curl -X PATCH https://api.usdf.fi/v1/keys/<key_id> \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "spend_limit_hour_units": "1000000",
    "spend_limit_day_units": "5000000",
    "spend_limit_month_units": "50000000",
    "allowed_models": ["deepseek-v4.1-flash", "qwen*"],
    "webhook_url": "https://example.com/usdf-hooks"
  }'

Pause a key

curl
curl -X PATCH https://api.usdf.fi/v1/keys/<key_id> \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"paused": true}'

Read a key's state with GET /v1/keys/{id}/limits:

Read a key's limits

curl
curl https://api.usdf.fi/v1/keys/<key_id>/limits \
  -H "Authorization: Bearer $SESSION"

Response, trimmed

{
  "key_id": "<key_id>",
  "spend": {
    "hour": {
      "window": "…", "spent_units": "<units>", "limit_units": "1000000",
      "remaining_units": "<units>", "at_limit": false
    },
    "day": { … },
    "month": { … }
  },
  "models": { "allowed": ["deepseek-v4.1-flash", "qwen*"], "enforced": true, … },
  "paused": { "state": false, "at": null, "reason": null, "auto_resume": null },
  "privacy": { "no_logs": false, "private_tier": false, … },
  "webhook": { "url": "https://example.com/usdf-hooks", … }
}

A key pauses by itself at a cap or at zero balance, and resumes by itself:

ReasonResumes when
zero_balanceA deposit lands.
hour_limit, day_limit, month_limitThe trailing window moves on.
manualThe owner sets paused to false.

Two more controls on PATCH /v1/keys/{id} limit where and until when a key works. On the dashboard: API Keys, then Key safety.

FieldEffect
expires_atA time with its offset. Past it, every request on the key gets 401 key_expired. A later time, or null, serves the key again. To stop a key now, pause or revoke it.
ip_allowlistIPv4 or IPv6 addresses or CIDR blocks. A request from any other address gets 403 ip_not_allowed. null allows any address; an empty list is refused.

Nothing is held or charged on a refused request. The address is the caller's as the gateway sees it: your_ip in GET /v1/keys/safety shows yours.

Set an expiry and an allowlist

curl
curl -X PATCH https://api.usdf.fi/v1/keys/<key_id> \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "expires_at": "<time>",
    "ip_allowlist": ["<IPv4 or IPv6 address>", "<CIDR block>"]
  }'

Read every key's safety

GET /v1/keys/safety lists every active key: when it was made and last used, and from which address, its expiry and allowlist, the last request refused for either, and its flags. Each flag also lists the keys that carry it: never_used, stale, old, expired, expiring_soon, no_expiry, no_ip_allowlist, no_spend_limit, paused and refused_recently. thresholds gives the day counts behind them.

Read key safety

curl
curl https://api.usdf.fi/v1/keys/safety \
  -H "Authorization: Bearer $SESSION"

Response, trimmed

{
  "object": "key_safety",
  "your_ip": "<your address>",
  "keys": [
    {
      "key_id": "<key_id>",
      "label": "research",
      "last_used": { "at": "<time>", "ip": "<address>", … },
      "expires_at": "<time>",
      "ip_allowlist": ["<CIDR block>"],
      "refused": { "ip": "<address>", "at": "<time>", "reason": "ip_not_allowed" },
      "flags": ["refused_recently"],
      …
    }
  ],
  "never_used": [ … ], "stale": [ … ], "old": [ … ], "expired": [ … ], "expiring_soon": [ … ], "refused_recently": [ … ],
  "thresholds": { … }
}

Rotate a key

POST /v1/account/keys/{id}/rotate makes a new key with the old one's label, scope and every control: what is left of its budget, the rate limit, the caps, the model allowlist, the pause, the flags, the webhook, the guardrails and its project. The old key is revoked in the same step: both happen, or neither. The new key's trailing windows start empty, and it is shown once.

Rotate a key

curl
curl -X POST https://api.usdf.fi/v1/account/keys/<key_id>/rotate \
  -H "Authorization: Bearer $SESSION"

Response, 201

{
  "object": "api_key",
  "key_id": "<new key_id>",
  "api_key": "sk_…",
  "prefix": "<prefix>",
  "rotated_from": "<key_id>",
  "old_key_revoked": true,
  "kept": { … },
  "note": "Shown once: store the key now. The old key is revoked; …"
}

An agent's key rotates with POST /v1/agents/{slug}/key.

A project groups keys under one monthly budget. It belongs to the account, or to a team with ?org=: a team's owner and admins make and change its projects, and every member reads them. On the dashboard: API Keys, and each team under Teams.

EndpointWhat it does
GET /v1/projectsThe projects, live ones first, newest first. state: active (default), archived or all; org; limit and before to page. max_live is the most live projects an owner may hold.
POST /v1/projectsMakes one: name, and budget_units for a monthly budget (leave it out for none).
GET /v1/projects/{id}Its budget and what is left, what its requests did this UTC month, and its live keys.
PATCH /v1/projects/{id}Changes name or budget_units (null removes the budget).
POST /v1/projects/{id}/archiveIts keys leave it and keep working in no project. It is never changed again, and its usage keeps it. This cannot be undone.

Make a project with a budget

curl
curl -X POST https://api.usdf.fi/v1/projects \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"name": "research", "budget_units": "20000000"}'

Response, 201, trimmed

{
  "object": "project",
  "id": "prj_…",
  "name": "research",
  "budget": {
    "limit": { "units": "20000000", … },
    "spent": { … }, "held": { … }, "left": { … },
    "month": "<YYYY-MM>",
    "resets_at": "<time>"
  },
  "key_count": …,
  "archived": false,
  "links": { "self": "…", "archive": "…", "usage": "…", "activity": "…" },
  …
}

A key is in at most one project. Make it there with project_id on POST /v1/account/keys, or move it later:

Move a key into a project

curl
curl -X PATCH https://api.usdf.fi/v1/account/keys/<key_id> \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"project_id": "<project_id>"}'

A team key takes project_id on POST /v1/orgs/{id}/keys too, and moves with PATCH /v1/orgs/{id}/keys/{key_id}.

The monthly budget

  • The budget caps what the project's keys are charged from the balance in a UTC calendar month. The count starts again at midnight UTC on the first of the month (budget.resets_at).
  • A request that does not fit in what is left gets 402 project_budget_exceeded and costs nothing. Without max_tokens, a request's output shrinks to what is left.
  • What credit pays is not counted. A key's own budget and caps still hold beside the project's: the tighter wins.
  • Lowering a budget below what was spent stops the project's keys until the month ends.

Usage by project: GET /v1/analytics/series?group_by=project, or ?project= with a project id (none: keys in no project). The same project filter works on GET /v1/account/activity.

The gateway posts JSON events to https URLs you set. On the dashboard, set a key's under API Keys and the low-balance alert's under Settings. An agent's is set with PATCH /v1/agents/{slug}.

Event typeSet withCarriesDeduplicate on
key.paused, key.resumedwebhook_url on PATCH /v1/keys/{id}The key, the reason, the trailing spend and the capsevent_id
approval.decidedThe agent's webhook_urlThe agent, the action and the owner's decision (status)approval_id
batch.done, batch.failed, batch.expiredThe job's webhook_urlThe job, its cost, and its result once doneid, the job id
balance.lowlow_balance_units and low_balance_webhook_url in the account settingsThe available balance and the thresholdevent_id
key.spend_threshold, account.spend_threshold, model.price_changed, model.deprecated, notification.testwebhook_url in the notification rulesThe rule and what it measurednotification_id
  • Each event is a JSON POST. A success status is delivery; anything else, a redirect included, is a failure.
  • Failed deliveries are retried, then given up. Deduplicate on the field above: a retry can repeat an event.
  • A URL must be https on a public host.
  • Every delivery to a URL your account set is signed with the account's own secret. See Webhook signatures.

One body of each kind. A key.resumed event has the same fields, with spend set to null. Money is { "units", "usd", "usdf" }, as everywhere.

key.paused

{
  "type": "key.paused",
  "event_id": "<event id>",
  "key_id": "<key_id>",
  "key_prefix": "<prefix>",
  "label": "research",
  "reason": "day_limit",
  "spend": { "hour": { … }, "day": { … }, "month": { … } },
  "limits": { "hour": { … }, "day": { … }, "month": { … } },
  "month_read_at": "<time>",
  "at": "<time>",
  "gateway": "https://api.usdf.fi"
}

approval.decided

{
  "type": "approval.decided",
  "approval_id": "<id>",
  "agent_id": "<agent id>",
  "action": "Run the research batch",
  "status": "approved",
  "decided_at": "<time>",
  "gateway": "https://api.usdf.fi"
}

batch.done, trimmed

{
  "type": "batch.done",
  "id": "batch_…",
  "status": "done",
  "model": "<model>",
  "provider": "<provider>",
  "usage": { … },
  "cost": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
  "error": null,
  "result": { "choices": [ … ], "receipt": { … }, … },
  "poll": "https://api.usdf.fi/v1/batches/batch_…",
  "result_url": "https://api.usdf.fi/v1/batches/batch_…/result",
  "receipt": "https://api.usdf.fi/v1/receipts/batch_…",
  "ended_at": "<time>",
  "gateway": "https://api.usdf.fi"
}

balance.low

{
  "type": "balance.low",
  "event_id": "<event id>",
  "account_id": "<account id>",
  "available": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
  "threshold": { "units": "<units>", "usd": "<usd>", "usdf": "<usdf>" },
  "at": "<time>",
  "gateway": "https://api.usdf.fi",
  "note": "…"
}

Before acting on an event, read the state it reports from the gateway itself:

EventRead
key.paused, key.resumedGET /v1/keys/{id}/limits
approval.decidedGET /v1/agents/{slug}/approvals
batch.done, batch.failed, batch.expiredGET /v1/batches/{id}
balance.lowGET /v1/account/overview

Every webhook delivery to a URL your account set is signed with the account's own secret: notifications, the low-balance alert, a key's pause and resume, an agent's approvals and a batch job's result. A platform's sub-key and a team member's key set their own URLs, so those deliveries carry no account signature.

EndpointWhat it does
GET /v1/account/webhook-secretThe secret, when it was made and when it was last rotated. Made now if the account has none.
POST /v1/account/webhook-secretA new secret. The old one stops signing at once.

Both take the signed-in session only. The first secret is also made when the account first saves a webhook URL or is first sent a delivery.

Read the secret

curl
curl https://api.usdf.fi/v1/account/webhook-secret \
  -H "Authorization: Bearer $SESSION"

Response

{
  "object": "webhook_secret",
  "enabled": true,
  "secret": "whsec_…",
  "created_at": "<time>",
  "rotated_at": null,
  "header": "x-usdf-signature",
  "timestamp_header": "x-usdf-timestamp",
  "destination_header": "x-usdf-destination",
  "note": "…"
}

Rotate the secret

curl
curl -X POST https://api.usdf.fi/v1/account/webhook-secret \
  -H "Authorization: Bearer $SESSION"

Each signed delivery carries three headers:

HeaderValue
x-usdf-timestampThe Unix time, in seconds, the delivery was signed at.
x-usdf-destinationThe URL it was sent to, exactly as you saved it.
x-usdf-signaturev1= and the hex HMAC-SHA256, keyed by the secret, of the timestamp, a newline, the URL, a newline and the raw body.

To verify a delivery:

  • Recompute the signature with the URL you saved (not the header's: it only tells you which of your URLs it was meant for) and the body exactly as received, before parsing it.
  • Compare in constant time.
  • Refuse a timestamp more than 300 seconds from your own clock.
  • Deliveries are at least once: deduplicate on the event's id (notification_id, event_id, approval_id or the job's id).

Signing the URL means a body signed for one of your receivers does not verify at another, and the timestamp means it cannot be replayed later.

Check a saved delivery with openssl

SECRET='whsec_…'
URL='https://example.com/usdf-hooks'   # the URL you saved
TS='<x-usdf-timestamp>'
SIG='<x-usdf-signature>'
# body.json: the delivery's raw body, saved as received
WANT="v1=$( { printf '%s\n%s\n' "$TS" "$URL"; cat body.json; } | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.*= //')"
NOW=$(date +%s)
[ "$WANT" = "$SIG" ] && [ $(( NOW - TS )) -le 300 ] && [ $(( TS - NOW )) -le 300 ] && echo verified || echo refused

Verify a delivery

import { createHmac, timingSafeEqual } from "crypto";

export function verify(secret: string, url: string, rawBody: string, timestamp?: string, signature?: string): boolean {
  if (!timestamp || !/^\d+$/.test(timestamp) || !signature) return false;
  if (Math.abs(Math.floor(Date.now() / 1000) - Number(timestamp)) > 300) return false;
  const want = Buffer.from("v1=" + createHmac("sha256", secret).update(`${timestamp}\n${url}\n${rawBody}`).digest("hex"));
  const got = Buffer.from(signature);
  return want.length === got.length && timingSafeEqual(want, got);
}

Rules the account sets. Each notification is posted to one webhook, and emailed too when email is on and the gateway sends email. On the dashboard: Settings, then Alerts.

EndpointWhat it does
GET /v1/account/notifications/rulesThe webhook, the email state, each rule with what it fired, the low-balance alert and the account's limits.
PUT /v1/account/notifications/rulesThe fields sent replace what they name; one left out is kept. rules replaces every rule ([] removes them all; a rule sent again keeps what it fired). PATCH and POST are taken the same.
GET /v1/account/notificationsThe last 90 days of notifications, newest first, each with its data and what became of its webhook and email. limit and before to page.
POST /v1/account/notifications/testOne signed notification.test POST to the webhook, answered with what the receiver said. 409 no_webhook when none is set.

The rules:

KindFieldsFires
key_spendkey_id (or null for every key with a limit), percentA key's spend reached that share of one of its limits: the trailing hour, day or month, or its budget. Once per crossing; again after the spend falls back below.
account_spendperiod (day or month), threshold in USDF or threshold_unitsThe account's spend in the UTC day or month reached the threshold. Once per period.
model_changeNoneA model the account used in the last 30 days changed its price or left the price sheet. Once per change.
balance_lowthreshold in USDF, or nullThe low-balance alert: the same setting as low_balance_units. With no low-balance webhook of its own, it goes to this webhook and email.

Each rule takes "enabled": false to keep it without firing. The answer's limits give the most rules, the most key_spend rules and the most notifications sent an hour; past that an hour's notifications are kept and listed, not sent.

Set the rules

curl
curl -X PUT https://api.usdf.fi/v1/account/notifications/rules \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_url": "https://example.com/usdf-hooks",
    "email": true,
    "rules": [
      {"kind": "key_spend", "key_id": null, "percent": 80},
      {"kind": "account_spend", "period": "day", "threshold": "25"},
      {"kind": "model_change"}
    ],
    "balance_low": {"threshold": "5"}
  }'

email.state says whether email goes out: off, not_configured (this gateway sends no email), no_address (the sign-in has no verified email) or ready.

Send a test

curl
curl -X POST https://api.usdf.fi/v1/account/notifications/test \
  -H "Authorization: Bearer $SESSION"

Response

{
  "object": "notification_test",
  "ok": true,
  "status": …,
  "error": null,
  "signed": true,
  "at": "<time>"
}

key.spend_threshold, trimmed

{
  "type": "key.spend_threshold",
  "notification_id": "<id>",
  "account_id": "<account id>",
  "rule_id": "<rule id>",
  "kind": "key_spend",
  "at": "<time>",
  "data": {
    "key_id": "<key_id>",
    "key_label": "research",
    "window": "day",
    "percent": …,
    "spent": { … },
    "limit": { … }
  },
  "gateway": "https://api.usdf.fi",
  "note": "…"
}

GET /v1/account/settings reads the account's defaults and PATCH changes them. They apply to the next request from every key on the account. On the dashboard: Settings.

FieldEffect
zdrZero retention is already the default wherever a zero-retention route exists. true also refuses every model marked provider may keep data.
data_collection"deny": only routes that do not train on content.
sort"price" or "latency": the order routes are tried in.
provider_allow, provider_denyRoute types to allow or exclude: hosted, network or private.
allow_fallbacksfalse: the first route only, with no failover.
max_price{ input, output } in USD per 1M tokens.
no_logs_default, private_tier_defaultFlags for keys created after they are set.
retaintrue turns on the account's request logs: its keys' requests are kept for 30 days, except a key set to no-logs on its own and a Private-tier key.
low_balance_units, low_balance_webhook_urlThe low-balance alert.

Change the defaults

curl
curl -X PATCH https://api.usdf.fi/v1/account/settings \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "zdr": true,
    "data_collection": "deny",
    "sort": "price",
    "no_logs_default": true,
    "low_balance_units": "2000000",
    "low_balance_webhook_url": "https://example.com/usdf-hooks"
  }'

A request's own provider field overrides the routing defaults; zdr: true and data_collection: "deny" hold whatever a request sends.

See routing defaults in detail

Everything the dashboard shows is an endpoint. All take the session. On the dashboard: Activity and Analytics.

EndpointReturns
GET /v1/account/overviewBalance, held, available, recent spend, top models, the last deposit and withdrawal.
GET /v1/account/activity, .csvEvery request, newest first, with filters: key, model, status, provider (the route type: hosted, network or private), project, min_cost_units, from, to. Each row links to its detail, and to its request log while your request logs keep one (logging on, 30 days). The next page: cursor.
GET /v1/requests/{request_id}One request in full. Below.
GET /v1/account/usage, /usage/unsettledUsage rows, and those not in a settlement batch.
GET /v1/account/depositsDeposits, newest first.
GET /v1/account/withdrawalsWithdrawals, newest first.
GET /v1/account/deposits/{tx_hash}/{log_index}/receipt.jsonA numbered receipt (DR-…) for one credited deposit, also as .pdf: the amount, the sender, the transaction, when it was credited and whether it is final.
GET /v1/statementsEvery month of the account, newest first, with its statement number (ST-…) and state: open, closing, closed or issued.
GET /v1/statements/{YYYY-MM}.csvA monthly statement, also as .pdf or .json.
GET /v1/analytics, .csvSpend by day, model and tool. ?days= and ?key=. A key can read its own.
GET /v1/analytics/series, .csv, .pdfRequests, refunds, spend, tokens and latency by the hour or the day. Below.

One request in full

GET /v1/requests/{request_id} takes the answer's id or its x-request-id. It returns the route that served the request and every route tried, the fallbacks, the finish reason, latency, tokens, the cost by who paid it, the preset, the settlement and links to the receipt and the log proof. A session reads the account's requests, with the logged prompt and response where they were kept (bodies); a key reads only its own, without the texts.

Read one request

curl
curl https://api.usdf.fi/v1/requests/<request_id> \
  -H "Authorization: Bearer $SESSION"

Response, trimmed

{
  "object": "request",
  "id": "<request_id>",
  "model": "deepseek-v4.1-flash",
  "provider": "<provider>",
  "status": "ok",
  "finish_reason": "stop",
  "route": { "provider": "<provider>", "why": "cheapest", … },
  "attempts": [{ "provider": "<provider>", "outcome": "served", … }],
  "latency": { "total_ms": …, "ttft_ms": …, "generation_ms": …, "overhead_ms": … },
  "usage": { "prompt_tokens": …, "completion_tokens": …, "cached_tokens": …, "total_tokens": … },
  "cost": { "total": { … }, "charged": { … }, "free_credit": { … }, … },
  "preset": null,
  "settlement": { "status": "unsettled", … },
  "bodies": { "available": false, "reason": "no_logs" },
  "links": { "receipt": "…", "proof": "…", … }
}

Usage over time

GET /v1/analytics/series takes a session or a key (a key reads its own usage). Every bucket is listed, and every series has a point for each:

ParameterValues
buckethour or day.
rangeA rolling window ending now: 1h, 24h, 7d, 30d or 90d. Or from and to.
group_bynone, model, key, provider (the route type: hosted, network or private), member (with org) or project.
key, model, provider (the route type: hosted, network or private), projectFilters.
orgA team you are a member of: its usage.
topThe groups kept, largest spend first; the rest are one group, _other.

The answer's exports link the same view as .csv and .pdf, and query is the query string that reproduces it. A window that is too long by the hour is refused with 400 window_too_long: ask by the day.

Statements

A month is open while it runs and closing for a day after it ends. Once closed, its first read issues it, with its number; from then on every read, in any format, is that statement, never changed, and the list gives its sha256. An older account's first read can answer 503 statement_issuing while the earlier months are issued: try again.

A team (an org) is a balance its members share. Its keys spend from the team's balance. Every team route takes a session. On the dashboard: Teams.

EndpointWhat it does
GET /v1/orgsThe teams you belong to.
POST /v1/orgsCreates a team with a name. You become its owner.
GET /v1/orgs/{id}Members, invites, keys, usage and funding.
POST /v1/orgs/{id}/membersInvites by email or account_id, as admin, member or viewer, or changes a member's role. Owner or admin.
GET /v1/orgs/invitesThe open invites addressed to you.
POST /v1/orgs/invites/{invite}/accept, /declineJoins the team with the invite's role, or declines.
DELETE /v1/orgs/{id}/invites/{invite}Withdraws an open invite. Owner or admin.
DELETE /v1/orgs/{id}/members/{account_id}Removes a member (owner or admin), or leaves (yourself).
POST /v1/orgs/{id}/fundMoves units of your available balance into the team's. Owner or admin.
POST /v1/orgs/{id}/defundMoves units of the team's available balance back to the owner. Owner.
DELETE /v1/orgs/{id}Deletes the team. Its available balance moves back to the owner first; then every team key stops working, and its members and open invites are removed. Refused while requests on its keys are in flight. Owner.
POST /v1/orgs/{id}/leaveLeaves the team. Any team keys you made stop working at once. Anyone but the owner.
POST /v1/orgs/{id}/keysCreates a team key: label, budget_units, rate_limit_rpm, project_id. Owner or admin.
DELETE /v1/orgs/{id}/keys/{key_id}Revokes a team key. The owner revokes any; an admin, any the owner did not create.

Roles are owner, admin, member and viewer. The owner is the creator and cannot be removed or leave; the owner deletes the team instead. Membership is by invite: an account joins only when it accepts with its own session.

A viewer reads the team (its balance, members, keys, usage and projects) and changes nothing of it: no key, funding, member, invite, role or project. It holds no team key, so it spends nothing of the team's balance. A member set to viewer loses the team keys it made.

Your balance has two parts: USDF, which is money (backed 1:1, withdrawable, redeemable), and credits, which pay for compute. GET /v1/balance returns them separately, each credit grant with what is left of it and its expiry date.

  • Credits are free compute in your Foundry account, spent before your USDF.
  • Credits pay for models and Foundry's own tools. Marketplace services, agent payments and payment links are paid in USDF.
  • Credits stay in the account they were granted to and are spent there.
  • Credits last 60 days from the day they are granted, unless a grant says otherwise. Unused credit goes back to the pool.

Session and dashboard calls are limited per account. Signed in, each limit is listed here, read live from GET /v1/limits.

See limits on requests and payments

Foundry documentation

Confirm it's you

Confirm to continue the action you started.

Checking confirmation options…