Overview
The Tradecraft API provides programmatic access to real-time token analytics on the Solana blockchain. It returns technical indicators (EMA, RSI, MACD, Fibonacci, buy/sell pressure) for any token tracked by the platform.
https://api.tradecraft.finance/v1Unlike traditional APIs, Tradecraft uses the x402 payment protocol for authentication. Instead of API keys, you pay per request using TRADECRAFT tokens on Solana. For high-volume usage, you can pre-purchase credit bundles at a discount.
Payment Token
TRADECRAFT H5FHcnP1MaAet83QJC8KaS5H8bJfUM3kYsWy7nCgBAGS on Solana mainnet. Prices are ~$0.0025 USD per request, dynamically converted to TRADECRAFT at the current market rate.
Authentication
There are two ways to authenticate requests:
Option A: Per-request x402 Payment
- Send your request without any payment headers
- Receive HTTP
402 Payment Requiredwith payment details in thePAYMENT-REQUIREDheader - Build and sign a Solana transaction paying the required TRADECRAFT tokens
- Retry the request with the
PAYMENT-SIGNATUREheader - Server settles the transaction on-chain and returns the data
Best for: programmatic clients using the @x402/core SDK
Option B: Pre-purchased Credit Token
- Purchase a credit bundle via
POST /v1/credits/purchase - Receive a credit token:
tc_credit_<64 hex chars> - Include it as a Bearer token on subsequent requests:
Authorization: Bearer tc_credit_<your_token>Best for: high-volume usage, simpler integration (no Solana signing per request)
Rate Limits
| Limit | Rate | Scope |
|---|---|---|
| Public endpoints | 30 requests / minute | Token data, credits |
When rate-limited, the API returns HTTP 429 Too Many Requests. Wait before retrying.
Response Format
All responses follow a consistent JSON structure:
{
"success": true,
"data": { ... },
"meta": {
"timestamp": "2025-01-15T10:30:00.000Z",
"requestId": "req_abc123"
}
}{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description"
},
"meta": {
"timestamp": "2025-01-15T10:30:00.000Z",
"requestId": "req_abc123"
}
}Get Token Data
/v1/token/:tokenAddressReturns current price, technical indicators, and buy/sell pressure data for any Solana token tracked by the platform.
Parameters
| Name | Type | Description |
|---|---|---|
tokenAddress | string (path) | Solana token mint address (base58, 32-44 chars) |
Pricing
~$0.0025 USD per request, paid in TRADECRAFT tokens at the current market rate. Use a credit token to avoid per-request on-chain payment.
curl -X GET "https://api.tradecraft.finance/v1/token/So11111111111111111111111111111111111111112" \
-H "Authorization: Bearer tc_credit_<your_token>"curl -X GET "https://api.tradecraft.finance/v1/token/So11111111111111111111111111111111111111112" \
-H "PAYMENT-SIGNATURE: <signed_payment>"{
"success": true,
"data": {
"token": "So11111111111111111111111111111111111111112",
"price": {
"usd": 148.52,
"sol": 1.0
},
"indicators": {
"m1": {
"ema9": 0.000232,
"ema21": 0.000222,
"ema50": 0.000202,
"ema200": 0.000169,
"rsi": 66.20,
"macd": { "line": 0.000012, "signal": 0.000013, "histogram": -0.0000008 },
"fibonacci": {
"swingHigh": 0.000251, "swingLow": 0.000197,
"level236": 0.000238, "level382": 0.000230,
"level500": 0.000224, "level618": 0.000217, "level764": 0.000209,
"ext1272": 0.000265, "ext1618": 0.000284,
"ext2000": 0.000305, "ext2618": 0.000338
}
},
"m5": { "ema9": 0.000200, "ema21": 0.000182, "..." : "..." },
"m15": { "ema9": 0.000173, "ema200": null, "..." : "..." },
"h1": { "ema9": 0.000149, "ema50": null, "ema200": null, "rsi": null, "macd": null, "..." : "..." },
"buySellPressure": {
"m1": 0, "m5": 0.482, "m15": 0.394,
"h1": 0.394, "h4": 0.508, "d1": 0.497
}
},
"dataSpan": {
"from": 1706000000000,
"to": 1706800000000,
"candleCounts": { "m1": 4320, "m5": 1440, "m15": 480, "h1": 120 }
}
},
"meta": {
"timestamp": "2025-01-15T10:30:00.000Z",
"requestId": "req_abc123"
}
}Error Codes
| Code | Status | Description |
|---|---|---|
INVALID_TOKEN_ADDRESS | 400 | Not a valid Solana base58 address |
TOKEN_NOT_FOUND | 404 | Token not tracked by the platform |
INSUFFICIENT_DATA | 404 | Not enough price history for indicators |
Available Indicators
Indicators are computed across multiple timeframes. Values may be null for tokens with insufficient price history.
| Indicator | Timeframes | Description |
|---|---|---|
| EMA (9, 21, 50, 200) | m1, m5, m15, h1 | Exponential Moving Averages — smoothed price trend lines. Price above EMA = bullish, below = bearish. Shorter periods (9, 21) react faster; longer periods (50, 200) show broader trend direction. |
| RSI (14) | m1, m5, m15, h1 | Relative Strength Index — momentum oscillator from 0 to 100. Above 70 = overbought (potential reversal down), below 30 = oversold (potential reversal up), around 50 = neutral. |
| MACD (12, 26, 9) | m1, m5, m15, h1 | Moving Average Convergence Divergence — trend and momentum indicator. Returns line, signal, and histogram. Positive histogram = bullish momentum, negative = bearish. When line crosses above signal = bullish crossover; below = bearish. Null when insufficient candle data. |
| Fibonacci | m1, m5, m15, h1 | Fibonacci retracement and extension levels calculated from the recent swing high/low. Retracements (23.6%, 38.2%, 50%, 61.8%, 76.4%) indicate potential support/resistance during pullbacks. Extensions (127.2%, 161.8%, 200%, 261.8%) project potential price targets beyond the swing high. Also returns the swingHigh and swingLow used for the calculation. |
| Buy/Sell Pressure | m1, m5, m15, h1, h4, d1 | Ratio of buy volume to total volume, from 0 to 1. A value of 0 means no buy volume was recorded in that timeframe (all sells or no trades). Above 0.5 = more buying pressure, below 0.5 = more selling pressure. Computed from on-chain swap data across multiple timeframes. |
Note: EMA-200 requires ~200 candles of data for the given timeframe before returning values. Newer or low-volume tokens may only have partial indicator coverage.
Credit System
Credits let you pre-pay for API requests in bulk at a discount. Instead of signing an on-chain transaction per request, you use a credit token as a Bearer header. One credit is consumed per request.
Volume Discounts
Up to 40% off with larger bundles
No Expiry
Credits remain valid until used
No On-Chain Overhead
Skip Solana signing on every request
Atomic Consumption
Credits are deducted atomically per request
List Credit Bundles
/v1/credits/bundlesReturns available credit bundles with prices in TRADECRAFT tokens at the current market rate. No payment or authentication required.
curl -X GET "https://api.tradecraft.finance/v1/credits/bundles"{
"success": true,
"data": {
"bundles": [
{ "credits": 10, "price": 224, "pricePerCredit": 23, "discount": "0%" },
{ "credits": 50, "price": 897, "pricePerCredit": 18, "discount": "20%" },
{ "credits": 100, "price": 1569, "pricePerCredit": 16, "discount": "30%" },
{ "credits": 500, "price": 6724, "pricePerCredit": 14, "discount": "40%" }
],
"currency": {
"asset": "H5FHcnP1MaAet83QJC8KaS5H8bJfUM3kYsWy7nCgBAGS",
"name": "TRADECRAFT",
"network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
}
},
"meta": { "timestamp": "2025-01-15T10:30:00.000Z" }
}Note: Prices are dynamic and change with the TRADECRAFT/USD market rate. The values above are illustrative. Returns HTTP 503 if the price feed is temporarily unavailable.
Purchase Credits
/v1/credits/purchase?bundle=<size>Purchase a credit bundle via x402 payment. The payment amount matches the bundle price returned by /bundles.
Query Parameters
| Name | Type | Description |
|---|---|---|
bundle | integer | Bundle size to purchase (10, 50, 100, or 500) |
curl -X POST "https://api.tradecraft.finance/v1/credits/purchase?bundle=50" \
-H "PAYMENT-SIGNATURE: <signed_payment>"{
"success": true,
"data": {
"token": "tc_credit_a1b2c3d4e5f6...64 hex chars",
"credits": 50,
"pricePaid": 897
},
"meta": { "timestamp": "2025-01-15T10:30:00.000Z" }
}Important: Store the token value securely. It cannot be retrieved again. Treat it like a password.
Error Codes
| Code | Status | Description |
|---|---|---|
INVALID_BUNDLE | 400 | Bundle size not available |
PRICE_UNAVAILABLE | 503 | TRADECRAFT price feed temporarily down |
Check Credit Balance
/v1/credits/balanceCheck the remaining credit balance for a credit token.
curl -X GET "https://api.tradecraft.finance/v1/credits/balance" \
-H "Authorization: Bearer tc_credit_<your_token>"{
"success": true,
"data": { "balance": 49 },
"meta": { "timestamp": "2025-01-15T10:30:00.000Z" }
}Error Codes
| Code | Status | Description |
|---|---|---|
MISSING_TOKEN | 401 | No Authorization header provided |
INVALID_TOKEN | 401 | Token format is not tc_credit_<...> |