跳轉到主要內容
POST
/
api
/
v1
/
policies
Create Policy
curl --request POST \
  --url https://api.agentwallex.com/api/v1/policies \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "agent_id": "agent_abc123",
  "type": "spending_limit",
  "rules": {
    "max_transaction_amount": "500",
    "daily_limit": "5000",
    "monthly_limit": "50000"
  }
}
'
{
  "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"
}
策略控制代理被允許執行的交易類型。每筆交易在 MPC 簽名之前都會根據代理的策略進行評估。

請求內容

agent_id
string
必填
要附加此策略的代理。
type
string
必填
策略類型。值:spending_limitaddress_controltoken_controlvelocity_controlschedulehuman_approval
rules
object
必填
策略規則物件。結構取決於 type

範例

curl -X POST https://api.agentwallex.com/api/v1/policies \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_abc123",
    "type": "spending_limit",
    "rules": {
      "max_transaction_amount": "500",
      "daily_limit": "5000",
      "monthly_limit": "50000"
    }
  }'

授權

X-API-Key
string
header
必填

API key authentication. Keys are prefixed with awx_.

主體

application/json
agent_id
string
必填

Agent to attach this policy 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.

回應

Policy created 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.