Chuyển đến nội dung chính
Apidly Cloud
Chính sách cookie

Cookie phân tích và quảng cáo luôn tắt trừ khi bạn chấp nhận. Chính sách cookie

Chúng tôi muốn dùng Google Analytics và Microsoft Clarity để hiểu cách các trang công khai được sử dụng, gồm lượt xem trang và bản ghi phiên, cùng Reddit Pixel để đo xem quảng cáo của chúng tôi trên Reddit có mang lại lượt truy cập và đăng ký hay không. Bạn chọn tại đây xem chúng có được bật hay không. Từ chối không thay đổi cách trang web hoạt động.

Tài liệu tham chiếu API: Webhook

Các thao tác API v1 cho Webhook: scope, tham số, ví dụ bằng curl, JavaScript và Python, và phản hồi.

Cập nhật lần cuối 21 tháng 11, 2026Đọc trong 6 phút
Xem dưới dạng Markdown

Webhook: mọi thao tác của API v1 kèm scope cần có, tham số, ví dụ bằng curl, JavaScript và Python, cùng phản hồi. Xác thực, lỗi, phân trang, giới hạn tốc độ và tính idempotent nằm trong tổng quan tài liệu API; xem thêm SDK và dòng lệnh.

Thử với khóa của bạn: tạo khóa API trong bảng điều khiển, chạy export APIDLY_API_KEY=... trong terminal rồi dán một ví dụ curl bên dưới. Giá trị trong ví dụ chỉ mang tính minh họa. Trang này không có ô nhập khóa.

Mô tả của các thao tác và trường lấy từ định nghĩa API và giữ nguyên tiếng Anh.

Thao tác Scope cần có Tóm tắt
GET /webhooks full Endpoint webhook và các loại sự kiện bạn có thể đăng ký
POST /webhooks full Tạo endpoint webhook
DELETE /webhooks/{id} full Xóa endpoint webhook
PATCH /webhooks/{id} full Thay đổi endpoint webhook
GET /webhooks/{id}/deliveries full Nhật ký gửi của một endpoint, mới nhất trước
POST /webhooks/{id}/rotate-secret full Cấp bí mật ký mới
POST /webhooks/{id}/test full Gửi sự kiện thử
POST /webhooks/deliveries/{deliveryId}/redeliver full Gửi lại một lần gửi trước đó

GET /webhooks

Endpoint webhook và các loại sự kiện bạn có thể đăng ký

Webhook endpoints carry signing details, so reading them needs webhooks.manage, which only the full scope reaches: a read or servers key gets 403 insufficient_scope.

Scope cần có: full · Vai trò người tạo: admin · Quyền: webhooks.manage

Ví dụ yêu cầu (curl)

curl "https://apidly.com/api/v1/webhooks" \
  -H "Authorization: Bearer $APIDLY_API_KEY"

JavaScript (SDK)

await apidly.webhooks.list();

Python (SDK)

client.webhooks.list()

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "webhooks": [
    {
      "id": "example",
      "url": "https://example.com/hook",
      "format": "json",
      "events": [
        "example"
      ],
      "description": "example",
      "active": false,
      "disabledReason": "example",
      "secretHint": "example",
      "consecutiveFailures": 1,
      "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
      "lastSuccessAt": "2026-11-21T10:00:00.000Z",
      "createdAt": "2026-11-21T10:00:00.000Z",
      "secret": "example"
    }
  ],
  "events": [
    "example"
  ],
  "max": 1
}

Trạng thái lỗi: 401, 403, 429.

POST /webhooks

Tạo endpoint webhook

The signing secret is shown only in this response. format picks the body: json (default, signed) or a chat app (slack, discord, teams), whose URL must be that app's incoming-webhook address (400 url_not_chat_webhook otherwise). Chat messages carry no signature header and never contain secrets, variable values or connection details.

Scope cần có: full · Vai trò người tạo: admin

Nội dung yêu cầu

