Tích hợp
tich hopTích hợp kênh ngoài (Lark, Telegram, Slack, Discord, Google Sheets, Lark Base, WooCommerce, Haravan, Shopify) và quy tắc định tuyến sự kiện. tich hop kenh ngoai (lark, telegram, slack, discord, google sheets, lark base, woocommerce, haravan, shopify) va quy tac dinh tuyen su kien.Tích hợp kênh ngoài (Lark, Telegram, Slack, Discord, Google Sheets, Lark Base, WooCommerce, Haravan, Shopify) và quy tắc định tuyến sự kiện.
Endpoint
Phần tiêu đề “Endpoint”| Method | Path | Tóm tắt | Quyền | Nhóm tốc độ | Tương tác |
|---|---|---|---|---|---|
GET | /v1/event-types | Danh mục các loại sự kiện webhook công khai | webhook.read | read | Scalar |
GET | /v1/events | Danh sách sự kiện hệ thống (90 ngày) | webhook.read | read | Scalar |
GET | /v1/events/{id} | Chi tiết sự kiện | webhook.read | read | Scalar |
GET | /v1/integration-deliveries/{idl} | Chi tiết một lần gửi tin | integration.read | read | Scalar |
POST | /v1/integration-deliveries/{idl}:replay | Gửi lại một lượt tin thất bại | integration.replay | replay | Scalar |
GET | /v1/integration-templates | Danh sách mẫu tin tiếng Việt | integration.read | read | Scalar |
POST | /v1/integration-templates | Tạo mẫu tin nhắn tuỳ chỉnh | integration.manage | write | Scalar |
PATCH | /v1/integration-templates/{id} | Cập nhật mẫu tin tuỳ chỉnh | integration.manage | write | Scalar |
GET | /v1/integrations | Danh sách kết nối tích hợp | integration.read | read | Scalar |
POST | /v1/integrations | Tạo kết nối tích hợp mới | integration.manage | write | Scalar |
GET | /v1/integrations/catalog | Danh mục 10 kênh tích hợp sẵn | integration.read | read | Scalar |
GET | /v1/integrations/oauth/{kind}/callback | Callback hoàn tất OAuth từ nền tảng ngoài | Công khai, không cần khoá | write | Scalar |
GET | /v1/integrations/oauth/{kind}/start | Khởi tạo kết nối OAuth cho kênh ngoài | integration.manage | write | Scalar |
POST | /v1/integrations/telegram:link-code | Tạo mã kết nối Telegram 1 bước | integration.manage | write | Scalar |
GET | /v1/integrations/telegram:resolve-chat | Tìm chat_id cho bot riêng Telegram | integration.manage | read | Scalar |
POST | /v1/integrations/woocommerce:connect-code | Tạo mã kết nối một lần cho plugin WooCommerce | integration.manage | write | Scalar |
POST | /v1/integrations/woocommerce:exchange | Đổi mã kết nối 1 bước từ WooCommerce | Công khai, không cần khoá | write | Scalar |
GET | /v1/integrations/{id} | Chi tiết một kết nối tích hợp | integration.read | read | Scalar |
PATCH | /v1/integrations/{id} | Cập nhật thông tin kết nối tích hợp | integration.manage | write | Scalar |
DELETE | /v1/integrations/{id} | Thu hồi / xoá kết nối tích hợp | integration.manage | write | Scalar |
GET | /v1/integrations/{id}/deliveries | Nhật ký gửi tin tích hợp (30 ngày) | integration.read | read | Scalar |
POST | /v1/integrations/{id}/deliveries:replay-failed | Gửi lại hàng loạt tin thất bại | integration.replay | replay | Scalar |
GET | /v1/integrations/{id}/orders | Danh sách đơn hàng thương mại | integration.read | read | Scalar |
POST | /v1/integrations/{id}/orders/{oid}:retry-writeback | Thử lại ghi ngược trạng thái đơn hàng | integration.manage | write | Scalar |
GET | /v1/integrations/{id}/rules | Danh sách quy tắc lọc sự kiện | integration.read | read | Scalar |
POST | /v1/integrations/{id}/rules | Tạo quy tắc gửi thông báo | integration.manage | write | Scalar |
PATCH | /v1/integrations/{id}/rules/{rid} | Cập nhật quy tắc gửi | integration.manage | write | Scalar |
DELETE | /v1/integrations/{id}/rules/{rid} | Xoá quy tắc gửi | integration.manage | write | Scalar |
POST | /v1/integrations/{id}/rules/{rid}:preview | Xem trước kết quả khớp và nội dung tin | integration.read | read | Scalar |
POST | /v1/integrations/{id}:pause | Tạm dừng gửi thông báo | integration.manage | write | Scalar |
POST | /v1/integrations/{id}:resume | Tiếp tục gửi thông báo | integration.manage | write | Scalar |
POST | /v1/integrations/{id}:rotate-credential | Xoay / đổi credential kết nối | integration.credential.rotate | write | Scalar |
POST | /v1/integrations/{id}:test | Gửi tin thử nghiệm [TEST] | integration.test | replay | Scalar |
POST | /v1/sandbox/events:trigger | Kích hoạt sự kiện sandbox thử nghiệm | webhook.test | write | Scalar |
GET | /v1/webhook-deliveries | Danh sách lần giao webhook | webhook.read | read | Scalar |
GET | /v1/webhook-deliveries/{id} | Chi tiết lần giao webhook kèm lịch sử các lần thử | webhook.read | read | Scalar |
POST | /v1/webhook-deliveries/{id}:replay | Phát lại một lần giao webhook (giữ nguyên webhook-id) | webhook.replay | replay | Scalar |
POST | /v1/webhook-deliveries:replay-failed | Phát lại hàng loạt các lần giao lỗi (giới hạn 30 lần/phút/tổ chức) | webhook.replay | replay | Scalar |
GET | /v1/webhook-endpoints | Danh sách webhook endpoints | webhook.read | read | Scalar |
POST | /v1/webhook-endpoints | Tạo webhook endpoint mới | webhook.manage | write | Scalar |
GET | /v1/webhook-endpoints/{id} | Chi tiết webhook endpoint | webhook.read | read | Scalar |
PATCH | /v1/webhook-endpoints/{id} | Cập nhật webhook endpoint | webhook.manage | write | Scalar |
DELETE | /v1/webhook-endpoints/{id} | Xoá webhook endpoint | webhook.manage | write | Scalar |
POST | /v1/webhook-endpoints/{id}:resume | Bật lại endpoint đang bị tạm ngưng và xả hàng đợi | webhook.manage | write | Scalar |
POST | /v1/webhook-endpoints/{id}:rotate-secret | Xoay khoá ký webhook (hỗ trợ 2 khoá song song 24 giờ) | webhook.manage | write | Scalar |
POST | /v1/webhook-endpoints/{id}:test | Gửi sự kiện thử nghiệm ping tới endpoint | webhook.test | write | Scalar |
Chi tiết endpoint
Phần tiêu đề “Chi tiết endpoint”GET /v1/event-types
Phần tiêu đề “GET /v1/event-types”Danh mục các loại sự kiện webhook công khai
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh mục sự kiện. —EventTypeListResponse,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
curl -sS -X GET "https://api.dongtien.pro/v1/event-types" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/event-types");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_event_types
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_event_types.sync(client=dt.client)GET /v1/events
Phần tiêu đề “GET /v1/events”Danh sách sự kiện hệ thống (90 ngày)
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách sự kiện. —EventListResponse,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
company_id | query | Không | OrgId | Mã công ty / tổ chức (org_…). |
type | query | Không | string | — |
limit | query | Không | integer | — |
curl -sS -X GET "https://api.dongtien.pro/v1/events" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/events");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_events
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_events.sync(client=dt.client)GET /v1/events/{id}
Phần tiêu đề “GET /v1/events/{id}”Chi tiết sự kiện
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Chi tiết sự kiện. —EventListItem,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | EventId | Mã sự kiện (evt_…), ổn định qua retry. |
curl -sS -X GET "https://api.dongtien.pro/v1/events/$ID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/events/{id}", { params: { path: { "id": "evt_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import get_event
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = get_event.sync(id="evt_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)GET /v1/integration-deliveries/{idl}
Phần tiêu đề “GET /v1/integration-deliveries/{idl}”Chi tiết một lần gửi tin
Xem chi tiết lỗi, phản hồi và thời gian thử lại.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Chi tiết lượt gửi tin —IntegrationDelivery,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
idl | path | Có | IntegrationDeliveryId | Mã lượt gửi tin tích hợp (idl_…). |
curl -sS -X GET "https://api.dongtien.pro/v1/integration-deliveries/$IDL" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integration-deliveries/{idl}", { params: { path: { "idl": "idl_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import get_integration_delivery
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = get_integration_delivery.sync(idl="idl_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/integration-deliveries/{idl}:replay
Phần tiêu đề “POST /v1/integration-deliveries/{idl}:replay”Gửi lại một lượt tin thất bại
Đưa bản tin thất bại vào hàng đợi gửi lại.
Quyền: integration.replay Scope: integrations:write- Nhóm tốc độ:
replay - Phản hồi thành công
200: Bản tin đã được đưa vào hàng đợi gửi lại —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
idl | path | Có | IntegrationDeliveryId | Mã lượt gửi tin tích hợp (idl_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integration-deliveries/$IDL:replay" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integration-deliveries/{idl}:replay", { params: { path: { "idl": "idl_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import replay_integration_delivery
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = replay_integration_delivery.sync(idl="idl_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)GET /v1/integration-templates
Phần tiêu đề “GET /v1/integration-templates”Danh sách mẫu tin tiếng Việt
Lấy các mẫu tin mặc định của hệ thống và mẫu ghi đè theo công ty.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách mẫu tin —object,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
kind | query | Không | IntegrationKind | Loại kênh / nền tảng tích hợp. |
event | query | Không | string | — |
curl -sS -X GET "https://api.dongtien.pro/v1/integration-templates" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integration-templates");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_integration_templates
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_integration_templates.sync(client=dt.client)POST /v1/integration-templates
Phần tiêu đề “POST /v1/integration-templates”Tạo mẫu tin nhắn tuỳ chỉnh
Tạo bản mẫu tin ghi đè cho tổ chức.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
201: Mẫu tin được tạo —IntegrationTemplate,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/integration-templates" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "telegram", "event": "transaction.confirmed", "body": "Đã nhận {amount} từ {counterparty_name}. Nội dung: {memo}", "locale": "vi"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integration-templates", { body: { "kind": "telegram", "event": "transaction.confirmed", "body": "Đã nhận {amount} từ {counterparty_name}. Nội dung: {memo}", "locale": "vi" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import create_integration_template
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = create_integration_template.sync( client=dt.client, body={ "kind": "telegram", "event": "transaction.confirmed", "body": "Đã nhận {amount} từ {counterparty_name}. Nội dung: {memo}", "locale": "vi", }, )PATCH /v1/integration-templates/{id}
Phần tiêu đề “PATCH /v1/integration-templates/{id}”Cập nhật mẫu tin tuỳ chỉnh
Sửa đổi nội dung mẫu tin của tổ chức.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Mẫu tin sau khi cập nhật —IntegrationTemplate,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | string (uuid) | — |
curl -sS -X PATCH "https://api.dongtien.pro/v1/integration-templates/$ID" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "body": "Đã nhận {amount} từ {counterparty_name}. Nội dung: {memo}"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.PATCH("/v1/integration-templates/{id}", { params: { path: { "id": "<id>" }, }, body: { "body": "Đã nhận {amount} từ {counterparty_name}. Nội dung: {memo}" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import update_integration_template
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = update_integration_template.sync( id="<id>", client=dt.client, body={ "body": "Đã nhận {amount} từ {counterparty_name}. Nội dung: {memo}", }, )GET /v1/integrations
Phần tiêu đề “GET /v1/integrations”Danh sách kết nối tích hợp
Liệt kê các kênh tích hợp đã thiết lập trong công ty/tổ chức.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách tích hợp phân trang —IntegrationList,application/json - Mã lỗi riêng của endpoint:
invalid_cursor
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
limit | query | Không | integer | Số phần tử mỗi trang (1–100, mặc định 20). |
cursor | query | Không | Cursor | Con trỏ phân trang mờ (cur_…) lấy từ next_cursor; không tự tạo hay sửa. |
kind | query | Không | IntegrationKind | Loại kênh / nền tảng tích hợp. |
state | query | Không | IntegrationState | Trạng thái tích hợp theo máy trạng thái state-machines.md §11. |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_integrations
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_integrations.sync(client=dt.client)Các kết nối tích hợp của một công ty.
dtp integrations list --jsonCông cụ list_integrations, scope integrations:read.
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_integrations", "arguments": {} }}POST /v1/integrations
Phần tiêu đề “POST /v1/integrations”Tạo kết nối tích hợp mới
Kết nối 1-2 bước: dán token/URL (draft -> connected), hoặc khởi tạo luồng OAuth (oauth: true, 202). Credential do adapter xác thực rồi được mã hoá niêm phong ngay; WooCommerce kết nối bằng mã từ plugin (woocommerce:connect-code), không dán credential.
- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
201: Kết nối đã tạo thành công —Integration,application/json - Phản hồi thành công
202: Yêu cầu uỷ quyền OAuth —object,application/json - Mã lỗi riêng của endpoint:
conflict,idempotency_in_flight,idempotency_key_reused
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
idempotency-key | header | Không | string | Khoá chống gửi trùng (≤ 255 ký tự, nên là UUID). Giữ 24 giờ; gửi lại cùng khoá + cùng nội dung trả lại kết quả cũ. |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "telegram", "name": "Telegram nhóm kế toán", "credential": "7312456890:AAH_secret-token-from-BotFather"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations", { body: { "kind": "telegram", "name": "Telegram nhóm kế toán", "credential": "7312456890:AAH_secret-token-from-BotFather" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import create_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = create_integration.sync( client=dt.client, body={ "kind": "telegram", "name": "Telegram nhóm kế toán", "credential": "7312456890:AAH_secret-token-from-BotFather", }, )GET /v1/integrations/catalog
Phần tiêu đề “GET /v1/integrations/catalog”Danh mục 10 kênh tích hợp sẵn
10 kind: Lark, Telegram, Slack, Discord, Custom Webhook, WooCommerce, Haravan, Shopify, Lark Base, Google Sheets kèm trạng thái cấu hình nền tảng.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh mục các kênh tích hợp được hỗ trợ —object,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/catalog" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/catalog");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import get_integration_catalog
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = get_integration_catalog.sync(client=dt.client)GET /v1/integrations/oauth/{kind}/callback
Phần tiêu đề “GET /v1/integrations/oauth/{kind}/callback”Callback hoàn tất OAuth từ nền tảng ngoài
Nền tảng chuyển trình duyệt về đây. Quyền duy nhất là state 256 bit dùng một lần (không cần phiên): route xác thực HMAC/PKCE, đổi mã lấy token, niêm phong và kích hoạt tích hợp. Khi lúc bắt đầu có redirect_url thì trả 302 về địa chỉ đó kèm result=ok&integration=int_…, ngược lại trả JSON. Mọi lỗi là problem+json.
- Nhóm tốc độ:
write - Phản hồi thành công
200: Uỷ quyền thành công —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
kind | path | Có | string | — |
code | query | Không | string | — |
state | query | Có | string | — |
shop | query | Không | string | — |
hmac | query | Không | string | — |
error | query | Không | string | — |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/oauth/$KIND/callback?state=$STATE"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/oauth/{kind}/callback", { params: { path: { "kind": "slack" }, query: { "state": "<state>" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import callback_integration_oauth
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = callback_integration_oauth.sync( kind="slack", client=dt.client, state="<state>", )GET /v1/integrations/oauth/{kind}/start
Phần tiêu đề “GET /v1/integrations/oauth/{kind}/start”Khởi tạo kết nối OAuth cho kênh ngoài
Hỗ trợ Slack, Shopify, Haravan, Google Sheets (D49). Người dùng đã đăng nhập sinh state dùng một lần (10 phút; Google Sheets và Haravan kèm PKCE S256) và nhận URL cấp quyền của nền tảng.
- Nhóm tốc độ:
write - Phản hồi thành công
200: URL chuyển hướng cấp quyền —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
kind | path | Có | string | — |
company_id | query | Không | OrgId | Mã công ty / tổ chức (org_…). |
shop | query | Không | string | Tên miền shop Shopify/Haravan |
name | query | Không | string | Tên hiển thị của kết nối sẽ tạo |
redirect_url | query | Không | string (uri) | Địa chỉ cùng origin với ứng dụng web để chuyển trình duyệt về sau khi uỷ quyền xong |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/oauth/$KIND/start" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/oauth/{kind}/start", { params: { path: { "kind": "slack" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import start_integration_oauth
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = start_integration_oauth.sync(kind="slack", client=dt.client)POST /v1/integrations/telegram:link-code
Phần tiêu đề “POST /v1/integrations/telegram:link-code”Tạo mã kết nối Telegram 1 bước
Sinh mã kết nối 10 phút. Khách chỉ cần mở bot @DongTienProBot và bấm Start để tự động điền chat_id.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Mã kết nối và đường dẫn bot —object,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/telegram:link-code" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Nhóm kế toán Công ty ABC"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/telegram:link-code", { body: { "name": "Nhóm kế toán Công ty ABC" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import telegram_link_code
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = telegram_link_code.sync( client=dt.client, body={ "name": "Nhóm kế toán Công ty ABC", }, )GET /v1/integrations/telegram:resolve-chat
Phần tiêu đề “GET /v1/integrations/telegram:resolve-chat”Tìm chat_id cho bot riêng Telegram
Gọi getUpdates để tự động tìm chat_id cho khách dùng bot riêng (không lưu token khi chưa tạo).
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Thông tin chat tìm được —object,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
token | query | Có | string | — |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/telegram:resolve-chat?token=$TOKEN" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/telegram:resolve-chat", { params: { query: { "token": "<token>" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import telegram_resolve_chat
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = telegram_resolve_chat.sync(client=dt.client, token="<token>")POST /v1/integrations/woocommerce:connect-code
Phần tiêu đề “POST /v1/integrations/woocommerce:connect-code”Tạo mã kết nối một lần cho plugin WooCommerce
Người dùng đã đăng nhập khai báo địa chỉ website (https). Mã dùng một lần, hiệu lực 10 phút, gắn với công ty và website đó; plugin đổi mã ở woocommerce:exchange.
- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Mã kết nối và hạn dùng —object,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/woocommerce:connect-code" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "site_url": "https://cuahang.example.vn"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/woocommerce:connect-code", { body: { "site_url": "https://cuahang.example.vn" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import woocommerce_connect_code
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = woocommerce_connect_code.sync( client=dt.client, body={ "site_url": "https://cuahang.example.vn", }, )POST /v1/integrations/woocommerce:exchange
Phần tiêu đề “POST /v1/integrations/woocommerce:exchange”Đổi mã kết nối 1 bước từ WooCommerce
Plugin WooCommerce (không có phiên đăng nhập) đổi mã kết nối lấy API key dt_live_… và signing secret. Quyền duy nhất là mã: dùng một lần, 10 phút, chỉ hợp lệ cho website đã khai báo. Hai giá trị bí mật chỉ xuất hiện trong phản hồi này (Cache-Control: no-store).
- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Thông tin kết nối cho plugin —object,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/woocommerce:exchange" \ -H "Content-Type: application/json" \ -d '{ "code": "WC-4F7K9Q2M", "site_url": "https://cuahang.example.vn", "store_name": "Cửa hàng Hoa Sen"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/woocommerce:exchange", { body: { "code": "WC-4F7K9Q2M", "site_url": "https://cuahang.example.vn", "store_name": "Cửa hàng Hoa Sen" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import woocommerce_exchange
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = woocommerce_exchange.sync( client=dt.client, body={ "code": "WC-4F7K9Q2M", "site_url": "https://cuahang.example.vn", "store_name": "Cửa hàng Hoa Sen", }, )GET /v1/integrations/{id}
Phần tiêu đề “GET /v1/integrations/{id}”Chi tiết một kết nối tích hợp
Xem cấu hình, trạng thái hoạt động và gợi nhớ credential (đã che).
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Thông tin chi tiết kết nối tích hợp —Integration,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/$ID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/{id}", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import get_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = get_integration.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)PATCH /v1/integrations/{id}
Phần tiêu đề “PATCH /v1/integrations/{id}”Cập nhật thông tin kết nối tích hợp
Cập nhật tên hoặc cấu hình settings (hợp nhất theo khoá, giá trị null xoá khoá). external_ref chỉ đặt được khi kết nối còn draft.
- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Kết nối tích hợp sau cập nhật —Integration,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X PATCH "https://api.dongtien.pro/v1/integrations/$ID" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Telegram nhóm kế toán", "settings": { "language": "vi" }}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.PATCH("/v1/integrations/{id}", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, }, body: { "name": "Telegram nhóm kế toán", "settings": { "language": "vi" } },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import update_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = update_integration.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client, body={ "name": "Telegram nhóm kế toán", "settings": { "language": "vi", }, }, )DELETE /v1/integrations/{id}
Phần tiêu đề “DELETE /v1/integrations/{id}”Thu hồi / xoá kết nối tích hợp
Chuyển trạng thái sang revoked, xoá vĩnh viễn credential niêm phong và huỷ webhook nền tảng.
- Nhóm tốc độ:
write - Phản hồi thành công
200: Kết nối đã được thu hồi —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X DELETE "https://api.dongtien.pro/v1/integrations/$ID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.DELETE("/v1/integrations/{id}", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import delete_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = delete_integration.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)GET /v1/integrations/{id}/deliveries
Phần tiêu đề “GET /v1/integrations/{id}/deliveries”Nhật ký gửi tin tích hợp (30 ngày)
Xem lịch sử phân phối sự kiện, mã trạng thái HTTP, độ trễ và bản xem trước đã che.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách lịch sử gửi tin —IntegrationDeliveryList,application/json - Mã lỗi riêng của endpoint:
invalid_cursor,resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
limit | query | Không | integer | Số phần tử mỗi trang (1–100, mặc định 20). |
cursor | query | Không | Cursor | Con trỏ phân trang mờ (cur_…) lấy từ next_cursor; không tự tạo hay sửa. |
is_test | query | Không | string | true: chỉ lượt gửi thử; false: chỉ lượt gửi thật. |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/$ID/deliveries" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/{id}/deliveries", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_integration_deliveries
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_integration_deliveries.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)50 lần giao gần nhất của một kết nối.
dtp integrations logs int_0f5k2m9q4h7t3n8r6v1w0x5yz0 --limit 50POST /v1/integrations/{id}/deliveries:replay-failed
Phần tiêu đề “POST /v1/integrations/{id}/deliveries:replay-failed”Gửi lại hàng loạt tin thất bại
Gửi lại theo 3 nhóm (Chặn | Chờ | Sẵn sàng). Hỗ trợ dry_run kiểm tra số lượng trước.
Quyền: integration.replay Scope: integrations:write- Nhóm tốc độ:
replay - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Kết quả gửi lại hàng loạt —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID/deliveries:replay-failed" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "group": "blocked", "dry_run": false}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}/deliveries:replay-failed", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, }, body: { "group": "blocked", "dry_run": false },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import replay_failed_integration_deliveries
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = replay_failed_integration_deliveries.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client, body={ "group": "blocked", "dry_run": False, }, )GET /v1/integrations/{id}/orders
Phần tiêu đề “GET /v1/integrations/{id}/orders”Danh sách đơn hàng thương mại
Xem các đơn hàng đã đồng bộ và trạng thái ghi nhận thanh toán ngược lại shop.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách đơn hàng —CommerceOrderList,application/json - Mã lỗi riêng của endpoint:
invalid_cursor,resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
limit | query | Không | integer | Số phần tử mỗi trang (1–100, mặc định 20). |
cursor | query | Không | Cursor | Con trỏ phân trang mờ (cur_…) lấy từ next_cursor; không tự tạo hay sửa. |
writeback_state | query | Không | CommerceOrderWritebackState | Trạng thái ghi nhận ngược lại đơn hàng ở cửa hàng (Woo/Shopify/Haravan). |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/$ID/orders" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/{id}/orders", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_commerce_orders
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_commerce_orders.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/integrations/{id}/orders/{oid}:retry-writeback
Phần tiêu đề “POST /v1/integrations/{id}/orders/{oid}:retry-writeback”Thử lại ghi ngược trạng thái đơn hàng
Thử ghi nhận thanh toán lại cho đơn hàng bị lỗi writeback_state='failed'. Chỉ áp dụng cho giao dịch có trạng thái confirmed.
- Nhóm tốc độ:
write - Phản hồi thành công
200: Kết quả thử ghi lại —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
oid | path | Có | string | Mã đơn hàng nội bộ hoặc external_order_id |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID/orders/$OID:retry-writeback" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}/orders/{oid}:retry-writeback", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0", "oid": "<oid>" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import retry_commerce_order_writeback
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = retry_commerce_order_writeback.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", oid="<oid>", client=dt.client, )GET /v1/integrations/{id}/rules
Phần tiêu đề “GET /v1/integrations/{id}/rules”Danh sách quy tắc lọc sự kiện
Lấy các quy tắc định tuyến, lọc tiền, MST, mã đơn riêng (D51) và số dư (D49).
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách quy tắc của kết nối —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X GET "https://api.dongtien.pro/v1/integrations/$ID/rules" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/integrations/{id}/rules", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_integration_rules
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_integration_rules.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/integrations/{id}/rules
Phần tiêu đề “POST /v1/integrations/{id}/rules”Tạo quy tắc gửi thông báo
Cấu hình sự kiện, bộ lọc (tài khoản, chiều, số tiền, memo_pattern_id D51, show_balance D49) và mẫu tin.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
201: Quy tắc được tạo thành công —IntegrationRule,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID/rules" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Báo tiền về trên 5 triệu", "events": [ "transaction.confirmed" ], "filters": { "direction": "in", "min_amount": 5000000 }, "show_balance": false, "enabled": true}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}/rules", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, }, body: { "name": "Báo tiền về trên 5 triệu", "events": [ "transaction.confirmed" ], "filters": { "direction": "in", "min_amount": 5000000 }, "show_balance": false, "enabled": true },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import create_integration_rule
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = create_integration_rule.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client, body={ "name": "Báo tiền về trên 5 triệu", "events": [ "transaction.confirmed", ], "filters": { "direction": "in", "min_amount": 5000000, }, "show_balance": False, "enabled": True, }, )PATCH /v1/integrations/{id}/rules/{rid}
Phần tiêu đề “PATCH /v1/integrations/{id}/rules/{rid}”Cập nhật quy tắc gửi
Chỉnh sửa bộ lọc hoặc bật/tắt quy tắc.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Quy tắc sau cập nhật —IntegrationRule,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
rid | path | Có | string (uuid) | Mã quy tắc (rule_id) |
curl -sS -X PATCH "https://api.dongtien.pro/v1/integrations/$ID/rules/$RID" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "events": [ "transaction.created" ], "filters": { "direction": "in", "min_amount": 4500000, "max_amount": 4500000, "include_provisional": false, "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, "quiet_hours": { "timezone": "Asia/Ho_Chi_Minh" }}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.PATCH("/v1/integrations/{id}/rules/{rid}", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0", "rid": "<rid>" }, }, body: { "events": [ "transaction.created" ], "filters": { "direction": "in", "min_amount": 4500000, "max_amount": 4500000, "include_provisional": false, "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, "quiet_hours": { "timezone": "Asia/Ho_Chi_Minh" } },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import update_integration_rule
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = update_integration_rule.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", rid="<rid>", client=dt.client, body={ "events": [ "transaction.created", ], "filters": { "direction": "in", "min_amount": 4500000, "max_amount": 4500000, "include_provisional": False, "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0", }, "quiet_hours": { "timezone": "Asia/Ho_Chi_Minh", }, }, )DELETE /v1/integrations/{id}/rules/{rid}
Phần tiêu đề “DELETE /v1/integrations/{id}/rules/{rid}”Xoá quy tắc gửi
Xoá một quy tắc lọc sự kiện.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Xoá quy tắc thành công —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
rid | path | Có | string (uuid) | Mã quy tắc (rule_id) |
curl -sS -X DELETE "https://api.dongtien.pro/v1/integrations/$ID/rules/$RID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.DELETE("/v1/integrations/{id}/rules/{rid}", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0", "rid": "<rid>" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import delete_integration_rule
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = delete_integration_rule.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", rid="<rid>", client=dt.client, )POST /v1/integrations/{id}/rules/{rid}:preview
Phần tiêu đề “POST /v1/integrations/{id}/rules/{rid}:preview”Xem trước kết quả khớp và nội dung tin
Thử nghiệm quy tắc với giao dịch thực tế gần nhất (đã che) hoặc giao dịch mẫu để kiểm tra bộ lọc.
Quyền: integration.read Scope: integrations:read- Nhóm tốc độ:
read - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Kết quả xem trước bộ lọc và bản tin —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
rid | path | Có | string (uuid) | Mã quy tắc (rule_id) |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID/rules/$RID:preview" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sample_tx_id": "tx_0f5k2m9q4h7t3n8r6v1w0x5yz0"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}/rules/{rid}:preview", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0", "rid": "<rid>" }, }, body: { "sample_tx_id": "tx_0f5k2m9q4h7t3n8r6v1w0x5yz0" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import preview_integration_rule
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = preview_integration_rule.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", rid="<rid>", client=dt.client, body={ "sample_tx_id": "tx_0f5k2m9q4h7t3n8r6v1w0x5yz0", }, )POST /v1/integrations/{id}:pause
Phần tiêu đề “POST /v1/integrations/{id}:pause”Tạm dừng gửi thông báo
Tạm ngưng phân phối sự kiện ra kênh ngoài.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Kết nối đã tạm dừng —Integration,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID:pause" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}:pause", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import pause_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = pause_integration.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/integrations/{id}:resume
Phần tiêu đề “POST /v1/integrations/{id}:resume”Tiếp tục gửi thông báo
Kích hoạt lại kết nối đang tạm dừng.
Quyền: integration.manage Scope: integrations:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Kết nối đã tiếp tục hoạt động —Integration,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID:resume" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}:resume", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import resume_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = resume_integration.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/integrations/{id}:rotate-credential
Phần tiêu đề “POST /v1/integrations/{id}:rotate-credential”Xoay / đổi credential kết nối
Đổi token / webhook URL mới. Yêu cầu xác thực bảo mật nâng cao (step-up ≤15′).
Quyền: integration.credential.rotate Cần xác thực lại gần đây- Nhóm tốc độ:
write - Nội dung yêu cầu:
object(application/json) - Phản hồi thành công
200: Credential đã được xoay thành công —Integration,application/json - Mã lỗi riêng của endpoint:
step_up_required,resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID:rotate-credential" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "credential": "7312456890:AAH_new-token-from-BotFather"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}:rotate-credential", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, }, body: { "credential": "7312456890:AAH_new-token-from-BotFather" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import rotate_integration_credential
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = rotate_integration_credential.sync( id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client, body={ "credential": "7312456890:AAH_new-token-from-BotFather", }, )POST /v1/integrations/{id}:test
Phần tiêu đề “POST /v1/integrations/{id}:test”Gửi tin thử nghiệm [TEST]
Gửi 1 tin mẫu đánh dấu [TEST] ra kênh để kiểm tra kết nối. Không kích hoạt nghiệp vụ, trả kết quả ngay kèm idl_….
- Nhóm tốc độ:
replay - Phản hồi thành công
200: Kết quả gửi thử —SendResult,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | IntegrationId | Mã tích hợp (int_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/integrations/$ID:test" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/integrations/{id}:test", { params: { path: { "id": "int_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import test_integration
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = test_integration.sync(id="int_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)Kiểm tra một kết nối tích hợp.
dtp integrations test int_0f5k2m9q4h7t3n8r6v1w0x5yz0POST /v1/sandbox/events:trigger
Phần tiêu đề “POST /v1/sandbox/events:trigger”Kích hoạt sự kiện sandbox thử nghiệm
Quyền: webhook.test Scope: webhooks:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
TriggerSandboxEventBody(application/json) - Phản hồi thành công
201: Sự kiện sandbox đã được đưa vào hàng đợi. —TriggerSandboxEventResponse,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/sandbox/events:trigger" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "period.locked", "payload": { "period": "2026-09", "by": "kt.truong@congtyabc.vn", "approved_by": null }, "company_id": "org_0f5k2m9q4h7t3n8r6v1w0x5yz0"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/sandbox/events:trigger", { body: { "type": "period.locked", "payload": { "period": "2026-09", "by": "kt.truong@congtyabc.vn", "approved_by": null }, "company_id": "org_0f5k2m9q4h7t3n8r6v1w0x5yz0" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import trigger_sandbox_eventfrom dongtien_api.models import TriggerSandboxEventBody
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = trigger_sandbox_event.sync( client=dt.client, body=TriggerSandboxEventBody.from_dict({ "type": "period.locked", "payload": { "period": "2026-09", "by": "kt.truong@congtyabc.vn", "approved_by": None, }, "company_id": "org_0f5k2m9q4h7t3n8r6v1w0x5yz0", }), )Phát một giao dịch sandbox 500.000 ₫.
dtp trigger transaction.confirmed --amount 500000GET /v1/webhook-deliveries
Phần tiêu đề “GET /v1/webhook-deliveries”Danh sách lần giao webhook
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách lần giao. —WebhookDeliveryList,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
endpoint_id | query | Không | WebhookEndpointId | Mã webhook endpoint (whe_…). |
company_id | query | Không | OrgId | Mã công ty / tổ chức (org_…). |
state | query | Không | WebhookDeliveryState | — |
limit | query | Không | integer | — |
curl -sS -X GET "https://api.dongtien.pro/v1/webhook-deliveries" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/webhook-deliveries");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_webhook_deliveries
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_webhook_deliveries.sync(client=dt.client)GET /v1/webhook-deliveries/{id}
Phần tiêu đề “GET /v1/webhook-deliveries/{id}”Chi tiết lần giao webhook kèm lịch sử các lần thử
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Chi tiết lần giao. —WebhookDeliveryDetail,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookDeliveryId | Mã lần giao webhook (whd_…). |
curl -sS -X GET "https://api.dongtien.pro/v1/webhook-deliveries/$ID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/webhook-deliveries/{id}", { params: { path: { "id": "whd_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import get_webhook_delivery
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = get_webhook_delivery.sync(id="whd_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/webhook-deliveries/{id}:replay
Phần tiêu đề “POST /v1/webhook-deliveries/{id}:replay”Phát lại một lần giao webhook (giữ nguyên webhook-id)
Quyền: webhook.replay- Nhóm tốc độ:
replay - Phản hồi thành công
200: Kết quả phát lại. —ReplayDeliveryResponse,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookDeliveryId | Mã lần giao webhook (whd_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/webhook-deliveries/$ID:replay" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/webhook-deliveries/{id}:replay", { params: { path: { "id": "whd_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import replay_webhook_delivery
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = replay_webhook_delivery.sync(id="whd_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)Phát lại một lần giao thất bại.
dtp webhooks replay whd_0f5k2m9q4h7t3n8r6v1w0x5yz0POST /v1/webhook-deliveries:replay-failed
Phần tiêu đề “POST /v1/webhook-deliveries:replay-failed”Phát lại hàng loạt các lần giao lỗi (giới hạn 30 lần/phút/tổ chức)
Quyền: webhook.replay- Nhóm tốc độ:
replay - Nội dung yêu cầu:
ReplayFailedDeliveriesBody(application/json) - Phản hồi thành công
200: Kết quả phát lại hàng loạt. —ReplayFailedDeliveriesResponse,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/webhook-deliveries:replay-failed" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "group": "blocked", "endpoint_id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", "dry_run": false}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/webhook-deliveries:replay-failed", { body: { "group": "blocked", "endpoint_id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", "dry_run": false },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import replay_failed_deliveriesfrom dongtien_api.models import ReplayFailedDeliveriesBody
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = replay_failed_deliveries.sync( client=dt.client, body=ReplayFailedDeliveriesBody.from_dict({ "group": "blocked", "endpoint_id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", "dry_run": False, }), )GET /v1/webhook-endpoints
Phần tiêu đề “GET /v1/webhook-endpoints”Danh sách webhook endpoints
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Danh sách webhook endpoints. —WebhookEndpointList,application/json - Mã lỗi: chỉ các mã lỗi chung ở Tổng quan
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
company_id | query | Không | OrgId | Mã công ty / tổ chức (org_…). |
state | query | Không | WebhookEndpointState | — |
curl -sS -X GET "https://api.dongtien.pro/v1/webhook-endpoints" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/webhook-endpoints");import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import list_webhook_endpoints
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = list_webhook_endpoints.sync(client=dt.client)POST /v1/webhook-endpoints
Phần tiêu đề “POST /v1/webhook-endpoints”Tạo webhook endpoint mới
Quyền: webhook.manage Scope: webhooks:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
CreateWebhookEndpointBody(application/json) - Phản hồi thành công
201: Endpoint đã tạo kèm khoá bí mật. —CreateWebhookEndpointResponse,application/json - Mã lỗi riêng của endpoint:
conflict
curl -sS -X POST "https://api.dongtien.pro/v1/webhook-endpoints" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "company_id": "org_0f5k2m9q4h7t3n8r6v1w0x5yz0", "company_scope": "all", "url": "https://api.congtyabc.vn/webhooks/dongtien", "events": [ "transaction.confirmed", "payment.received" ], "api_version": "2026-10-19", "egress": "edge", "send_full_account": false, "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/webhook-endpoints", { body: { "company_id": "org_0f5k2m9q4h7t3n8r6v1w0x5yz0", "company_scope": "all", "url": "https://api.congtyabc.vn/webhooks/dongtien", "events": [ "transaction.confirmed", "payment.received" ], "api_version": "2026-10-19", "egress": "edge", "send_full_account": false, "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import create_webhook_endpointfrom dongtien_api.models import CreateWebhookEndpointBody
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = create_webhook_endpoint.sync( client=dt.client, body=CreateWebhookEndpointBody.from_dict({ "company_id": "org_0f5k2m9q4h7t3n8r6v1w0x5yz0", "company_scope": "all", "url": "https://api.congtyabc.vn/webhooks/dongtien", "events": [ "transaction.confirmed", "payment.received", ], "api_version": "2026-10-19", "egress": "edge", "send_full_account": False, "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0", }), )GET /v1/webhook-endpoints/{id}
Phần tiêu đề “GET /v1/webhook-endpoints/{id}”Chi tiết webhook endpoint
Quyền: webhook.read Scope: webhooks:write- Nhóm tốc độ:
read - Phản hồi thành công
200: Chi tiết webhook endpoint. —WebhookEndpoint,application/json - Mã lỗi riêng của endpoint:
resource_not_found
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookEndpointId | Mã webhook endpoint (whe_…). |
curl -sS -X GET "https://api.dongtien.pro/v1/webhook-endpoints/$ID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.GET("/v1/webhook-endpoints/{id}", { params: { path: { "id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import get_webhook_endpoint
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = get_webhook_endpoint.sync(id="whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)PATCH /v1/webhook-endpoints/{id}
Phần tiêu đề “PATCH /v1/webhook-endpoints/{id}”Cập nhật webhook endpoint
Quyền: webhook.manage Scope: webhooks:write- Nhóm tốc độ:
write - Nội dung yêu cầu:
PatchWebhookEndpointBody(application/json) - Phản hồi thành công
200: Endpoint đã cập nhật. —WebhookEndpoint,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookEndpointId | Mã webhook endpoint (whe_…). |
curl -sS -X PATCH "https://api.dongtien.pro/v1/webhook-endpoints/$ID" \ -H "Authorization: Bearer $DT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "egress": "edge", "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0"}'import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.PATCH("/v1/webhook-endpoints/{id}", { params: { path: { "id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, }, body: { "egress": "edge", "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0" },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import patch_webhook_endpointfrom dongtien_api.models import PatchWebhookEndpointBody
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = patch_webhook_endpoint.sync( id="whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client, body=PatchWebhookEndpointBody.from_dict({ "egress": "edge", "memo_pattern_id": "omp_0f5k2m9q4h7t3n8r6v1w0x5yz0", }), )DELETE /v1/webhook-endpoints/{id}
Phần tiêu đề “DELETE /v1/webhook-endpoints/{id}”Xoá webhook endpoint
Quyền: webhook.manage Scope: webhooks:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Đã xoá endpoint. —object,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookEndpointId | Mã webhook endpoint (whe_…). |
curl -sS -X DELETE "https://api.dongtien.pro/v1/webhook-endpoints/$ID" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.DELETE("/v1/webhook-endpoints/{id}", { params: { path: { "id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import delete_webhook_endpoint
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = delete_webhook_endpoint.sync(id="whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/webhook-endpoints/{id}:resume
Phần tiêu đề “POST /v1/webhook-endpoints/{id}:resume”Bật lại endpoint đang bị tạm ngưng và xả hàng đợi
Quyền: webhook.manage Scope: webhooks:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Endpoint đã được bật lại. —WebhookEndpointResumeResponse,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookEndpointId | Mã webhook endpoint (whe_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/webhook-endpoints/$ID:resume" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/webhook-endpoints/{id}:resume", { params: { path: { "id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import resume_webhook_endpoint
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = resume_webhook_endpoint.sync(id="whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/webhook-endpoints/{id}:rotate-secret
Phần tiêu đề “POST /v1/webhook-endpoints/{id}:rotate-secret”Xoay khoá ký webhook (hỗ trợ 2 khoá song song 24 giờ)
Quyền: webhook.manage Scope: webhooks:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Khoá ký mới. —WebhookEndpointRotateSecretResponse,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookEndpointId | Mã webhook endpoint (whe_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/webhook-endpoints/$ID:rotate-secret" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/webhook-endpoints/{id}:rotate-secret", { params: { path: { "id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import rotate_webhook_endpoint_secret
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = rotate_webhook_endpoint_secret.sync(id="whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)POST /v1/webhook-endpoints/{id}:test
Phần tiêu đề “POST /v1/webhook-endpoints/{id}:test”Gửi sự kiện thử nghiệm ping tới endpoint
Quyền: webhook.test Scope: webhooks:write- Nhóm tốc độ:
write - Phản hồi thành công
200: Kết quả gửi thử nghiệm. —WebhookEndpointTestResponse,application/json - Mã lỗi riêng của endpoint:
resource_not_found,conflict
Tham số
Phần tiêu đề “Tham số”| Tên | Vị trí | Bắt buộc | Kiểu | Mô tả |
|---|---|---|---|---|
id | path | Có | WebhookEndpointId | Mã webhook endpoint (whe_…). |
curl -sS -X POST "https://api.dongtien.pro/v1/webhook-endpoints/$ID:test" \ -H "Authorization: Bearer $DT_API_KEY"import { createClient } from "@dongtien/sdk";
const dt = createClient({ apiKey: process.env.DT_API_KEY! });
const { data } = await dt.POST("/v1/webhook-endpoints/{id}:test", { params: { path: { "id": "whe_0f5k2m9q4h7t3n8r6v1w0x5yz0" }, },});import os
from dongtien import DongTienfrom dongtien_api.api.tich_hop import test_webhook_endpoint
with DongTien(api_key=os.environ["DT_API_KEY"]) as dt: result = test_webhook_endpoint.sync(id="whe_0f5k2m9q4h7t3n8r6v1w0x5yz0", client=dt.client)Đối tượng
Phần tiêu đề “Đối tượng”EventTypeListResponse
Phần tiêu đề “EventTypeListResponse”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
data | EventTypeItem[] | Có | — |
data[].domain | string | Có | — |
data[].type | string | Có | — |
data[].visibility | string | Có | Giá trị: public, internal. |
data[].when | string | Có | — |
object | string | Có | Giá trị: list. |
EventListResponse
Phần tiêu đề “EventListResponse”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
data | EventListItem[] | Có | — |
data[].api_version | string | Có | — |
data[].created_at | Timestamp | Có | — |
data[].id | EventId | Có | — |
data[].payload | any | Không | — |
data[].type | string | Có | — |
object | string | Có | Giá trị: list. |
EventListItem
Phần tiêu đề “EventListItem”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
api_version | string | Có | — |
created_at | Timestamp | Có | — |
id | EventId | Có | — |
payload | any | Không | — |
type | string | Có | — |
IntegrationDelivery
Phần tiêu đề “IntegrationDelivery”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
attempt | integer | Có | — |
created_at | Timestamp | Có | — |
error | string | null | Không | — |
event_created_at | Timestamp | Có | — |
event_id | string | Có | — |
http_status | integer | null | Không | — |
id | IntegrationDeliveryId | Có | — |
integration_id | IntegrationId | Có | — |
is_test | boolean | Có | — |
latency_ms | integer | null | Không | — |
next_retry_at | Timestamp | null | Không | — |
payload_preview | string | Có | Bản xem trước nội dung đã che số tài khoản và thông tin nhạy cảm |
rule_id | string (uuid) | null | Không | — |
state | IntegrationDeliveryState | Có | Giá trị: queued, sending, delivered, retry_wait, failed, dead, skipped_filter, skipped_quiet, throttled. |
IntegrationTemplate
Phần tiêu đề “IntegrationTemplate”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
body | string | Có | — |
created_at | Timestamp | Có | — |
event | string | Có | — |
id | string (uuid) | Có | — |
kind | IntegrationKind | Có | Giá trị: lark, telegram, slack, discord, custom_webhook, woocommerce, haravan, shopify, lark_base, google_sheets. |
locale | string | Có | Giá trị: vi. |
org_id | string (uuid) | null | Có | null nếu là mẫu mặc định toàn hệ thống |
updated_at | Timestamp | Có | — |
version | integer | Có | — |
IntegrationList
Phần tiêu đề “IntegrationList”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
data | Integration[] | Có | — |
data[].created_at | Timestamp | Có | — |
data[].credential_hint | string | Có | Phần gợi nhớ đã che của credential, vd: •••a3f9 hoặc @DongTienProBot |
data[].direction | IntegrationDirection | Có | Giá trị: out, in, both. |
data[].external_ref | string | null | Không | — |
data[].id | IntegrationId | Có | — |
data[].kind | IntegrationKind | Có | Giá trị: lark, telegram, slack, discord, custom_webhook, woocommerce, haravan, shopify, lark_base, google_sheets. |
data[].last_delivery_at | Timestamp | null | Không | — |
data[].last_error | string | null | Không | — |
data[].name | string | Có | — |
data[].org_id | string (uuid) | Có | — |
data[].root_id | string (uuid) | Có | — |
data[].settings | map<string, any> | Có | — |
data[].state | IntegrationState | Có | Giá trị: draft, connected, test_ok, active, degraded, error, paused, revoked. |
data[].updated_at | Timestamp | Có | — |
has_more | boolean | Có | — |
next_cursor | string | null | Có | Con trỏ trang kế; null khi hết dữ liệu. |
object | string | Có | Giá trị: list. |
Integration
Phần tiêu đề “Integration”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
created_at | Timestamp | Có | — |
credential_hint | string | Có | Phần gợi nhớ đã che của credential, vd: •••a3f9 hoặc @DongTienProBot |
direction | IntegrationDirection | Có | Giá trị: out, in, both. |
external_ref | string | null | Không | — |
id | IntegrationId | Có | — |
kind | IntegrationKind | Có | Giá trị: lark, telegram, slack, discord, custom_webhook, woocommerce, haravan, shopify, lark_base, google_sheets. |
last_delivery_at | Timestamp | null | Không | — |
last_error | string | null | Không | — |
name | string | Có | — |
org_id | string (uuid) | Có | — |
root_id | string (uuid) | Có | — |
settings | map<string, any> | Có | — |
state | IntegrationState | Có | Giá trị: draft, connected, test_ok, active, degraded, error, paused, revoked. |
updated_at | Timestamp | Có | — |
IntegrationDeliveryList
Phần tiêu đề “IntegrationDeliveryList”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
data | IntegrationDelivery[] | Có | — |
data[].attempt | integer | Có | — |
data[].created_at | Timestamp | Có | — |
data[].error | string | null | Không | — |
data[].event_created_at | Timestamp | Có | — |
data[].event_id | string | Có | — |
data[].http_status | integer | null | Không | — |
data[].id | IntegrationDeliveryId | Có | — |
data[].integration_id | IntegrationId | Có | — |
data[].is_test | boolean | Có | — |
data[].latency_ms | integer | null | Không | — |
data[].next_retry_at | Timestamp | null | Không | — |
data[].payload_preview | string | Có | Bản xem trước nội dung đã che số tài khoản và thông tin nhạy cảm |
data[].rule_id | string (uuid) | null | Không | — |
data[].state | IntegrationDeliveryState | Có | Giá trị: queued, sending, delivered, retry_wait, failed, dead, skipped_filter, skipped_quiet, throttled. |
has_more | boolean | Có | — |
next_cursor | string | null | Có | Con trỏ trang kế; null khi hết dữ liệu. |
object | string | Có | Giá trị: list. |
CommerceOrderList
Phần tiêu đề “CommerceOrderList”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
data | CommerceOrder[] | Có | — |
data[].amount | Vnd | Có | — |
data[].created_at | Timestamp | Có | — |
data[].currency | string | Có | Giá trị: VND. |
data[].customer_ref | string | Có | Thông tin khách hàng đã băm SHA-256 (tuân thủ PDPL/GDPR) |
data[].event | string | Có | — |
data[].expected_payment_id | string (uuid) | null | Không | — |
data[].external_order_id | string | Có | — |
data[].id | string (uuid) | Có | — |
data[].integration_id | IntegrationId | Có | — |
data[].payment_request_id | PaymentRequestId | null | Không | — |
data[].updated_at | Timestamp | Có | — |
data[].writeback_attempts | integer | Có | — |
data[].writeback_error | string | null | Không | — |
data[].writeback_state | CommerceOrderWritebackState | Có | Giá trị: pending, done, failed. |
has_more | boolean | Có | — |
next_cursor | string | null | Có | Con trỏ trang kế; null khi hết dữ liệu. |
object | string | Có | Giá trị: list. |
IntegrationRule
Phần tiêu đề “IntegrationRule”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
created_at | Timestamp | Có | — |
enabled | boolean | Có | — |
events | string[] | Có | — |
filters | IntegrationRuleFilters | Có | — |
filters.account_ids | string[] | Không | — |
filters.direction | string | Không | Giá trị: in, out, both. |
filters.include_provisional | boolean | Không | — |
filters.max_amount | Vnd | Không | — |
filters.memo_code_only | boolean | Không | — |
filters.memo_pattern_id | MemoPatternId | Không | — |
filters.memo_regex | string | Không | — |
filters.min_amount | Vnd | Không | — |
filters.mst | string[] | Không | — |
id | string (uuid) | Có | — |
integration_id | IntegrationId | Có | — |
name | string | Có | — |
org_id | string (uuid) | Có | — |
quiet_hours | object | Không | — |
quiet_hours.enabled | boolean | Có | — |
quiet_hours.end | string | Có | — |
quiet_hours.start | string | Có | — |
quiet_hours.timezone | string | Không | — |
show_balance | boolean | Có | D49: Gửi kèm số dư sau giao dịch (mặc định tắt vì bảng tính và chat nằm ngoài hệ thống) |
target | map<string, any> | Không | — |
template_id | string (uuid) | null | Không | — |
updated_at | Timestamp | Có | — |
SendResult
Phần tiêu đề “SendResult”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
class | SendResultClass | Có | Giá trị: delivered, retry, rate_limited, fatal. |
delivery_id | IntegrationDeliveryId | Không | — |
error | string | Không | — |
http_status | integer | Không | — |
latency_ms | integer | Không | — |
retry_after_ms | integer | Không | — |
TriggerSandboxEventBody
Phần tiêu đề “TriggerSandboxEventBody”| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
company_id | OrgId | Không | — |
payload | map<string, any> | Có | — |
type | string | Có | Loại sự kiện gửi tới webhook (Standard Webhooks). Giá trị: transaction.created, transaction.confirmed, transaction.merged, transaction.quarantined, transaction.released, channel.degraded, device.offline, device.online, reconcile.proposed, reconcile.approved, reconcile.rejected, reconcile.reversed, invoice.payment_posted, invoice.payment_writeback_failed, payment.received, payment.partial, payment.overpaid, payment.expired, collect.bill.paid, connection.expiring, connection.failed, apikey.expiring, export.completed, export.failed, export.misa_failed, period.locked, period.unlocked, quota.threshold, cashflow.alert, settlement.payout_variance, obligation.overdue, import.completed, integration.delivery_failed, ping. |
Đối tượng khác của nhóm này (xem tài liệu tương tác): TriggerSandboxEventResponse, WebhookDeliveryList, WebhookDeliveryDetail, ReplayDeliveryResponse, ReplayFailedDeliveriesBody, ReplayFailedDeliveriesResponse, WebhookEndpointList, CreateWebhookEndpointBody, CreateWebhookEndpointResponse, WebhookEndpoint, PatchWebhookEndpointBody, WebhookEndpointResumeResponse, WebhookEndpointRotateSecretResponse, WebhookEndpointTestResponse