API reference
Agents
Agents with their own balance, key and spending policy.
On this page
POST/
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.
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The agent's address on the site and in the API. |
name | string | Yes | The agent's name. |
description | string | No | What it does. |
allowed_ | array or null | No | Model ids, or prefixes ending in *. |
allowed_ | array or null | No | Tool ids the agent may call. |
max_ | string or integer | No | The most one request may cost, in USDF base units. |
approval_ | string or integer | No | Requests that could cost more wait for the owner's approval. |
spend_ | string or integer | No | Caps over the trailing hour, day and month. |
public_ | boolean | No | List the agent's public page. |
identity_ | boolean | No | Register an onchain identity (ERC-8004). |
webhook_ | string | No | Where approval decisions are posted. |
POST /v1/agents
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/
One agent.
Auth: None
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Path. The agent's slug. |
days | integer | No | Query. For the owner: the window of its usage and record, in days. |
GET /v1/agents/{slug}
curl https://api.usdf.fi/v1/agents/{slug}PATCH/
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.
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Path. The agent's slug. |
PATCH /v1/agents/{slug}
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/
Moves balance to the agent.
Auth: Session, not an API key: Authorization: Bearer <session token>. See Sign in.
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Path. The agent's slug. |
units | string or integer | Yes | How much, in USDF base units. |
POST /v1/agents/{slug}/fund
curl -X POST https://api.usdf.fi/v1/agents/{slug}/fund \
-H "Authorization: Bearer $SESSION" \
-H "Content-Type: application/json" \
-d '{"units": "<units>"}'POST/
Issues the agent's API key.
Auth: Session, not an API key: Authorization: Bearer <session token>. See Sign in.
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Path. The agent's slug. |
POST /v1/agents/{slug}/key
curl -X POST https://api.usdf.fi/v1/agents/{slug}/key \
-H "Authorization: Bearer $SESSION"POST/
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_, from creating the agent) or the owner's session. Another key of the account is refused 403 not_.
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Path. The agent's slug. |
to | string | Yes | An agent's slug or an account id. |
units | string or integer | Yes | How much, in USDF base units. |
memo | string | No | A note for the payment. |
idempotency_ | string | No | Your id for this payment. |
approval_ | string | No | An approval the owner granted for it. |
POST /v1/agents/{slug}/pay
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/
Requests and payments waiting for the owner's approval.
Auth: The agent's own API key ($AGENT_, from creating the agent) or the owner's session. Another key of the account is refused 403 not_.
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Path. The agent's slug. |
limit | integer | No | Query. How many to return. |
GET /v1/agents/{slug}/approvals
curl https://api.usdf.fi/v1/agents/{slug}/approvals \
-H "Authorization: Bearer $AGENT_KEY"