API reference

Agents

Agents with their own balance, key and spending policy.

On this page

POST/v1/agents

Creates an agent with its own balance, key and spending policy. The agent's key is in the answer, shown once.

Auth: Session, not an API key: Authorization: Bearer <session token>. See Sign in.

NameTypeRequiredDescription
slugstringYesThe agent's address on the site and in the API.
namestringYesThe agent's name.
descriptionstringNoWhat it does.
allowed_modelsarray or nullNoModel ids, or prefixes ending in *.
allowed_toolsarray or nullNoTool ids the agent may call.
max_request_unitsstring or integerNoThe most one request may cost, in USDF base units.
approval_threshold_unitsstring or integerNoRequests that could cost more wait for the owner's approval.
spend_limit_hour_units, spend_limit_day_units, spend_limit_month_unitsstring or integerNoCaps over the trailing hour, day and month.
public_pagebooleanNoList the agent's public page.
identity_opt_inbooleanNoRegister an onchain identity (ERC-8004).
webhook_urlstringNoWhere approval decisions are posted.

POST /v1/agents

curl
curl -X POST https://api.usdf.fi/v1/agents \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"slug": "research-agent", "name": "Research agent", "max_request_units": "<units>"}'

GET/v1/agents/{slug}

One agent.

Auth: None

NameTypeRequiredDescription
slugstringYesPath. The agent's slug.
daysintegerNoQuery. For the owner: the window of its usage and record, in days.

GET /v1/agents/{slug}

curl
curl https://api.usdf.fi/v1/agents/{slug}

PATCH/v1/agents/{slug}

Changes an agent's settings and policy: any field POST /v1/agents takes but slug.

Auth: Session, not an API key: Authorization: Bearer <session token>. See Sign in.

NameTypeRequiredDescription
slugstringYesPath. The agent's slug.

PATCH /v1/agents/{slug}

curl
curl -X PATCH https://api.usdf.fi/v1/agents/{slug} \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"approval_threshold_units": "1000000", "public_page": true}'

POST/v1/agents/{slug}/fund

Moves balance to the agent.

Auth: Session, not an API key: Authorization: Bearer <session token>. See Sign in.

NameTypeRequiredDescription
slugstringYesPath. The agent's slug.
unitsstring or integerYesHow much, in USDF base units.

POST /v1/agents/{slug}/fund

curl
curl -X POST https://api.usdf.fi/v1/agents/{slug}/fund \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{"units": "<units>"}'

POST/v1/agents/{slug}/key

Issues the agent's API key.

Auth: Session, not an API key: Authorization: Bearer <session token>. See Sign in.

NameTypeRequiredDescription
slugstringYesPath. The agent's slug.

POST /v1/agents/{slug}/key

curl
curl -X POST https://api.usdf.fi/v1/agents/{slug}/key \
  -H "Authorization: Bearer $SESSION"

POST/v1/agents/{slug}/pay

An agent-to-agent payment. The same idempotency key returns the first receipt instead of paying twice.

Auth: The agent's own API key ($AGENT_KEY, from creating the agent) or the owner's session. Another key of the account is refused 403 not_this_agent.

NameTypeRequiredDescription
slugstringYesPath. The agent's slug.
tostringYesAn agent's slug or an account id.
unitsstring or integerYesHow much, in USDF base units.
memostringNoA note for the payment.
idempotency_keystringNoYour id for this payment.
approval_idstringNoAn approval the owner granted for it.

POST /v1/agents/{slug}/pay

curl
curl -X POST https://api.usdf.fi/v1/agents/{slug}/pay \
  -H "Authorization: Bearer $AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "<agent slug>", "units": "<units>", "memo": "Data fee", "idempotency_key": "<your id>"}'

GET/v1/agents/{slug}/approvals

Requests and payments waiting for the owner's approval.

Auth: The agent's own API key ($AGENT_KEY, from creating the agent) or the owner's session. Another key of the account is refused 403 not_this_agent.

NameTypeRequiredDescription
slugstringYesPath. The agent's slug.
limitintegerNoQuery. How many to return.

GET /v1/agents/{slug}/approvals

curl
curl https://api.usdf.fi/v1/agents/{slug}/approvals \
  -H "Authorization: Bearer $AGENT_KEY"
Foundry documentation

Confirm it's you

Confirm to continue the action you started.

Checking confirmation options…