MarketIntell Agent Execution API
Durable async, batch, polling, and cancellation contracts
Durable async, batch, polling, and cancellation contracts
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-agent-execution-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 Agent Execution 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: Agent Execution
description: Durable async, batch, polling, and cancellation contracts
paths:
/v1/agent/execute-async:
post:
operationId: postAgentExecuteAsync
summary: Start a durable agent execution
tags:
- Agent Execution
description: Queue a persisted Mastra workflow and return immediately. The run is owner-scoped, includes evidence by default, survives API process restarts when storage is configured, and can be polled or canceled. Use an Idempotency-Key to retry safely.
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
minLength: 1
maxLength: 10000
session_id:
type: string
format: uuid
mode:
type: string
enum:
- auto
- deep
default: auto
domain:
type: string
enum:
- crypto
- us_equities
- india_stocks
portfolio_id:
type:
- string
- 'null'
format: uuid
include_portfolio:
type:
- boolean
- 'null'
include_facts:
type: boolean
const: true
default: true
description: Async agent executions always include the neutral evidence projection.
response_format:
type: object
properties:
type:
type: string
enum:
- text
- json_schema
- trade_setup
default: text
json_schema:
type: object
additionalProperties: true
responses:
'202':
description: Execution accepted
headers:
Location:
description: Relative polling URL
schema:
type: string
Retry-After:
description: Suggested polling delay in seconds
schema:
type: integer
Idempotency-Replayed:
$ref: '#/components/headers/IdempotencyReplayed'
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
type: object
required:
- contract_version
- run_id
- status
- poll_url
- retry_after_ms
properties:
contract_version:
type: string
enum:
- '1.0'
run_id:
type: string
format: uuid
status:
type: string
enum:
- pending
poll_url:
type: string
retry_after_ms:
type: integer
minimum: 1
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'403':
description: Scope or tier denied
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'429':
description: Quota exhausted
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/agent/batch:
post:
operationId: postAgentBatch
summary: Start up to five agent executions
tags:
- Agent Execution
description: Submit 1-5 durable executions in one request. Each request id must be unique. Every accepted item consumes its own daily query credit; rejected items include a stable error code. Use an Idempotency-Key to replay the batch safely.
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- requests
properties:
requests:
type: array
minItems: 1
maxItems: 5
items:
allOf:
- type: object
required:
- message
properties:
message:
type: string
minLength: 1
maxLength: 10000
session_id:
type: string
format: uuid
mode:
type: string
enum:
- auto
- deep
default: auto
domain:
type: string
enum:
- crypto
- us_equities
- india_stocks
portfolio_id:
type:
- string
- 'null'
format: uuid
include_portfolio:
type:
- boolean
- 'null'
include_facts:
type: boolean
const: true
default: true
description: Async agent executions always include the neutral evidence projection.
response_format:
type: object
properties:
type:
type: string
enum:
- text
- json_schema
- trade_setup
default: text
json_schema:
type: object
additionalProperties: true
- type: object
required:
- id
properties:
id:
type: string
minLength: 1
maxLength: 64
responses:
'202':
description: Batch processed; inspect each item for accepted/rejected state
headers:
Idempotency-Replayed:
$ref: '#/components/headers/IdempotencyReplayed'
content:
application/json:
schema:
type: object
additionalProperties: true
'400':
description: Invalid batch
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'403':
description: Scope or tier denied
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
/v1/agent/runs/{runId}:
get:
operationId: getAgentRun
summary: Poll an agent execution
tags:
- Agent Execution
description: Return a tenant-owned run's state. Pending/running responses include Retry-After and retry_after_ms. Completed responses contain AgentExecutionEnvelope in data.result.
parameters:
- name: runId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Current execution state
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
type: object
properties:
contract_version:
type: string
enum:
- '1.0'
run_id:
type: string
format: uuid
status:
type: string
enum:
- pending
- running
- completed
- failed
- canceled
result:
anyOf:
- $ref: '#/components/schemas/AgentExecutionEnvelope'
- type: 'null'
error:
type:
- object
- 'null'
additionalProperties: true
retry_after_ms:
type: integer
'404':
description: Run not found or owned by another key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
delete:
operationId: deleteAgentRun
summary: Cancel an agent execution
tags:
- Agent Execution
description: Cancel a tenant-owned pending or running workflow execution.
parameters:
- name: runId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Run canceled
content:
application/json:
schema:
type: object
additionalProperties: true
'404':
description: Run not found or owned by another key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
'409':
description: Run already completed or failed and can no longer be canceled
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
components:
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:
AgentExecutionEnvelope:
type: object
required:
- contract_version
- execution_id
- status
- session_id
- content
- disclaimer
- timestamp
- specialists_used
- latency_ms
- reasoning_summary
- provenance
- delivery
- recovery
properties:
contract_version:
type: string
enum:
- '1.0'
description: Version of the transport-neutral agent execution contract.
execution_id:
type: string
description: Stable correlation id for this execution.
status:
type: string
enum:
- completed
session_id:
type: string
format: uuid
content:
type: string
structured_output:
type:
- object
- 'null'
additionalProperties: true
disclaimer:
type: string
timestamp:
type: string
format: date-time
intent:
type: string
specialists_used:
type: array
items:
type: string
latency_ms:
type: number
classification:
type:
- object
- 'null'
additionalProperties: true
correlation:
type:
- object
- 'null'
additionalProperties: true
fact_projection:
type: object
description: Neutral facts and thesis projection when evidence was requested.
additionalProperties: true
degradation:
type: object
description: Present when a requested T2/T3 path fell back to T1.
additionalProperties: true
reasoning_summary:
type: object
required:
- kind
- disclosure
- intent
- domain
- tokens
- specialists
- quality
- evidence
- uncertainty
description: Safe evidence/decision summary. This is not hidden chain-of-thought and never contains model scratchpads.
properties:
kind:
type: string
enum:
- evidence_summary
disclosure:
type: string
intent:
type:
- string
- 'null'
domain:
type:
- string
- 'null'
tokens:
type: array
items:
type: string
timeframe:
type:
- string
- 'null'
specialists:
type: array
items:
type: string
quality:
type:
- object
- 'null'
description: Bounded reasoning outcome and evidence-coverage metrics; never hidden chain-of-thought or scratchpads.
required:
- direction
- confidence
- verification_score
- convergence
- fact_count
- cited_fact_count
- chain_count
- tension_count
- uncited_number_count
properties:
direction:
type: string
confidence:
type: number
minimum: 0
maximum: 100
verification_score:
type: number
minimum: 0
maximum: 100
convergence:
type: string
fact_count:
type: integer
minimum: 0
cited_fact_count:
type: integer
minimum: 0
chain_count:
type: integer
minimum: 0
tension_count:
type: integer
minimum: 0
uncited_number_count:
type: integer
minimum: 0
evidence:
type: object
required:
- fact_count
- must_cite_fact_ids
- facts
properties:
fact_count:
type: integer
minimum: 0
must_cite_fact_ids:
type: array
items:
type: string
facts:
type: array
items:
type: object
additionalProperties: true
uncertainty:
type: object
properties:
alignment:
type:
- string
- 'null'
score:
type:
- number
- 'null'
confirming:
type: array
items:
type: string
contradicting:
type: array
items:
type: string
provenance:
type: object
required:
- sources
- cited_facts
properties:
sources:
type: array
items:
type: string
cited_facts:
type: array
items:
type: object
additionalProperties: true
delivery:
type: object
required:
- transport
- requested_mode
- degraded
properties:
transport:
type: string
enum:
- rest
- mcp
- a2a
- internal
requested_mode:
type: string
enum:
- auto
- deep
requested_tier:
type:
- string
- 'null'
enum:
- t2
- t3
- null
delivered_tier:
type:
- string
- 'null'
enum:
- t1
- t2
- t3
- null
degraded:
type: boolean
recovery:
type:
- object
- 'null'
description: Machine-actionable retry guidance when delivery degraded.
additionalProperties: true
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)
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
securitySchemes:
BearerAuth:
type: http
scheme: bearer
ApiKeyHeader:
type: apiKey
in: header
name: X-API-Key