> For the complete documentation index, see [llms.txt](https://docs.sectoral.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sectoral.xyz/developer-api/agents.md).

# Agent and Policy Endpoints

Use these endpoints to create agent accounts and control their spend policies programmatically. With just a few requests, an agent gets a wallet of its own, wrapped in limits that are actually enforced. For the underlying ideas, read [Spend Policy Engine](/ai-agents/policy-engine.md).

***

## Register a new agent

```
POST /v1/accounts/me/agents
```

### Body

```json
{
  "name": "research-bot",
  "spend_policy": {
    "daily_limit_usdg": 500.00,
    "per_transaction_limit_usdg": 50.00,
    "allowed_recipients": ["api.market", "*.anthropic.com"],
    "assets": ["USDG"],
    "active_hours": "00:00-23:59",
    "hitl_threshold_usdg": 25.00
  }
}
```

### Response

```json
{
  "account_id": "acct_9d3a2f",
  "handle": "@yourname/research-bot",
  "public_key": "9d3a2fXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "status": "active",
  "spend_policy_id": "policy_4471"
}
```

***

## Update a policy

```
PATCH /v1/agents/{account_id}/spend-policy
```

You can send only part of the policy. Fields included in the request are updated, and all others keep their current values.

```json
{
  "per_transaction_limit_usdg": 75.00,
  "hitl_threshold_usdg": 40.00
}
```

Updates apply to every payment the agent attempts to sign after this request, and settled payments are unaffected. You can make limits stricter or looser while the agent keeps running.

***

## Get a policy

```
GET /v1/agents/{account_id}/spend-policy
```

### Response

```json
{
  "policy_id": "policy_4471",
  "daily_limit_usdg": 500.00,
  "per_transaction_limit_usdg": 75.00,
  "allowed_recipients": ["api.market", "*.anthropic.com"],
  "assets": ["USDG"],
  "active_hours": "00:00-23:59",
  "hitl_threshold_usdg": 40.00,
  "updated_at": "2026-07-02T10:11:00Z"
}
```

***

## Approve or reject a held payment

Payments over `hitl_threshold_usdg` are held instead of being signed automatically, so the important ones always come down to your decision.

```
POST /v1/agents/transactions/{transaction_id}/approve
POST /v1/agents/transactions/{transaction_id}/reject
```

Each call responds with the new state of the transaction. Approving signs and submits it right away. Rejecting drops the request without moving any funds.

***

## List pending payments

```
GET /v1/agents/transactions/pending
```

### Response

```json
{
  "pending": [
    {
      "transaction_id": "tx_5c1e2a",
      "agent": "@yourname/research-bot",
      "to": "compute-provider.io",
      "requested_at": "2026-07-02T14:00:00Z",
      "expires_at": "2026-07-03T14:00:00Z"
    }
  ]
}
```

As elsewhere in the API, amounts are left out because they are encrypted and can only be read by decrypting on the client with your key. When you open a pending approval in the dashboard, it does that decryption locally.

***

## Error responses

| Status | Code                    | Description                                                            |
| ------ | ----------------------- | ---------------------------------------------------------------------- |
| `400`  | `invalid_policy`        | One of the policy fields is not valid (a negative limit, for example)  |
| `403`  | `not_agent_owner`       | That agent belongs to a different account than the one making the call |
| `404`  | `transaction_not_found` | There is no pending transaction with that ID                           |
| `409`  | `transaction_expired`   | The time allowed for approval has run out                              |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sectoral.xyz/developer-api/agents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
