Getting Started
Overview
Authentication
Error Codes
Endpoints
Auth
Connectors
Workflows
Webhooks
AutoTest
Quota
AuditLog
HiveMind
SDK Examples
JavaScript
Python
cURL
dcAI Workflow OS — API Reference
Build, run, and monitor AI-powered integration workflows programmatically. All protected endpoints require a Bearer JWT obtained via
/api/auth/login.Authentication
Pass your JWT as
Authorization: Bearer <token> on every request. Tokens are valid for 7 days.# Login to get token
curl -X POST https://api.deepcognitive.io/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@co.com","password":"yourpass"}'
# → {"token": "eyJ..."}
# Use in all requests
curl https://api.deepcognitive.io/api/quota \
-H "Authorization: Bearer eyJ..."Error Codes
Auth
Signup, login, and profile.
POST/api/auth/signupRegister a new tenant
Body
emailstringrequired
passwordstringrequired
namestringrequired
companystringoptional
agreed_tosbooleanrequired · must be true
Response
{"token": "eyJ...", "tenant_id": "uuid", "redirect": "https://flows.deepcognitive.io/onboard"}
POST/api/auth/loginGet a JWT token
Body
emailstringrequired
passwordstringrequired
Response
{"token": "eyJ...", "tenant_id": "uuid", "email": "you@co.com"}
🧪 Try it
GET/api/auth/meCurrent tenant profileAUTH
Response
{"tenant_id": "uuid", "email": "you@co.com", "name": "...", "plan": "sandbox"}
Connectors
Store and manage encrypted platform credentials. AES-256 encrypted at rest, decrypted only in-memory during execution.
POST/api/connectors/connectStore connector credentialsAUTH
Body
connector_namestringrequired · e.g. "stripe"
credentialsobjectrequired · {"api_key": "sk_..."}
connector_typestringdefault "api_key"
instance_urlstringoptional · for Salesforce, ServiceNow
Example
curl -X POST https://api.deepcognitive.io/api/connectors/connect \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"connector_name":"stripe","credentials":{"api_key":"sk_live_..."},"connector_type":"api_key"}'
GET/api/connectorsList all connected platformsAUTH
Response
{"connectors": [{"connector_name":"stripe","connector_type":"api_key","status":"connected","last_tested":"..."}]}
DELETE/api/connectors/{name}Disconnect a platformAUTH
Response
{"message": "stripe disconnected"}
POST/api/connectors/ingest-specAI-parse an OpenAPI specAUTH
Body
spec_urlstringURL to fetch spec from
spec_jsonstringRaw JSON/YAML spec text
namestringConnector name hint
Response
{"connector_config": {"base_url":"...","source_path":"...","target_path":"...","auth_type":"bearer"}, "suggested_name": "my_api"}
Workflows (Realtime)
Subscribe to SSE
/events first, then POST to /prompt to trigger. Events stream in real-time.
GETflows.deepcognitive.io/eventsSSE event stream
Event Types
log{msg, level}Human-readable log line
step{status, pair, title, detail}Step lifecycle: active / done / error
heal{pair, root_cause, fix}AI healing triggered
success{transforms, record_id}Workflow complete
JavaScript Example
const es = new EventSource('https://flows.deepcognitive.io/events');
es.onmessage = (e) => {
const d = JSON.parse(e.data);
if (d.type === 'log') console.log(d.msg);
if (d.type === 'heal') console.log('AI healed:', d.root_cause);
if (d.type === 'success') { console.log('Done!'); es.close(); }
};
POSTflows.deepcognitive.io/promptTrigger a workflow runAUTH
Body
promptstringrequired · plain English
tenant_tokenstringrequired · your JWT
faultbooleandefault false · inject faults
sandbox_modebooleandefault false · mock APIs, skip quota
Example
curl -X POST https://flows.deepcognitive.io/prompt \
-H "Content-Type: application/json" \
-d '{
"prompt": "Sync Stripe payments to HubSpot and update contact",
"tenant_token": "eyJ...",
"sandbox_mode": true
}'Response
{"status": "started", "steps": ["stripe","hubspot"], "sandbox": true}
Webhooks
Register inbound webhook URLs that auto-trigger workflows when external platform events arrive.
POST/api/webhooks/registerRegister a webhook triggerAUTH
Body
sourcestringrequired · e.g. "stripe"
targetstringrequired · e.g. "hubspot"
prompt_templatestringWorkflow prompt override
Response
{"webhook_url": "https://flows.deepcognitive.io/webhook-trigger/stripe/{tenant_id}", "secret": "whsec_..."}
GET/api/webhooksList registered webhooksAUTH
Response
{"webhooks": [{"source":"stripe","target":"hubspot","webhook_url":"...","status":"active"}]}
AutoTest
Run 6 automated test cases per connector pair in sandbox — data fetch, schema validation, AI healing, HiveMind save. Always runs in sandbox, no quota used.
POST/api/autotest/runRun AutoTest on a connector pairAUTH
Body
stepsarrayrequired · ["stripe","hubspot"]
promptstringWorkflow description
faultbooleandefault true · inject faults to test healing
Example
curl -X POST https://api.deepcognitive.io/api/autotest/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"steps":["stripe","hubspot"],"prompt":"Sync payment to CRM","fault":true}'Response
{"started": true, "test_id": "uuid", "steps": ["stripe","hubspot"], "sandbox": true}
Quota
Plan limits: Sandbox 100/mo · Builder 5,000/mo · Scale 50,000/mo · Enterprise unlimited.
GET/api/quotaGet current usageAUTH
Response
{"plan":"sandbox","run_limit":100,"runs_used":4,"runs_left":96,"over_limit":false,"reset_date":"2026-07-01"}
AuditLog
Unified log of live workflow runs, webhook events, and connector changes. Only live (non-sandbox) activity appears here.
GET/api/audit/logsFetch audit entriesAUTH
Query Params
limitintdefault 50
offsetintdefault 0
sourcestringflow_run | webhook | connector
Response
{"logs":[{"id":"...","type":"flow_run","title":"stripe→hubspot","status":"success","ts":"..."}],"total":42}
HiveMind (RAG)
Cross-tenant anonymized healing patterns. Contributed automatically after every AutoTest or live workflow heal.
GET/api/rag/rulesList healing patternsAUTH
Response
{"rules":[{"source_type":"stripe","target_type":"hubspot","fix_rule":"...","confidence":0.92,"global_count":14}]}
JavaScript SDK
class DcAI {
constructor(token) {
this.token = token;
this.api = 'https://api.deepcognitive.io';
this.rt = 'https://flows.deepcognitive.io';
}
_h() { return { 'Authorization':'Bearer '+this.token, 'Content-Type':'application/json' }; }
get(path) { return fetch(this.api+path,{headers:this._h()}).then(r=>r.json()); }
post(path, body) { return fetch(this.api+path,{method:'POST',headers:this._h(),body:JSON.stringify(body)}).then(r=>r.json()); }
// Run workflow with SSE events
run(prompt, { sandbox=false, fault=false, onLog, onHeal, onDone }={}) {
const es = new EventSource(this.rt+'/events');
es.onmessage = e => {
const d = JSON.parse(e.data);
if (d.type==='log' && onLog) onLog(d.msg);
if (d.type==='heal' && onHeal) onHeal(d);
if (d.type==='success' && onDone) { es.close(); onDone(d); }
};
return fetch(this.rt+'/prompt', {
method:'POST', headers:{'Content-Type':'application/json'},
body: JSON.stringify({ prompt, tenant_token:this.token, fault, sandbox_mode:sandbox })
});
}
}
// Example
const dcai = new DcAI(localStorage.getItem('dcai_token'));
const quota = await dcai.get('/api/quota');
console.log(`${quota.runs_used}/${quota.run_limit} runs used`);
dcai.run('Sync Stripe to HubSpot', {
sandbox: true,
onLog: msg => console.log(msg),
onHeal: d => console.log('Healed:', d.root_cause),
onDone: d => console.log('Complete!', d),
});Python SDK
Requires
pip install requestsimport requests
class DcAI:
API = "https://api.deepcognitive.io"
def __init__(self, token: str):
self.h = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
def get(self, path):
return requests.get(self.API + path, headers=self.h).json()
def post(self, path, body):
return requests.post(self.API + path, json=body, headers=self.h).json()
# Example
dcai = DcAI("your_jwt_token")
# Quota
q = dcai.get("/api/quota")
print(f"{q['runs_used']}/{q['run_limit']} runs used · plan: {q['plan']}")
# Connect Stripe
dcai.post("/api/connectors/connect", {
"connector_name": "stripe",
"credentials": {"api_key": "sk_live_..."},
"connector_type": "api_key",
})
# Run AutoTest
result = dcai.post("/api/autotest/run", {
"steps": ["stripe", "hubspot"],
"prompt": "Sync payment to CRM",
"fault": True,
})
print(result)
# Audit logs
logs = dcai.get("/api/audit/logs?limit=20")
for log in logs["logs"]:
print(f"[{log['type']}] {log['title']} — {log['status']}")cURL Reference
export TOKEN="your_jwt_token"
# Login & get token
curl -X POST https://api.deepcognitive.io/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@co.com","password":"pass"}' | jq -r .token
# Check quota
curl https://api.deepcognitive.io/api/quota \
-H "Authorization: Bearer $TOKEN"
# Connect Stripe
curl -X POST https://api.deepcognitive.io/api/connectors/connect \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"connector_name":"stripe","credentials":{"api_key":"sk_live_..."},"connector_type":"api_key"}'
# Run AutoTest (watch SSE stream for results)
curl -X POST https://api.deepcognitive.io/api/autotest/run \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"steps":["stripe","hubspot"],"prompt":"Sync payment","fault":true}'
# Audit log
curl "https://api.deepcognitive.io/api/audit/logs?limit=20" \
-H "Authorization: Bearer $TOKEN"
# SSE stream (open in separate terminal before /prompt)
curl -N https://flows.deepcognitive.io/events
# Run live workflow
curl -X POST https://flows.deepcognitive.io/prompt \
-H "Content-Type: application/json" \
-d "{\"prompt\":\"Sync Stripe to HubSpot\",\"tenant_token\":\"$TOKEN\",\"sandbox_mode\":true}"