terminalDeveloper Platform API

A programmable interface for creating, embedding, and consuming prediction markets.

Foremarket exposes its full functionality through a developer-first API layer designed around one core assumption: prediction markets should be created, managed, and consumed programmatically, not manually curated through a single UI.

The Developer Platform API turns Foremarket into a market factory that applications, DAOs, teams, and protocols can embed directly into their own products.

Design Principles

The API is built around four non-negotiable principles:

  1. Parity Anything possible via the Foremarket UI is possible via the API. There is no privileged “first-party” path.

  2. Determinism Market creation, state transitions, and resolution follow strict schemas and state machines. No implicit behavior.

  3. Composability Markets are designed to be embedded, indexed, and referenced by external systems.

  4. Permissionlessness The API does not gate market creation, only enforces economic and structural constraints.


Market Creation API

Market creation is a single atomic operation that results in an on-chain market object. Developers supply a fully specified market definition.

Create Market

POST /markets/create

Payload

{
  "question": "Will Protocol X ship v2 before July 1, 2026?",
  "outcomes": ["Yes", "No"],
  "expiry_timestamp": 1782864000,
  "resolution": {
    "type": "ExternalOracle",
    "source": "oracle_id",
    "rule": "boolean"
  },
  "creator_bond": "5000000000000000000",
  "fee_bps": {
    "trading": 50,
    "creator": 20
  }
}

Properties

  • question must be precise and time-bounded

  • outcomes must be mutually exclusive

  • resolution is immutable after creation

  • creator_bond enforces accountability

  • fee_bps defines incentive routing

On success, the API returns a market_id that uniquely identifies the deployed market across the protocol.


Market Lifecycle and State API

Developers can query and monitor market state deterministically.

Get Market State

Response

Market states are strictly one-way:

This allows developers to reason about exactly when trading, resolution, and settlement are possible without ambiguity.


Trading and Pricing API

Foremarket exposes read-only pricing and liquidity endpoints for embedding markets externally.

Get Prices

Prices are implied probabilities derived directly from AMM state. No smoothing or off-chain adjustment is applied.

Submit Trade (via SDK / Wallet)

Trades are signed client-side and submitted on-chain. The API provides transaction construction helpers but never custody or execution authority.


Resolution and Dispute API

Resolution is explicit and auditable.

Submit Resolution (Creator / Oracle)

Dispute Resolution

Disputes are economic actions, not moderation requests. All incentives are enforced at the protocol level.


Data and Indexing API

Foremarket is designed to be consumed as a data layer.

Available feeds include:

  • Market discovery and filtering

  • Historical price and volume

  • Liquidity depth

  • Settlement outcomes

  • Creator performance metrics

This enables:

  • Analytics dashboards

  • Governance tooling

  • Risk systems

  • Media and forecasting platforms


Embedding and Use Cases

The API enables use cases that are impossible on closed platforms:

  • DAOs creating governance outcome markets inline

  • Protocols spawning markets around upgrades automatically

  • Communities running private or public forecasting layers

  • Media outlets embedding live probabilities into content

  • Enterprises running internal prediction markets

Summary

The Foremarket Developer Platform API treats prediction markets as programmable objects. Creation is permissionless. Resolution is explicit. Incentives are economic and data is open.

Last updated