For the complete documentation index, see llms.txt. This page is also available as Markdown.

x402

x402 is a pay-per-use API access method that requires no subscription. You pay for each call directly using stablecoins like USDC on Base, Solana, or Polygon.

Minara x402 endpoint: https://x402.minara.ai

Explore all endpoints: Minara on x402scan


How x402 works

x402 follows a payment-challenge flow:

  1. You make a request to a protected endpoint without payment.

  2. The server responds with 402 Payment Required and payment instructions (amount, currency, recipient address, chain).

  3. You include a payment proof in the x-payment-response header and retry the request.

  4. The server verifies the proof, processes the payment on-chain, and returns the API response.

The recommended approach is to use the x402 SDK, which handles this flow automatically.


Getting started with the SDK

Prerequisites

  • A crypto wallet with USDC (any EVM-compatible wallet, or a Solana wallet)

  • Node.js / Python / Go

  • Your wallet's private key (for signing payments)

Install

Make a request

The SDK handles payment challenges automatically. Just make requests normally.

For the full x402 quickstart, see x402 documentation.


API reference

Base URL: https://x402.minara.ai

All endpoints require the x-payment-response header (handled automatically by the SDK).

Chat (Base Chain)

post

Ask Minara AI - Intelligent crypto assistant

Authorizations
x-payment-responsestringRequired

Payment proof token obtained from x402 payment challenge flow. Required after completing payment.

Body
userQuerystringRequired

Required. User query content.

Responses
201

Successful response

application/json
contentstringOptional

AI response content.

post
/x402/chat

Chat Expert (Base Chain)

post

Ask Minara AI - Intelligent crypto assistant

Authorizations
x-payment-responsestringRequired

Payment proof token obtained from x402 payment challenge flow. Required after completing payment.

Body
userQuerystringRequired

Required. User query content.

Responses
201

Successful response

application/json
contentstringOptional

AI response content.

post
/x402/chat/expert

Perpetual Trading Suggestion

post

Get AI-powered perpetual trading suggestions with long/short recommendations, entry price, stop loss, take profit levels, and confidence score.

Authorizations
x-payment-responsestringRequired

Payment proof token obtained from x402 payment challenge flow. Required after completing payment.

Body
symbolstringRequired

Required. Trading symbol (e.g., 'BTC', 'ETH', 'SOL').

stylestring · enumOptional

Optional. Trading style: 'scalping', 'day-trading', or 'swing-trading'. Default: 'scalping'.

Default: scalpingPossible values:
marginUSDnumberOptional

Optional. Margin in USD. Default: 1000.

Default: 1000
leveragenumber · min: 1 · max: 40Optional

Optional. Leverage multiplier (max: 40). Default: 10.

Default: 10
strategystringOptional

Optional. Strategy type. Default: 'max-profit'. More strategies coming soon.

Default: max-profit
Responses
201

Successful response

application/json
entryPricenumberOptional

Recommended entry price.

sidestring · enumOptional

Trading side recommendation.

Possible values:
stopLossPricenumberOptional

Recommended stop loss price.

takeProfitPricenumberOptional

Recommended take profit price.

confidencenumber · max: 100Optional

Confidence score (0-100).

reasonsstring[]Optional

Analysis reasons based on technical indicators.

risksstring[]Optional

Risk factors to consider.

post
/x402/perp-trading-suggestion

Intent to Swap Transaction

post

Convert natural language trading intent into an executable swap transaction payload. Compatible with OKX DEX by default.

Authorizations
x-payment-responsestringRequired

Payment proof token obtained from x402 payment challenge flow. Required after completing payment.

Body
intentstringRequired

Required. Natural language swap intent (e.g., 'swap 0.1 ETH to USDC').

walletAddressstringRequired

Required. User wallet address (0x...).

chainstringOptional

Optional. Chain name (e.g., 'base', 'ethereum', 'bsc', 'arbitrum', 'optimism').

Responses
201

Successful response

application/json
post
/x402/intent-to-swap-tx

Prediction Market Analysis (Base Chain)

post

AI-powered prediction market analysis. Analyze prediction market events and get probability estimates for each outcome with detailed reasoning.

Authorizations
x-payment-responsestringRequired

Payment proof token obtained from x402 payment challenge flow. Required after completing payment.

Body
linkstringRequired

Required. Prediction market page link (e.g., Polymarket event URL).

modestring · enumRequired

Required. Chat mode: 'fast' or 'expert'.

Possible values:
only_resultbooleanOptional

Optional. Only return prediction probabilities without reasoning. Default: false.

Default: false
customPromptstringOptional

Optional. Custom instructions to guide the analysis. Use this to specify focus areas, risk preferences, or analysis style.

Responses
201

Successful response

application/json
reasoningstringOptional

AI reasoning and analysis (empty if only_result=true).

post
/x402/prediction-market-ask

Multi-chain endpoints

Solana and Polygon variants are available at /x402/solana/chat, /x402/solana/chat/expert, /x402/polygon/chat, and /x402/polygon/chat/expert with identical request/response shapes.


Error handling

Code
Error
Meaning

402

payment_required

Normal — SDK handles this automatically

401

unauthorized

Payment proof invalid or expired

400

bad_request

Missing or invalid request parameters

429

rate_limit_exceeded

AI endpoints: 60 req/min; Trading endpoints: 30 req/min


Resources

Last updated

Was this helpful?