API Reference · v1

API Documentation

The Margin of Insight API returns analyst-quality equity research as structured JSON. Live in production as of 2026-05-11 — free and paid tiers both available. Every response includes the same standard envelope — tier, freshness metadata, and markdown content fields.

Base URL: https://app.marginofinsight.com/api/v1  ·  Coverage: US-listed SEC filers only.

Free tier

$0

No auth. Primer only.

Fundamental

$1.00 per call

SPT bearer token.

Full Memo

$2.00 per call

SPT bearer token.

Machine-readable spec: openapi.json  ·  Agent description: llms.txt

Authentication

The free tier requires no credentials. Paid endpoints take a Stripe Link Shared Payment Token (SPT, prefix spt_) as a Bearer token. There is no marginofinsight account, no static credential, and no pre-funded balance — Stripe verifies and charges the token in-line on each call.

Paid request — Stripe SPT as Bearer

curl https://app.marginofinsight.com/api/v1/research/AAPL/fundamental \
  -H "Authorization: Bearer spt_xxxxxxxxxxxxxxxx"

How to obtain a token: your operator opens Stripe Link, authorizes you to spend from their wallet, and grants a token scoped to marginofinsight's network_business_profile with currency=usd and usage_limits.max_amount ≥ 200 cents. Read the profile from GET /api/v1/well-known/spt before requesting the token. Stripe reference: docs.stripe.com/agentic-commerce.

Each successful paid call introspects the token, charges via Stripe payment_intents.create for the tier amount ($1.00 or $2.00), and returns the JSON envelope. Tokens are revocable in Stripe Link at any time; revocation propagates within ~60s. Pass your own Idempotency-Key header for retry safety.

Response Format

Every research response uses the same envelope. Content fields are markdown strings — structured JSON wrapping markdown text, not HTML.

{
  "ticker":          "V",
  "company":         "Visa",
  "exchange":        "NYSE",
  "report_type":    "primer",         // "primer" | "fundamental" | "memo"
  "tier":           "free",           // "free" | "fundamental" | "full"
  "generated_at":   "2026-04-05T08:06:50Z",
  "coverage_as_of": "2026-Q2",
  "freshness_days": 35,
  "steps_included": [1, 2, 3],
  "data": {
    "overview":           "# Visa Inc. (NYSE: V)\n\n...",
    "financial_snapshot": "## Financial Quality Assessment\n\n...",
    "catalysts":          "## Analyst Debate\n\n..."
  },
  "metadata": {
    "data_sources":                    ["SEC EDGAR XBRL", "earnings transcripts", "Tavily web search"],
    "model":                           "claude-sonnet-4-6",
    "steps_run":                       3,
    "estimated_self_research_cost_usd": 0.50,
    "api_version":                     "v1"
  }
}

Free Endpoints — No Authentication Required

GET /api/v1/research/{ticker}/primer FREE

Returns the company primer — business overview, financial snapshot, and recent catalysts. No authentication required. Use to orient an agent to a company before deciding whether to purchase deeper analysis.

Request

curl https://app.marginofinsight.com/api/v1/research/V/primer

Fields returned in data

overviewBusiness model, value chain, unit economics, core products/services
financial_snapshotRevenue, margins, EPS, FCF — last 4 quarters; key ratios (P/E, EV/EBITDA)
catalystsEarnings analysis, guidance, analyst debate, recent news

Note: for some research sources, overview may be null when no dedicated overview step exists.

GET /api/v1/coverage FREE

Returns all covered tickers with freshness metadata. Use before making a paid call to verify coverage exists.

curl https://app.marginofinsight.com/api/v1/coverage

Response shape

{
  "count": 19,
  "tickers": [
    {
      "ticker":        "AXON",
      "company":       "Axon Enterprise",
      "exchange":      "NASDAQ",
      "sector":        "Technology",
      "covered":       true,
      "last_updated":  "2026-04-10T12:37:58Z",
      "freshness_days": 30
    }
  ],
  "api_version": "v1"
}
GET /api/v1/coverage/{ticker} FREE

Returns coverage metadata for a single ticker — availability, freshness, and which tiers are accessible.

curl https://app.marginofinsight.com/api/v1/coverage/V

Response shape

{
  "ticker":          "V",
  "company":         "Visa",
  "exchange":        "NYSE",
  "sector":          "Financials",
  "covered":         true,
  "last_updated":    "2026-04-05T08:06:50Z",
  "coverage_as_of":  "2026-Q2",
  "freshness_days":  35,
  "tiers_available": ["free", "fundamental", "full"],
  "api_version":     "v1"
}
POST /api/v1/coverage/request FREE

Request coverage for a ticker not yet in the universe. Free, no authentication required. Fulfilled in 24–48 hours. Provide an email to be notified when research is ready.

curl -X POST https://app.marginofinsight.com/api/v1/coverage/request \
  -H "Content-Type: application/json" \
  -d '{"ticker": "AAPL", "email": "you@example.com"}'

Response — queued

{
  "status":                 "queued",
  "ticker":                 "AAPL",
  "request_id":             "cmp034k620001nbbp...",
  "estimated_ready_hours":  24,
  "notification":           "We'll email you@example.com when research is ready."
}

Paid Endpoints — SPT Bearer Token Required

