MPP Quickstart

Use the Stock Trends API with MPP

Machine Payment Protocol (MPP) is the session-based payment rail for the Stock Trends API. Instead of paying each premium request individually on-chain, an agent uses a funded session and each successful request debits that session balance.

MPP is best for repeated agent workflows, budgeted automation, and long-running integrations that need lower-friction premium access than per-request on-chain settlement.

MPP vs x402

MPP

Best for repeated agent workflows

  • Fund a session once
  • Use a channel_id for repeated requests
  • Session balance is reserved and captured automatically
  • Lower friction for recurring premium calls
x402

Best for permissionless per-request payment

  • No funded session required
  • Pay request-by-request
  • Good for event-driven or stateless usage
  • Best for no-account machine payment flows

How MPP works

  1. Create or receive a funded MPP session.
  2. Store the provided channel_id.
  3. Discover live endpoint pricing with GET /v1/pricing/catalog.
  4. Call a premium endpoint with MPP headers.
  5. The API authorizes the request against the funded session.
  6. If the request succeeds, the API captures the charge and updates the session balance.

Pricing clarity: STC and USD cost

Stock Trends Credits (STC) are the API's pricing unit. For current billing and payment presentation, 1 STC = $1.00 USD. This means a request priced at 0.50 STC costs $0.50 USD, a request priced at 0.75 STC costs $0.75 USD, and a request priced at 1.25 STC costs $1.25 USD.

x402 and MPP requests may be settled through machine-payment rails, including USDC on Base where supported, but the user-facing economic cost is still shown from the STC-denominated endpoint price. The live pricing catalog and response headers remain authoritative before execution.

No hidden conversion math: current USD cost = STC price × $1.00. Always check GET /v1/pricing/catalog and the payment-required response before running paid workflows.

Recommended first endpoint

Start with:

GET https://api.stocktrends.com/v1/agent/screener/top

Current live cost: 0.50 STC ($0.50 USD) per call.

Always treat the live pricing catalog and response headers as authoritative for current endpoint cost.

Required MPP headers

HeaderExampleDescription
X-StockTrends-Payment-Method mpp Payment rail identifier
X-StockTrends-Payment-Network base Network context for the funded workflow
X-StockTrends-Payment-Reference mpp-ref-12345 Unique per-request payment reference
X-StockTrends-Payment-Amount 0.5 Presented request amount in STC
X-StockTrends-Payment-Channel-Id mppch_... The funded session channel identifier

Optional agent identity headers

X-StockTrends-Agent-Id: your-agent-id
X-StockTrends-Agent-Type: autonomous
X-StockTrends-Agent-Vendor: your-vendor
X-StockTrends-Request-Purpose: screening

Example request

curl "https://api.stocktrends.com/v1/agent/screener/top" \
  -H "X-StockTrends-Agent-Id: your-agent-id" \
  -H "X-StockTrends-Payment-Method: mpp" \
  -H "X-StockTrends-Payment-Network: base" \
  -H "X-StockTrends-Payment-Reference: mpp-ref-12345" \
  -H "X-StockTrends-Payment-Amount: 0.5" \
  -H "X-StockTrends-Payment-Channel-Id: mppch_..."

On success, the API authorizes the request against the funded session, serves the premium response, and captures the charge from the session balance.

Who MPP is for

  • Agent frameworks that make repeated premium requests
  • Portfolio and decision workflows that need budgeted automation
  • Internal or early-access integrations that prefer funded session balances
  • Teams that want lower-friction repeated usage than per-call x402

Getting access

MPP is available for funded session-based agent integrations. Contact Stock Trends if you want MPP enabled for your workflow or want help selecting between MPP and x402.