API Reference

DXA Orchestration API

Model routing & declarative AI workflows

DXA Orchestration is the middleware layer that brings AI into existing core systems. Its API offers a model router with automatic fallback on Workers AI, and a workflow engine that runs declarative multi-step AI pipelines (with retry and idempotency). Fully Cloudflare-native — no external API keys required.

Base URL

https://orchestration.dxa.io.vn

Authentication

Endpoints are currently public (no sign-in), suitable for trials. Abuse protection is handled at the Cloudflare platform layer; the lead endpoint can enable Turnstile.

Model router

POST /api/route

Route an inference request to a suitable model, with auto-fallback

Auth: None (public)

Body parameters

FieldTypeDescription
prompt* string Prompt (≤600 chars)
difficulty 'fast' | 'balanced' | 'frontier' Model tier (default `balanced`)

Example request

curl -X POST 'https://orchestration.dxa.io.vn/api/route' \
  -H 'Content-Type: application/json' \
  -d '{ "prompt": "Tóm tắt hợp đồng này", "difficulty": "balanced" }'

Example response

{
  "ok": true,
  "label": "AI cân bằng",
  "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
  "latencyMs": 1234,
  "answer": "…",
  "hops": [
    { "model": "@cf/meta/llama-3.1-8b-instruct", "status": "error" },
    { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "status": "ok" }
  ]
}

Error codes

400 empty_promptMissing prompt
502 all_failedAll models failed
503 ai_unavailableWorkers AI not configured

Workflow engine

POST /api/wf

Run a declarative AI workflow (multi-step, idempotent)

Auth: None (public)

Body parameters

FieldTypeDescription
workflow* string Registered workflow name, e.g. `support-triage`
input* object Input data (e.g. `{ "message": "…" }`)
idemKey string Idempotency key (≤120 chars)

Example request

curl -X POST 'https://orchestration.dxa.io.vn/api/wf' \
  -H 'Content-Type: application/json' \
  -d '{ "workflow": "support-triage", "input": { "message": "Tôi chưa nhận được hóa đơn" } }'

Example response

{
  "ok": true,
  "runId": "…",
  "workflow": "support-triage",
  "status": "done",
  "steps": [
    { "id": "classify", "type": "ai", "status": "ok", "output": "Thanh toán" },
    { "id": "draft", "type": "ai", "status": "ok", "output": "Cảm ơn bạn…" },
    { "id": "record", "type": "connector", "status": "ok" }
  ],
  "result": { "category": "Thanh toán", "reply": "Cảm ơn bạn…" }
}

Error codes

400 unknown_workflowWorkflow not registered
400 empty_inputMissing required input field
GET /api/wf

Fetch the status & steps of a workflow run

Auth: None (public)

Parameters

NameTypeDescription
id* string The runId returned when the workflow ran

Example response

{
  "ok": true,
  "run": { "run_id": "…", "workflow": "support-triage", "status": "done" },
  "steps": [ { "step_id": "classify", "status": "ok", "latency_ms": 234 } ]
}

Error codes

404 not_foundRun not found

Lead capture

POST /api/lead

Capture a B2B lead from a form (optional newsletter opt-in)

Auth: None (public, optional Turnstile)

Body parameters

FieldTypeDescription
name* string Full name
email* string Business email
company string Company
tool string Tool context (default `orchestration`)

Example response

{ "ok": true }

Error codes

400 invalidMissing/invalid name or email
400 personal_emailPersonal/disposable email blocked