Complete REST API reference for TF2 spelled item analytics
The TF2 Spell Handler API provides real-time endpoints for analysing spelled item premiums, calculating market trends, and accessing comprehensive spell data. All endpoints return JSON responses with CORS support for browser integration.
https://spell.pricedb.io/api/spellAPI requests are limited to100 requests per minute per IP address. Rate limit information is included in response headers:
RateLimit-Limit- Maximum requests per window (100)RateLimit-Remaining- Remaining requests in current windowRateLimit-Reset- Unix timestamp when the rate limit resetsNote:Health check endpoints (/health,/stats) and localhost requests are exempt from rate limiting.
All responses are in JSON format with appropriate HTTP status codes:
200- Success400- Bad Request (invalid or missing parameters)404- Not Found (resource doesn't exist)429- Rate Limit Exceeded (too many requests)500- Internal Server ErrorAll prices use standardized TF2 currency format:
{
"total_ref": 115.1, // Total value in refined metal
"keys": 2, // Whole keys (at current rate: 57.55 ref/key)
"metal": 0.0, // Remaining refined metal
"formatted": "2 keys" // Human-readable format
}Data is collected and updated on the following schedule:
These endpoints provide spell-specific analytics, premium calculations, and market insights based on real market data from Backpack.tf.
/api/spell/predictRECOMMENDED: Enhanced spell prediction with realistic flat-based price ranges. Combines market data with intelligent multipliers for low/mid/high estimates.
| Parameter | Type | Description |
|---|---|---|
spells | string | Comma-separated spell names (e.g., "Exorcism,Pumpkin Bombs") |
item | string | Item name for price prediction (required) |
{
"item_name": "Strange Rocket Launcher",
"spells": [
"Exorcism"
],
"spell_ids": [
2002
],
"base_price": {
"total_ref": 65.99,
"keys": 1,
"metal": 8.44,
"formatted": "1 keys, 8.4 ref"
},
"predictions": {
"low": {
"total_ref": 1315.39,
"keys": 22,
"metal": 49.89,
"formatted": "22 keys, 49.9 ref"
},
"mid": {
"total_ref": 1731.75,
"keys": 30,
"metal": 6.25,
"formatted": "30 keys, 6.3 ref"
},
"high": {
"total_ref": 2356.61,
"keys": 40,
"metal": 56.11,
"formatted": "40 keys, 56.1 ref"
}
},
"premium_ranges": {
"low": {
"ref": 1249.4,
"formatted": "21 keys, 41.4 ref"
},
"mid": {
"ref": 1665.76,
"formatted": "28 keys, 57.8 ref"
},
"high": {
"ref": 2290.62,
"formatted": "39 keys, 48.1 ref"
}
},
"market_data": {
"avg_flat_premium": 1665.76,
"sample_size": 206,
"confidence": "high"
},
"method": "flat_based_ranges",
"key_rate": 57.55,
"multipliers": {
"low": 0.75,
"mid": 1,
"high": 1.35
}
}Example:/api/spell/predict?spells=Exorcism&item=Strange%20Rocket%20Launcher
/api/spell/predict-spell-itemAlternative prediction endpoint accepting POST body. Returns comprehensive spell premium predictions for specific items with market insights.
| Parameter | Type | Description |
|---|---|---|
item_name | string | Full name of the item (e.g., "Strange Scattergun") - required |
spell_ids | array | Array of spell defindex IDs to analyse (e.g., [2003, 2002]) - required |
{
"item_name": "Strange Scattergun",
"base_price": {
"total_ref": 115.1,
"keys": 2,
"metal": 0,
"formatted": "2 keys"
},
"spell_premium": {
"total_ref": 1249.4,
"keys": 21,
"metal": 41.45,
"formatted": "21 keys, 41.4 ref"
},
"total_price": {
"total_ref": 1364.5,
"keys": 23,
"metal": 41.45,
"formatted": "23 keys, 41.4 ref"
},
"spell_data": {
"spell_ids": [
2003
],
"spell_names": [
"Pumpkin Bombs"
],
"avg_flat_premium": 1249.4,
"sample_size": 156,
"confidence": "high"
},
"method": "flat_based",
"key_rate": 57.55
}Example:/api/spell/predict-spell-item
/api/spell/spell-valueCalculate predicted premium for specific spell combinations based on market averages. Returns both flat (ref) and percentage-based premium estimates.
| Parameter | Type | Description |
|---|---|---|
ids | string | Comma-separated spell defindex IDs (e.g., "2003,2002") |
{
"spell_ids": [
2003,
2002
],
"predicted_flat": 25.5,
"predicted_percent": 328.99,
"avg_flat": 24.1,
"avg_percent": 315.8,
"count": 143,
"confidence": "high"
}/api/spell/spell-analyticsGet comprehensive market analytics for all spell combinations with sample sizes, averages, and update timestamps.
[
{
"spell_combo": [
2003
],
"avg_flat": 1249.4,
"avg_percent": 328.99,
"count": 156,
"last_updated": "2025-10-05T18:00:00.000Z"
},
{
"spell_combo": [
2002
],
"avg_flat": 1665.76,
"avg_percent": 531.26,
"count": 206,
"last_updated": "2025-10-05T18:00:00.000Z"
}
]Example:/api/spell/spell-analytics
/api/spell/item-spell-premiumCalculate detailed spell premium breakdown for a specific item and spell combination with base price, premium, and total.
| Parameter | Type | Description |
|---|---|---|
item | string | Item name or SKU (e.g., "Strange Scattergun") |
ids | string | Comma-separated spell defindex IDs (e.g., "2003") |
{
"item": "Strange Scattergun",
"spell_ids": [
2003
],
"base_price": {
"total_ref": 115.1,
"keys": 2,
"metal": 0,
"formatted": "2 keys"
},
"spell_premium": {
"total_ref": 1249.4,
"keys": 21,
"metal": 41.45,
"formatted": "21 keys, 41.4 ref"
},
"total_price": {
"total_ref": 1364.5,
"keys": 23,
"metal": 41.45,
"formatted": "23 keys, 41.4 ref"
},
"premium_percent": 1085.6,
"market_data": {
"sample_size": 156,
"confidence": "high",
"avg_flat_premium": 1249.4
}
}Example:/api/spell/item-spell-premium?item=Strange%20Scattergun&ids=2003
/api/spell/spell-id-to-nameConvert spell defindex ID to human-readable spell name.
| Parameter | Type | Description |
|---|---|---|
id | number | Spell defindex ID (e.g., 2003) |
{
"id": 2003,
"name": "Pumpkin Bombs",
"type": "effect",
"attributeId": 1004
}/api/spell/spell-name-to-idConvert spell name to defindex ID. Case-insensitive partial matching supported.
| Parameter | Type | Description |
|---|---|---|
name | string | Spell name (e.g., "Exorcism") |
{
"name": "Exorcism",
"id": 2002,
"type": "effect",
"attributeId": 1003
}/api/spell/spellsGet complete list of all available TF2 spells with IDs, names, types, and attribute information.
[
{
"id": 2003,
"name": "Pumpkin Bombs",
"type": "effect",
"attributeId": 1004
},
{
"id": 2002,
"name": "Exorcism",
"type": "effect",
"attributeId": 1003
},
{
"id": 2007,
"name": "Team Spirit Footprints",
"type": "footprint",
"attributeId": 1008
}
]Example:/api/spell/spells
Monitor the spell data collection process and view collection statistics.
/api/spell/fetcher-statusGet real-time status of the spell data collection service. Shows last run time, next scheduled collection, and comprehensive statistics including rate limits and errors.
{
"status": "active",
"isRunning": false,
"lastRunTime": "2025-10-05T18:00:00.000Z",
"nextScheduledRun": "2025-10-06T00:00:00.000Z",
"statistics": {
"totalFetched": 1547,
"totalAdded": 234,
"totalUpdated": 56,
"rateLimits": 2,
"errors": 0
},
"schedule": "Every 6 hours (00:00, 06:00, 12:00, 18:00 UTC)",
"historicalDataRange": "6 months (180 days)",
"lastRunDuration": "24.5 minutes",
"performance": {
"itemsPerMinute": 63.1,
"avgResponseTime": "952ms"
}
}Example:/api/spell/fetcher-status
Endpoints for monitoring service health, retrieving system statistics, and checking operational status.
/api/spell/healthSimple health check endpoint for uptime monitoring and service availability checks. Returns 200 OK if service is operational.
{
"status": "ok",
"timestamp": "2025-10-05T20:30:00.000Z",
"uptime": "72h 15m",
"version": "2.0.0"
}Example:/api/spell/health
/api/statsComprehensive service statistics dashboard. Includes database health, spell fetcher status, cache metrics, and real-time system performance.
{
"status": "online",
"timestamp": "2025-10-05T20:30:00.000Z",
"database": {
"connected": true,
"totalSpelledItems": 1547,
"analyzedCombos": 79,
"lastCleanup": "2025-10-05T00:00:00.000Z"
},
"fetcher": {
"status": "idle",
"isRunning": false,
"lastRun": "2025-10-05T18:00:00.000Z",
"nextRun": "2025-10-06T00:00:00.000Z",
"statistics": {
"totalFetched": 1547,
"totalAdded": 234,
"totalUpdated": 56,
"rateLimits": 2,
"errors": 0
}
},
"keyPrices": {
"ref": 57.55,
"usd": 2.14,
"lastUpdated": {
"ref": "2025-10-05T20:25:00.000Z",
"usd": "2025-10-05T00:00:00.000Z"
}
},
"performance": {
"avgResponseTime": "45ms",
"requestsPerMinute": 23,
"cacheHitRate": "87%"
},
"spells": {
"totalAvailable": 23,
"withMarketData": 15,
"avgPremium": "328.5%"
}
}Example:/api/stats
/api/spell/status-proxyProxy endpoint for accessing main pricedb.io status API. Returns unified status across all TF2 Price DB services.
{
"status": "operational",
"services": {
"api": "operational",
"database": "operational",
"spellHandler": "operational"
},
"lastUpdate": "2025-10-05T20:30:00.000Z"
}Example:/api/spell/status-proxy
Predictions include confidence levels based on available market data:
Each prediction provides three price points:
For questions or issues, join ourDiscord communityor visitGitHub.