SwordFinder API

Analyze baseball Statcast data to identify and score "sword swings"

API Documentation

Endpoint
POST /swords
Request Format
{
  "date": "YYYY-MM-DD"
}
Complete Request Example
URL: https://swordfinder.replit.app/swords
Method: POST
Headers: Content-Type: application/json
Body: {"date": "2025-05-24"}
Sword Swing Criteria
  • Swing outcome: swinging_strike or swinging_strike_blocked
  • Bat speed < 60 mph
  • Intercept Y > 14 inches
  • Swing path tilt > 30 degrees
Scoring Formula
sword_score = 0.35×(60-bat_speed)/60 + 0.25×swing_tilt/60 + 0.25×intercept_y/50 + 0.15×zone_penalty

Normalized to 50-100 scale, returns top 5 swings

Sword Swings API Tester

Select a date to analyze sword swings

How to Use the API

Production Endpoint
https://swordfinder.replit.app/swords
Example cURL Request
curl -X POST https://swordfinder.replit.app/swords \
  -H "Content-Type: application/json" \
  -d '{"date": "2025-05-24"}'
Example JavaScript Request
const response = await fetch('https://swordfinder.replit.app/swords', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    date: '2025-05-24'
  })
});

const data = await response.json();
console.log(data);
Example Python Request
import requests

response = requests.post(
    'https://swordfinder.replit.app/swords',
    json={'date': '2025-05-24'}
)

data = response.json()
print(data)

Example Response

{
  "success": true,
  "count": 5,
  "date": "2025-05-24",
  "data": [
    {
      "play_id": "252064aa-13a1-3abe-9a90-f25156a519e8",
      "game_pk": 777796,
      "player_name": "Herrin, Tim",
      "pitch_type": "CU",
      "pitch_name": "Curveball",
      "release_speed": 79.6,
      "release_spin_rate": 2408,
      "plate_x": -0.08,
      "plate_z": 1.37,
      "sz_top": 3.53,
      "sz_bot": 1.65,
      "bat_speed": 34.4,
      "swing_path_tilt": 46.1,
      "attack_angle": 18.0,
      "intercept_ball_minus_batter_pos_y_inches": 30.1,
      "description": "swinging_strike",
      "events": "strikeout",
      "inning": 9,
      "balls": 2,
      "strikes": 2,
      "at_bat_number": 72,
      "pitch_number": 5,
      "home_team": "DET",
      "away_team": "CLE",
      "batter": 669234,
      "pitcher": 682120,
      "video_url": "https://baseballsavant.mlb.com/sporty-videos?playId=252064aa-13a1-3abe-9a90-f25156a519e8",
      "download_url": "https://sporty-clips.mlb.com/...encrypted.mp4",
      "sword_score": 100.0
    }
  ]
}