Production endpoint
Dùng host production của workspace hoặc domain platform được cấu hình.
https://your-domain.example/apiBase URLTrang tóm tắt cách hệ thống đẩy sự kiện lead, site và commerce sang CRM hoặc hệ thống vận hành ngoài qua outbox/webhook.
lead.createdTạo lead mới từ form contact hoặc CTA public.
lead.updatedCập nhật pipeline, priority, note hoặc follow-up trong admin lead CRM.
site.provisionedDùng cho bước tiếp theo khi cần báo hệ thống ngoài sau provisioning thành công.
X-DTAA-EventTên event như lead.created hoặc lead.updated.
X-DTAA-SignatureChữ ký HMAC của payload, kiểm tra bằng secret đã cấu hình.
X-DTAA-DeliveryMã delivery để retry và trace log khi endpoint lỗi.
POST /webhooks/dtaa HTTP/1.1
X-DTAA-Event: <x-dtaa-event>
X-DTAA-Signature: <x-dtaa-signature>
X-DTAA-Delivery: <x-dtaa-delivery>
Content-Type: application/json
{ "event": "lead.created", "id": "evt_01", "data": { "...": "..." } }
| Method | Path | Ability | Mục đích |
|---|---|---|---|
GET | /api/v1/workspace | * | Đọc workspace của token hiện tại. |
GET | /api/v1/products | catalog:read | Đọc danh sách sản phẩm và biến thể. |
POST | /api/v1/products | catalog:write | Upsert sản phẩm và biến thể theo SKU. |
GET/POST | /oauth/authorize | authorization_code | User owner/manager duyệt consent, dùng redirect_uri allowlist và PKCE S256/plain. |
POST | /api/oauth/token | client_credentials / authorization_code / refresh_token | Đổi client credentials, authorization code hoặc refresh token lấy Bearer token 1 giờ. |
GET | /api/v1/orders | orders:read | Đọc danh sách đơn hàng và item. |
POST | /api/v1/orders | orders:write | Tạo order đã thanh toán, mặc định fulfill ngay; gửi fulfill_now=false để xử lý fulfillment từng phần. |
POST | /api/v1/orders/{order}/fulfillments | orders:write | Tạo fulfillment từng phần, trừ tồn và idempotent theo idempotency_key. |
POST | /api/v1/orders/{order}/returns | orders:write | Tạo phiếu trả hàng/hoàn tiền; gửi refund_provider=http để job gọi gateway HTTP đã cấu hình. |
Dùng host production của workspace hoặc domain platform được cấu hình.
https://your-domain.example/apiBase URLGửi access token từ OAuth hoặc API token workspace trong header Authorization.
Authorization: Bearer <token>AuthCác API tạo order, fulfillment và return nên gửi khóa idempotency ổn định theo hệ thống ngoài.
X-Idempotency-Key: erp-order-1001Idempotency401 cho token sai, 403 cho thiếu ability, 422 cho validation và 429 khi bị throttle.
422 validation_errorErrorsTải spec máy đọc được để import vào Postman, Scalar hoặc generator SDK.
/api/openapi.jsonOpenAPIPackage mỏng bọc OAuth, Bearer token, idempotency key và catalog/order API hiện có.
packages/dtaa-sdk-jsSDKDùng authorization_code kèm PKCE verifier.
curl -X POST https://your-domain.example/api/oauth/token \
-H 'Accept: application/json' \
-d 'grant_type=authorization_code' \
-d 'client_id=client-id' \
-d 'client_secret=client-secret' \
-d 'redirect_uri=https://partner.example/callback' \
-d 'code=auth-code' \
-d 'code_verifier=pkce-verifier'
Gửi Bearer token có ability catalog:write.
await fetch('/api/v1/products', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
'X-Idempotency-Key': 'sku-SKU-001'
},
body: JSON.stringify({ sku: 'SKU-001', name: 'Demo item', price_cents: 120000 })
});
SDK dùng fetch chuẩn, có thể inject fetchImpl để test offline.
import { DtaaClient } from '@dtaa-tech/platform-sdk';
const client = new DtaaClient({ baseUrl: 'https://your-domain.example', accessToken: '<token>' });
await client.upsertProduct({ sku: 'SKU-001', name: 'Demo item', price_cents: 120000 }, { idempotencyKey: 'sku-SKU-001' });
Package packages/dtaa-sdk-js có client API, helper OAuth token, type declarations và test offline bằng mock fetch.
2026-07-15Authorization-code flow đã có consent screen, redirect URI allowlist, PKCE và refresh token rotation.
2026-07-15API fulfillment từng phần và return/refund manual đã nhận idempotency_key để tránh đồng bộ lặp.
2026-07-15Webhook endpoint, signed headers, retry worker và retry UI được dùng cho lead và commerce event.
2026-07-07Admin có thể tạo endpoint platform trong phần settings; outbox worker giao sự kiện theo queue và ghi lỗi retry được.
Workspace đã có API token, OAuth client credentials, authorization-code consent, PKCE và refresh token.
Webhook có secret hash và header chữ ký để hệ thống nhận kiểm tra nguồn gửi trước khi xử lý.