Strategy Storage API
Full reference for the Strategy Storage API — endpoints, request schema, response schema, and error codes.
Overview
The Strategy Storage API stores a Strategy DSL object as a first-class, standalone asset — independent of any one backtest or live subscription. Save a strategy once to get a stable id, then reference that id (or just pass its definition straight through) when submitting to the Backtesting API or the Live Execution API.
Base URL: https://strategy.emidlabs.com/api/public/v1
/strategies requests require the x-api-key header with a valid API key scoped for the strategy service. Keys are generated in the Console.riskManagement/entryFeePct actually do depends entirely on where you submit the strategy afterward, not on this API.#POST /strategies — Save
/strategiesSave a new strategy.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Human-readable name for this strategy. |
| description | string | No | Free-text notes about this strategy. |
| definition | string | Yes | The Strategy DSL object, serialized as a JSON string — see the Strategy System page for the full shape. |
| tags | array of string | No | Freeform labels for filtering later via GET /strategies. |
Response
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | Unique identifier for the strategy. |
| name | string | Echoes the request. |
| status | string | "Active" immediately after creation. |
| createdAtUtc | string | Timestamp of creation in UTC. |
#GET /strategies/:id — Fetch
/strategies/{id}Fetch a saved strategy by id, including its full definition.
Response
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | Unique identifier for the strategy. |
| name | string | |
| description | string | null | |
| definition | string | The Strategy DSL object, serialized as a JSON string. |
| tags | array of string | |
| status | string | "Active" or "Archived". |
| createdAtUtc | string | |
| updatedAtUtc | string |
#GET /strategies — List
/strategiesList strategies for this account, paginated.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| page | number | 1 | 1-indexed page number. |
| pageSize | number | 20 | Items per page. Clamped to the 1–100 range. |
| tag | string | (none) | Exact-match filter — only strategies carrying this tag. |
| status | string | "Active" | "Active" or "Archived". Defaults to Active-only when omitted. |
status returns Active strategies only — pass status=Archivedexplicitly to see ones you've archived.Response
| Field | Type | Description |
|---|---|---|
| items | array | One entry per strategy on this page — same shape as GET /strategies/:id. |
| totalCount | number | Total strategies matching the filter, across all pages. |
| page / pageSize / totalPages | number | Standard pagination fields. |
#PUT /strategies/:id — Update
/strategies/{id}Update a saved strategy's fields. Overwrites in place — there is no version history.
Request body
All fields optional — present means "change this", absent means "leave it as-is". Sending tags replaces the tag list entirely, it does not merge with the existing one.
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | No | New name. |
| description | string | No | New description. |
| definition | string | No | New Strategy DSL object, serialized as a JSON string. |
| tags | array of string | No | New tag list — replaces the existing one. |
Response
Same shape as GET /strategies/:id, reflecting the fields you changed.
#DELETE /strategies/:id — Archive
/strategies/{id}Archives a strategy — soft-delete, never a hard delete.
An archived strategy still exists and is still fetchable via GET /strategies/:id— it's just excluded from GET /strategies's default listing. There is no endpoint to permanently delete a strategy or to un-archive one.
Response
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | |
| status | string | "Archived". |
#GET /dsl-core-reference
/dsl-core-referenceThe genuinely-shared slice of the Strategy DSL reference, as plain text/markdown.
Unauthenticated — no x-api-key needed, same treatment as /health. Covers the inputs/conditions/scoresection (built-in functions, candlestick catalog, expression syntax) — the part of the DSL that means the exact same thing no matter where a strategy ends up running. Consumed at runtime by all three MCP servers' strategy-dsl-spec resource instead of each hand-copying it. Not meant to be called directly for normal use — it exists so configuration/decision/riskManagement, which mean different things depending on the target, can stay documented locally by whichever server actually implements that behavior.
#Error Codes
Every error response has the same shape: { "error": "<code>", "message": "<text>" }.
| Status | Code | Description |
|---|---|---|
| 400 | invalid_payload | The request body is malformed, missing required fields, or the definition fails structural validation — check the message field for specifics. |
| 401 | api_key_missing | The x-api-key header wasn't provided. |
| 401 | api_key_invalid | The provided API key is invalid, revoked, or inactive. |
| 403 | service_not_enabled | The API key is valid but not scoped for the strategy service. |
| 429 | rate_limit_exceeded | Too many requests for this account. Back off and retry. |
| 500 | execution_failed | Server-side error. |