Workflows API
Signal approval workflow for human-in-the-loop trade validation
Workflows API
The Workflows API provides human-in-the-loop approval for trade signals. When an agent generates a signal, the workflow pauses execution and waits for an operator to approve or reject the trade before it proceeds.
Note: All workflow endpoints require
adminscope.
POST /v1/workflows/signal-approval
Start a new signal approval workflow. The workflow evaluates the signal and suspends at the approval step, returning a runId for subsequent approve/reject actions.
Request Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | Must be application/json |
X-API-Key | Yes | Your API key (must have admin scope) |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | ID of the agent that generated the signal |
agentName | string | No | Display name of the agent (default: "Agent") |
signal | object | Yes | The signal data to evaluate (arbitrary key-value pairs) |
Example Request
curl -X POST https://api.marketintell.ai/v1/workflows/signal-approval \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"agentId": "alpha-scanner-01",
"agentName": "Alpha Scanner",
"signal": {
"token": "ETH",
"direction": "long",
"entry": 3245,
"target": 3800,
"stop": 3050,
"confidence": 78
}
}'Response (202 — Awaiting Approval)
{
"success": true,
"data": {
"runId": "run_abc123",
"status": "awaiting_approval",
"tradeProposal": {
"token": "ETH",
"direction": "long",
"entry": 3245,
"target": 3800,
"stop": 3050
},
"result": null
}
}Response (200 — Completed Immediately)
If the workflow completes without suspension (e.g., the signal is auto-rejected by validation):
{
"success": true,
"data": {
"runId": "run_abc123",
"status": "completed",
"tradeProposal": null,
"result": { ... }
}
}POST /v1/workflows/signal-approval/:runId/approve
Approve a suspended signal approval workflow.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID from the start response |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | No | Reason for approval |
sizing | object | No | Modified sizing parameters (overrides default) |
Example Request
curl -X POST https://api.marketintell.ai/v1/workflows/signal-approval/run_abc123/approve \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"reason": "Strong technical setup with confluence",
"sizing": {
"position_size": 5000,
"leverage": 3
}
}'Response
{
"success": true,
"data": {
"status": "approved",
"result": { ... }
}
}POST /v1/workflows/signal-approval/:runId/reject
Reject a suspended signal approval workflow.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID from the start response |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | No | Reason for rejection (default: "Rejected by operator") |
Example Request
curl -X POST https://api.marketintell.ai/v1/workflows/signal-approval/run_abc123/reject \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"reason": "Market conditions changed, macro risk too high"
}'Response
{
"success": true,
"data": {
"status": "rejected",
"result": { ... }
}
}Workflow Lifecycle
POST /signal-approval → 202 (awaiting_approval)
↓
┌───────────────┴───────────────┐
↓ ↓
POST /:runId/approve POST /:runId/reject
↓ ↓
200 (approved) 200 (rejected)Error Responses
| Status | Condition |
|---|---|
400 | Invalid request body or schema validation failure |
401 | Missing or invalid API key |
403 | API key does not have admin scope |
500 | Internal processing error |