Strategies API
Auto-generated from
openapi-snapshot.json. Do not edit by hand — changes are overwritten byscripts/docs/generate_api_reference.py.
9 endpoints in this group.
GET /api/strategies
List Strategies
List active strategies for a tenant from the database.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | integer | optional | |
agent_id | query | — | optional |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
POST /api/strategies
Create Strategy
Create a new strategy. Returns the created row (joined with agent_name) so the frontend can insert it straight into state.
Request body: application/json
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
POST /api/strategies/clone
Clone Template
Clone a built-in template into the strategies table for a user.
Returns: {“strategy_id”: int, “template_id”: str, “tenant_id”: int}
Request body: application/json
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
POST /api/strategies/suggest
Suggest
Ask the configured LLM to propose count strategies matching the inputs.
Returns: {“suggestions”: [StrategySuggestion, …], “count”: int}
Errors: 400 — LLM returned unparseable output (bad JSON / wrong shape). 503 — LLM client misconfigured (missing API key / provider). 500 — Any other unexpected failure.
Request body: application/json
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
GET /api/strategies/templates
List Templates
Return all built-in strategy templates.
Returns: {“templates”: {template_id: {name, theme, description, conditions_json, asset_types, timeframe, key_rules}, …}}
Responses
| Code | Description |
|---|---|
200 | Successful Response |
GET /api/strategies/templates/{template_id}
Get Template
Return a single strategy template by id.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template_id | path | string | required |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
DELETE /api/strategies/{strategy_id}
Delete Strategy
Soft-delete a strategy by setting is_active=FALSE. Keeps the row so historical agent_signals.strategy_id references stay intact.
Returns: {“strategy_id”: int, “is_active”: bool, “deleted”: bool}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
strategy_id | path | integer | required | |
tenant_id | query | integer | optional |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
PATCH /api/strategies/{strategy_id}/assign-agent
Assign Agent
Set or clear the agent assignment. Pass agent_id=null to unassign.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
strategy_id | path | integer | required |
Request body: application/json
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
PATCH /api/strategies/{strategy_id}/toggle
Toggle Strategy
Flip is_active on a strategy. Returns {strategy_id, is_active}.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
strategy_id | path | integer | required |
Request body: application/json
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |