Skip to main content

Overview

The DelphAI X402 API allows you to create prediction markets programmatically. Each API call costs 1 WLFI USD (World Liberty Financial USD) paid via the X402 protocol.

Endpoint

Authentication

This endpoint requires a payment of 1 WLFI USD via X402 protocol for each call. The payment is handled automatically through the X402 SDK using ERC-2612 permit signatures. Payment Details:
  • Token: WLFI USD (World Liberty Financial USD)
  • Symbol: USD1
  • Amount: 1 WLFI (1000000000000000000 wei)
  • Network: BSC (Binance Smart Chain)
  • Token Address: 0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d

Request

Request Body

string
required
The main question for the prediction market
string
required
Detailed description of the market and resolution criteria
string[]
required
Array of possible outcomes (minimum 2 options)
number
required
Unix timestamp for when the market will be resolved (must be in the future)

Example Request

Response

Success Response

boolean
Indicates if the market was created successfully
string
The unique identifier for the created market
string
The blockchain transaction hash for the market creation
Success (200 OK)

Error Responses

Bad Request (400)
Internal Server Error (500)

Code Examples

The x402fetch library automatically handles the X402 payment flow and permit signatures. Manual construction of payment headers is not recommended.

Installation

Install the X402 SDK in your project:
npm
yarn
pnpm

Important Notes

  • Each API call costs 1 WLFI USD paid via X402 protocol on BSC
  • The resolutionTimestamp must be in the future
  • A minimum of 2 possibleOutcomes is required
  • Markets are published on-chain and cannot be deleted
  • Payment is automatically verified before the market is created
The X402 protocol uses ERC-2612 permit signatures, which means users don’t need to make a separate token approval transaction. The payment is gasless from the user’s perspective.

Next Steps

Prediction Markets

Learn more about how prediction markets work

Market Lifecycle

Understand the market lifecycle and resolution process