MarketIntell Trades API
Trade intents, executed orders, trader ticks, and execution policy
Trade intents, executed orders, trader ticks, and execution policy
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/marketintell-ai:marketintell-ai-trades-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: MarketIntell Trades API
version: 0.1.0
description: 'AI-powered market intelligence with tier-aware Mastra agents and a deterministic analytical pipeline across crypto, US equities, and India stocks. REST, MCP, OpenAI-compatible, async workflow, and batch transports share one evidence/provenance/recovery contract.
**Rate limits (per minute / per day):**
- Free: 60 / 25
- Builder: 120 / 50,000
- Pro: 300 / 2,000
- Enterprise: 1,000 / unlimited
MCP has a separate per-key bucket (default 30/min, env `MCP_RATE_LIMIT_MAX`). 429 responses include `Retry-After` and machine-readable recovery fields.
**Self-registration (agents):** `POST /v1/auth/challenge` returns a SHA-256 proof-of-work challenge; submit the solved nonce to `POST /v1/auth/signup`. Follow `/.well-known/oauth-protected-resource` to the authorization-server `agent_auth` block, or read `/auth.md`.'
contact:
name: MarketIntell
email: support@marketintell.ai
url: https://marketintell.ai/contact
license:
name: Proprietary
url: https://marketintell.ai/terms
termsOfService: https://marketintell.ai/terms
x-api-lifecycle:
stability: stable
versioning: Major versions are encoded in the URL path (currently /v1). Additive fields do not change the major version.
deprecation_notice_days: 90
deprecation_header: Deprecation (RFC 9745)
sunset_header: Sunset (RFC 8594)
migration_link_relation: successor-version
servers:
- url: https://api.marketintell.ai
description: Production
- url: http://localhost:3848
description: Local development
security:
- BearerAuth: []
- ApiKeyHeader: []
tags:
- name: Trades
description: Trade intents, executed orders, trader ticks, and execution policy
paths:
/v1/trades:
get:
operationId: getTrades
summary: List trade intents
tags:
- Trades
description: Paginated list of the calling key's trade intents (proposed orders awaiting approval/execution). Owner-scoped. Requires `read` scope.
parameters:
- name: status
in: query
schema:
type: string
description: Filter by intent status (e.g. pending, approved, executed, rejected, cancelled).
- name: limit
in: query
schema:
type: integer
default: 50
minimum: 1
maximum: 100
responses:
'200':
description: Trade intents
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
intents:
type: array
items:
type: object
total:
type: integer
/v1/trades/orders:
get:
operationId: getTradesOrders
summary: List executed orders (audit trail)
tags:
- Trades
description: Executed-order audit trail for the calling key. Filter by open/closed/all. Owner-scoped. Requires `read` scope.
parameters:
- name: status
in: query
schema:
type: string
enum:
- open
- closed
- all
default: all
- name: limit
in: query
schema:
type: integer
default: 50
minimum: 1
maximum: 100
responses:
'200':
description: Executed orders
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
orders:
type: array
items:
type: object
/v1/trades/orders/{id}:
get:
operationId: getTradesOrdersId
summary: Get a single executed order
tags:
- Trades
description: Single executed order. With `refresh=1` and an open/partial order, refreshes the broker-side fill state before returning. Owner-scoped. Requires `read` scope.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- name: refresh
in: query
schema:
type: string
enum:
- '1'
description: When `1`, poll the broker for the latest order state (best-effort).
responses:
'200':
description: Executed order
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
order:
type: object
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/trades/dry-run:
post:
operationId: postTradesDryRun
summary: Evaluate a candidate intent against policy
tags:
- Trades
description: 'Policy calculator: evaluate a candidate order against the caller''s execution policy WITHOUT writing any rows. If `broker_connection_id` is supplied, the route reads that active broker account snapshot for equity/PnL/open-position gates; otherwise it uses the optional `account` override or a placeholder. Free users can call this — it''s a calculator, not an order. Requires `read` scope.'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- symbol
- side
properties:
symbol:
type: string
minLength: 1
maxLength: 32
side:
type: string
enum:
- buy
- sell
notional_cents:
type: integer
minimum: 1
qty:
type: number
minimum: 0
limit_price:
type: number
minimum: 0
stop_price:
type: number
minimum: 0
broker_connection_id:
type: string
format: uuid
description: Optional active broker connection to use for live account equity/PnL/open-position policy gates.
account:
type: object
description: Optional account snapshot override. If omitted, broker_connection_id is used when supplied; otherwise dry-run falls back to a $10k placeholder.
properties:
equity_cents:
type: integer
minimum: 0
realised_pnl_today_cents:
type: integer
open_positions_count:
type: integer
minimum: 0
responses:
'200':
description: Policy-check result
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
dry_run:
type: boolean
passed:
type: boolean
reason:
type: string
nullable: true
detail:
type: string
nullable: true
risk_cents:
type: integer
policy:
type: object
'400':
description: Invalid intent body
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/trades/{id}:
get:
operationId: getTradesId
summary: Get a single trade intent
tags:
- Trades
description: Single trade intent plus its linked executed order (if any). Owner-scoped. Requires `read` scope.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Trade intent + executed order
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
intent:
type: object
executed_order:
type: object
nullable: true
'404':
description: Intent not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/trades/{id}/approve:
post:
operationId: postTradesIdApprove
summary: Approve a trade intent
tags:
- Trades
description: Approve a pending intent and place the order at the broker NOW (atomic CAS transition guards against double-approval). Optional body overrides qty/notional at approval time. Requires `trade` scope (auto-granted on broker connect). 409 if already handled, 410 if expired.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
qty:
type: number
minimum: 0
notional_cents:
type: integer
minimum: 1
responses:
'200':
description: Intent approved + executed
headers:
Idempotency-Replayed:
$ref: '#/components/headers/IdempotencyReplayed'
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
intent:
type: object
execution:
type: object
properties:
ok:
type: boolean
executed_order_id:
type: string
broker_order_id:
type: string
filled_qty:
type: number
'400':
description: Execution failed (e.g. broker error, policy veto)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'404':
description: Not found or not pending
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: Already handled (idempotency)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'410':
description: Intent expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/trades/{id}/reject:
post:
operationId: postTradesIdReject
summary: Reject a trade intent
tags:
- Trades
description: Reject a pending intent (atomic CAS). Optional `reason`. Requires `trade` scope. 404 if not found or not pending.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
reason:
type: string
maxLength: 500
responses:
'200':
description: Intent rejected
headers:
Idempotency-Replayed:
$ref: '#/components/headers/IdempotencyReplayed'
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
rejected:
type: string
'404':
description: Not found or not pending
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/trader/run-now:
post:
operationId: postTraderRunNow
summary: Trigger a trader tick now
tags:
- Trades
description: Run a trader tick synchronously for the calling key and return the result. May produce intents (and, in auto mode, place real orders). Requires `trade` scope.
responses:
'200':
description: Tick result
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
tick:
type: object
/v1/trader/policy:
get:
operationId: getTraderPolicy
summary: Get execution policy
tags:
- Trades
description: 'The calling key''s execution policy (risk gates, mode, whitelist). Returns defaults (`_default: true`) if no policy row exists yet. Requires `read` scope.'
responses:
'200':
description: Execution policy
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
policy:
type: object
put:
operationId: putTraderPolicy
summary: Update execution policy
tags:
- Trades
description: Upsert the calling key's execution policy. Controls all safe-execution risk gates, so requires `trade` scope (broker must be connected first).
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
mode:
type: string
enum:
- review
- auto
max_risk_per_trade_bps:
type: integer
minimum: 1
maximum: 10000
daily_loss_limit_bps:
type: integer
minimum: 1
maximum: 10000
max_concurrent_positions:
type: integer
minimum: 1
maximum: 50
symbol_whitelist:
type: array
items:
type: string
maxLength: 20
maxItems: 100
max_notional_per_trade_cents:
type: integer
minimum: 0
manual_approvals_required:
type: integer
minimum: 0
maximum: 20
paused:
type: boolean
pause_reason:
type: string
maxLength: 200
responses:
'200':
description: Updated execution policy
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
policy:
type: object
'400':
description: Invalid policy body
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/trader/runs:
get:
operationId: getTraderRuns
summary: List recent trader-tick runs
tags:
- Trades
description: Recent trader-tick run records for the calling key. Requires `read` scope.
parameters:
- name: limit
in: query
schema:
type: integer
default: 20
minimum: 1
maximum: 100
responses:
'200':
description: Trader runs
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
runs:
type: array
items:
type: object
components:
parameters:
IdempotencyKey:
name: Idempotency-Key
in: header
required: false
description: 'Opt-in idempotency token (max 255 chars). The FIRST request carrying a given key is processed normally and its 2xx response is cached for 24h, scoped to (api_key + method + path + request-body hash). A retry with the SAME key and body replays the cached response and adds `Idempotency-Replayed: true`. Reusing the same key with a DIFFERENT body returns 422 (`idempotency_key_reuse`). The cache is per-process and in-memory, so on a multi-replica deploy a retry that lands on a different task re-executes — callers must already tolerate at-least-once delivery.'
schema:
type: string
maxLength: 255
headers:
IdempotencyReplayed:
description: Present and set to `true` only when this response was served from the idempotency cache instead of re-running the handler.
schema:
type: string
enum:
- 'true'
schemas:
ErrorEnvelope:
type: object
required:
- success
- error
properties:
success:
type: boolean
enum:
- false
error:
type: string
description: Human-readable error message
code:
type: string
description: Stable machine-readable error code, when present
request_id:
type: string
description: Correlation id from the X-Request-ID header
retry_after_ms:
type: integer
description: Suggested back-off for 429 responses (mirrors the Retry-After header in ms)
securitySchemes:
BearerAuth:
type: http
scheme: bearer
ApiKeyHeader:
type: apiKey
in: header
name: X-API-Key