跳转到主要内容
PUT
/
api
/
v1
/
policies
/
{id}
Update Policy
curl --request PUT \
  --url https://api.agentwallex.com/api/v1/policies/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "rules": {
    "max_transaction_amount": "1000",
    "daily_limit": "10000"
  }
}
'
{
  "id": "<string>",
  "agent_id": "<string>",
  "type": "spending_limit",
  "rules": {
    "max_transaction_amount": "<string>",
    "daily_limit": "<string>",
    "monthly_limit": "<string>",
    "allowed_addresses": [
      "<string>"
    ],
    "blocked_addresses": [
      "<string>"
    ],
    "allowed_tokens": [
      "<string>"
    ],
    "max_count": 123,
    "window_seconds": 123,
    "timezone": "<string>",
    "allowed_hours": {
      "start": 11,
      "end": 11
    },
    "allowed_days": [
      4
    ],
    "threshold": "<string>",
    "timeout_seconds": 123,
    "approvers": [
      "jsmith@example.com"
    ]
  },
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

路径参数

id
string
必填
要更新的策略 ID(例如 pol_abc123)。

请求体

rules
object
必填
更新后的策略规则对象。结构取决于策略的 type

示例

curl -X PUT https://api.agentwallex.com/api/v1/policies/pol_abc123 \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "rules": {
      "max_transaction_amount": "1000",
      "daily_limit": "10000"
    }
  }'

授权

X-API-Key
string
header
必填

API key authentication. Keys are prefixed with awx_.

路径参数

id
string
必填

The policy ID to update (e.g., pol_abc123).

请求体

application/json
rules
object
必填

Policy rules object. Structure depends on the policy type.

响应

Policy updated successfully.

A policy that controls what transactions an agent is allowed to execute.

id
string

Unique policy identifier (e.g., pol_abc123).

agent_id
string

Agent this policy is attached to.

type
enum<string>

Policy type.

可用选项:
spending_limit,
address_control,
token_control,
velocity_control,
schedule,
human_approval
rules
object

Policy rules object. Structure depends on the policy type.

created_at
string<date-time>

ISO 8601 creation timestamp.

updated_at
string<date-time>

ISO 8601 last-update timestamp.