Live. Paid endpoints require a Stripe Link Shared Payment Token (spt_…) as a Bearer credential. See the Authentication section for the operator setup flow. Each call is verified and charged through Stripe — no marginofinsight account, no pre-funded balance.

GET /api/v1/research/{ticker}/fundamental $1.00

Returns 12-step fundamental analysis (incl. returns on capital / ROIC). Sufficient for screening agents filtering 20 stocks down to 3–4. Includes all free tier fields plus earnings transcripts, competitive positioning, risk register, balance sheet, and industry context.

curl https://app.marginofinsight.com/api/v1/research/V/fundamental \
  -H "Authorization: Bearer spt_xxxxxxxxxxxxxxxx"

Additional fields in data (beyond primer)

revenue_breakdown earnings_analysis competitive_positioning financial_trends risk_register balance_sheet capital_allocation industry_context
GET /api/v1/research/{ticker}/memo $2.00

Returns the full 21-step investment memo (incl. returns on capital and institutional/insider activity). Equivalent to a sell-side initiation note. An LLM generating this research independently costs $7–9 in API calls and 10–20 minutes.

curl https://app.marginofinsight.com/api/v1/research/V/memo \
  -H "Authorization: Bearer spt_xxxxxxxxxxxxxxxx"

Additional fields beyond fundamental

moat_analysis management_quality dcf_valuation comp_analysis sensitivity_matrix scenarios investment_thesis structured_memo

Error Responses

404 — Ticker not covered

{
  "error":       "not_covered",
  "ticker":      "AAPL",
  "request_url": "POST /api/v1/coverage/request"
}

401 — SPT malformed, revoked, or expired

{
  "error":   "spt_invalid",
  "message": "Token revoked or expired. Re-issue via Stripe Link."
}

402 — Stripe decline or usage_limits exceeded

{
  "error":         "payment_declined",
  "decline_code":  "card_declined",
  "message":       "Stripe declined the payment. See decline_code for reason."
}

429 — Rate limited

{
  "error":   "rate_limited",
  "message": "Too many requests. Retry-After header indicates seconds to wait."
}

Billing & SPT Lifecycle

There is no marginofinsight account in the agent path. Billing happens entirely on the Stripe side via your Shared Payment Token. The token represents your operator's authorization to spend from their Stripe Link wallet — marginofinsight introspects and charges the token on each paid call. Nothing is stored on our side beyond the request log.

Per-call flow

  1. Agent calls a paid endpoint with Authorization: Bearer spt_….
  2. marginofinsight introspects the token via GET /v1/shared_payment/granted_tokens/{id}. Verifies deactivated_at is null, usage_limits.max_amount ≥ tier cost, currency=usd, expires_at > now. (60s cache.)
  3. marginofinsight charges via POST /v1/payment_intents with payment_method_data[shared_payment_granted_token]. The caller's Idempotency-Key header is passed through to Stripe verbatim; if omitted, a per-request UUID is used. Agents are responsible for retry idempotency.
  4. On PaymentIntent.status=succeeded: report delivered. Any other status: HTTP 402 with Stripe's decline_code in the body.

Token lifecycle

  • Issuance & revocation: handled entirely in Stripe Link. Your operator can revoke at any time; revocation propagates within ~60s via the shared_payment.granted_token.deactivated webhook.
  • Refunds: if a delivery error occurs after a successful charge, marginofinsight issues a POST /v1/refunds automatically against the payment_intent ID from the call.
  • Stripe API version: Stripe-Version: 2026-04-22.preview — preview-API until SPT GA.
  • Stripe fees: standard card fees apply (~2.9% + $0.30 per charge). Effective margin: ~$0.67 on a $1 call, ~$1.34 on a $2 call.

Discovery

GET /api/v1/well-known/spt Read marginofinsight's network_business_profile for SPT scoping

Looking for a managed dashboard with usage history and a card on file? That product lives at app.marginofinsight.com and is built for human fund managers — see the homepage. The agent API path documented here uses SPT and does not require an account.

MCP Server LIVE

Model Context Protocol server using Streamable HTTP transport. Stateless, JSON responses. Six tools wired to the same research backend as the REST API.

Endpoint

https://app.marginofinsight.com/api/mcp

Native Streamable HTTP client config

{
  "mcpServers": {
    "margin-of-insight": {
      "transport": "streamable-http",
      "url":       "https://app.marginofinsight.com/api/mcp",
      "headers": {
        "Authorization": "Bearer spt_xxxxxxxxxxxx"
      }
    }
  }
}

claude_desktop_config.json (via mcp-remote bridge)

{
  "mcpServers": {
    "margin-of-insight": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://app.marginofinsight.com/api/mcp",
               "--header", "Authorization:Bearer spt_xxxxxxxxxxxx"]
    }
  }
}

Claude Desktop does not yet support native Streamable HTTP, so bridge via the community mcp-remote package. Drop your SPT into the Authorization header — paid tools use the same token as the REST API.

Tools

get_company_primer(ticker)Free — 3-step company primer
get_fundamental_analysis(ticker)$1.00 — 12-step fundamental analysis
get_investment_memo(ticker)$2.00 — 21-step investment memo
list_coverage()Free — all covered tickers
search_research(query)Free — semantic search across research corpus
request_coverage(ticker, email?)Free — queue an uncovered ticker

For paid tools, send Authorization: Bearer spt_… on the Streamable HTTP transport — the same Stripe SPT used for the REST API. No per-tool argument.