Tên Kiểu Bắt buộc Mô tả
url string có
format json | slack | discord | teams không json (default): the signed JSON envelope. slack, discord, teams: a short message in the organization's language, posted in that app's incoming-webhook shape, with no signature header; the URL must be that app's incoming-webhook address.
description string không
events mảng server.requested | server.approved | server.rejected | server.provisioning | server.running | server.stopped | server.interrupted | server.failed | server.destroyed | server.resumed | server.offline | server.back_online | server.disk_low | server.gpu_idle | server.rental_ending | server.rental_ended | plan.available | endpoint.created | endpoint.paused | endpoint.resumed | endpoint.scaled | endpoint.job.completed | payment.failed | balance.low | balance.exhausted | balance.topped_up | invoice.created | budget.threshold | alert.triggered | member.invited | member.joined | member.removed | api_key.created | api_key.revoked | api_key.rotated | api_key.updated | transfer.completed | transfer.failed | transfer.unverified | volume.created | volume.deleted | server.contract_expiring | server.contract_expired có Event types to receive. server.contract_expiring and server.contract_expired are deprecated names of server.rental_ending and server.rental_ended, removed after 2027-05-31: a new subscription cannot select them (400 invalid_body); one that already lists an old name keeps it and receives the event under that old name until then, and under the current name after.

Ví dụ yêu cầu (curl)

curl -X POST "https://apidly.com/api/v1/webhooks" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hook","events":["server.requested"]}'

JavaScript (SDK)

await apidly.webhooks.create({
  url: "https://example.com/hook",
  events: [
    "server.requested"
  ]
});

Python (SDK)

client.webhooks.create(url="https://example.com/hook", events=["server.requested"])

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (201)

{
  "webhook": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "endpoint": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "secret": "example"
}

Trạng thái lỗi: 400, 401, 403, 429.

DELETE /webhooks/{id}

Xóa endpoint webhook

Scope cần có: full · Vai trò người tạo: admin

Tham số

Tên Vị trí Kiểu Bắt buộc Mô tả
id path string có

Ví dụ yêu cầu (curl)

curl -X DELETE "https://apidly.com/api/v1/webhooks/webhook_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY"

JavaScript (SDK)

await apidly.webhooks.delete("webhook_example");

Python (SDK)

client.webhooks.delete("webhook_example")

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "ok": false
}

Trạng thái lỗi: 401, 403, 404, 429.

PATCH /webhooks/{id}

Thay đổi endpoint webhook

Any of url, format, description, events and active. A new url or format is checked together (400 url_not_chat_webhook when a chat format gets an address that is not that app's). The secret is never returned; rotate it with POST /webhooks/{id}/rotate-secret.

Scope cần có: full · Quyền: webhooks.manage

Tham số

Tên Vị trí Kiểu Bắt buộc Mô tả
id path string có

Nội dung yêu cầu

Tên Kiểu Bắt buộc Mô tả
url string không
format json | slack | discord | teams không json (default): the signed JSON envelope. slack, discord, teams: a short message in the organization's language, posted in that app's incoming-webhook shape, with no signature header; the URL must be that app's incoming-webhook address.
description string không
events mảng server.requested | server.approved | server.rejected | server.provisioning | server.running | server.stopped | server.interrupted | server.failed | server.destroyed | server.resumed | server.offline | server.back_online | server.disk_low | server.gpu_idle | server.rental_ending | server.rental_ended | plan.available | endpoint.created | endpoint.paused | endpoint.resumed | endpoint.scaled | endpoint.job.completed | payment.failed | balance.low | balance.exhausted | balance.topped_up | invoice.created | budget.threshold | alert.triggered | member.invited | member.joined | member.removed | api_key.created | api_key.revoked | api_key.rotated | api_key.updated | transfer.completed | transfer.failed | transfer.unverified | volume.created | volume.deleted | server.contract_expiring | server.contract_expired không Event types to receive. server.contract_expiring and server.contract_expired are deprecated names of server.rental_ending and server.rental_ended, removed after 2027-05-31: a new subscription cannot select them (400 invalid_body); one that already lists an old name keeps it and receives the event under that old name until then, and under the current name after.
active boolean không

Ví dụ yêu cầu (curl)

curl -X PATCH "https://apidly.com/api/v1/webhooks/webhook_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hook","format":"json","description":"example"}'

JavaScript (SDK)

await apidly.webhooks.update("webhook_example", {
  url: "https://example.com/hook",
  format: "json",
  description: "example"
});

Python (SDK)

