跳转到主要内容
POST
/
api
/
v1
/
webhooks
Create Webhook
curl --request POST \
  --url https://api.agentwallex.com/api/v1/webhooks \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "url": "https://your-app.com/webhooks/agentwallex",
  "events": [
    "payment.completed",
    "payment.failed",
    "policy.violated"
  ],
  "secret": "whsec_your_signing_secret"
}
'
{
  "id": "whk_abc123",
  "url": "https://your-app.com/webhooks/agentwallex",
  "events": [
    "payment.completed",
    "payment.failed",
    "policy.violated"
  ],
  "status": "active",
  "created_at": "2025-06-01T10:00:00Z"
}
注册新的 Webhook 端点,通过 HTTP POST 接收实时事件通知。

请求体

url
string
必填
接收 Webhook 事件的 HTTPS URL。
events
string[]
必填
要订阅的事件类型列表。有关可用事件类型,请参阅 Webhooks
secret
string
必填
用于验证 Webhook 负载的签名密钥。必须以 whsec_ 开头。

示例

curl -X POST https://api.agentwallex.com/api/v1/webhooks \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/agentwallex",
    "events": ["payment.completed", "payment.failed", "policy.violated"],
    "secret": "whsec_your_signing_secret"
  }'
Response
{
  "id": "whk_abc123",
  "url": "https://your-app.com/webhooks/agentwallex",
  "events": ["payment.completed", "payment.failed", "policy.violated"],
  "status": "active",
  "created_at": "2025-06-01T10:00:00Z"
}

授权

X-API-Key
string
header
必填

API key authentication. Keys are prefixed with awx_.

请求体

application/json
url
string<uri>
必填

The HTTPS URL that will receive webhook events.

events
string[]
必填

List of event types to subscribe to (e.g., payment.completed, payment.failed, policy.violated).

secret
string
必填

Signing secret used to verify webhook payloads. Must start with whsec_.

响应

Webhook created successfully.

A registered webhook endpoint for receiving real-time event notifications.

id
string

Unique webhook identifier (e.g., whk_abc123).

url
string<uri>

HTTPS URL that receives webhook events.

events
string[]

List of subscribed event types.

status
enum<string>

Webhook status.

可用选项:
active,
inactive
created_at
string<date-time>

ISO 8601 creation timestamp.