client.webhooks.update("webhook_example")

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "webhook": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  }
}

Trạng thái lỗi: 400, 401, 403, 404, 429.

GET /webhooks/{id}/deliveries

Nhật ký gửi của một endpoint, mới nhất trước

Scope cần có: full · Vai trò người tạo: admin · Quyền: webhooks.manage

Tham số

Tên Vị trí Kiểu Bắt buộc Mô tả
id path string có
limit query integer không

Ví dụ yêu cầu (curl)

curl "https://apidly.com/api/v1/webhooks/webhook_example/deliveries?limit=20" \
  -H "Authorization: Bearer $APIDLY_API_KEY"

JavaScript (SDK)

await apidly.webhooks.listDeliveries("webhook_example", { limit: 20 });

Python (SDK)

client.webhooks.list_deliveries("webhook_example")

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "deliveries": [
    {
      "id": "example",
      "endpointId": "id_example",
      "eventId": "id_example",
      "type": "example",
      "status": "example",
      "attempts": 1,
      "isTest": false,
      "responseCode": 1,
      "responseSnippet": "example",
      "durationMs": 1,
      "lastAttemptAt": "2026-11-21T10:00:00.000Z",
      "nextAttemptAt": "2026-11-21T10:00:00.000Z",
      "createdAt": "2026-11-21T10:00:00.000Z"
    }
  ]
}

Trạng thái lỗi: 401, 403, 404, 429.

POST /webhooks/{id}/rotate-secret

Cấp bí mật ký mới

The new secret is in this response only. The old one keeps signing for 24 hours so receivers can switch over.

Scope cần có: full · Quyền: webhooks.manage

Tham số

Tên Vị trí Kiểu Bắt buộc Mô tả
id path string có

Ví dụ yêu cầu (curl)

curl -X POST "https://apidly.com/api/v1/webhooks/webhook_example/rotate-secret" \
  -H "Authorization: Bearer $APIDLY_API_KEY"

JavaScript (SDK)

await apidly.webhooks.rotateSecret("webhook_example");

Python (SDK)

client.webhooks.rotate_secret("webhook_example")

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "webhook": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "endpoint": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "secret": "example"
}

Trạng thái lỗi: 401, 403, 404, 429.

POST /webhooks/{id}/test

Gửi sự kiện thử

A webhook.test event now (one attempt, never counted against the endpoint): the signed envelope for a json webhook, a short test message for a chat-app webhook.

Scope cần có: full · Quyền: webhooks.manage

Tham số

Tên Vị trí Kiểu Bắt buộc Mô tả
id path string có

Ví dụ yêu cầu (curl)

curl -X POST "https://apidly.com/api/v1/webhooks/webhook_example/test" \
  -H "Authorization: Bearer $APIDLY_API_KEY"

JavaScript (SDK)

await apidly.webhooks.test("webhook_example");

Python (SDK)

client.webhooks.test("webhook_example")

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "delivery": {
    "key": null
  }
}

Trạng thái lỗi: 401, 403, 404, 429.

POST /webhooks/deliveries/{deliveryId}/redeliver

Gửi lại một lần gửi trước đó

Same payload, new delivery row.

Scope cần có: full · Quyền: webhooks.manage

Tham số

Tên Vị trí Kiểu Bắt buộc Mô tả
deliveryId path string có

Ví dụ yêu cầu (curl)

curl -X POST "https://apidly.com/api/v1/webhooks/deliveries/webhook_example/redeliver" \
  -H "Authorization: Bearer $APIDLY_API_KEY"

JavaScript (SDK)

await apidly.webhooks.redeliver("webhook_example");

Python (SDK)

client.webhooks.redeliver("webhook_example")

Công cụ dòng lệnh: apidly webhooks (Tài liệu CLI)

Ví dụ phản hồi (200)

{
  "delivery": {
    "key": null
  }
}

Trạng thái lỗi: 401, 403, 404, 429.

Sẵn sàng thử chưa?

Tạo tài khoản miễn phí và nạp tín dụng khi bạn muốn khởi chạy máy chủ. Mức nạp tối thiểu là 10 $.

Tạo tài khoản miễn phí

Nội dung này có hữu ích không?

Vẫn chưa giải quyết được? Liên hệ chúng tôi