API referenceGuide · 5 minutes

Your first request

From nothing to your first response in five minutes: get a key, search, and score a fit.

  1. 1

    Get an API key

    Sign in and create a free sandbox account. Get an API key, then keep it in an environment variable called FITMYSWING_API_KEY. Beta keys start fms_test_. Send it in an x-api-key header. You can manage keys in the developer console.

    The examples below use plain fetch, which needs Node 18 or newer. A typed SDK is on the way.

  2. 2

    Make your first request

    Search for drivers. You get normalized product data, confidence scores and pagination details back.

    typescript
    const res = await fetch(
      "https://www.fitmyswing.com/api/v1/products/search?category=driver&brand=Callaway&limit=5",
      { headers: { "x-api-key": process.env.FITMYSWING_API_KEY! } },
    )
    const { data } = await res.json()
    
    console.log(`Found ${data.pagination.total} drivers`)
    data.products.forEach((p) =>
      console.log(`  ${p.displayName}: $${p.price.amountUsd} (confidence: ${p.confidenceScore})`))

    Every product has a canonical ID like driver:callaway:paradym-ai-smoke-max:2024. Use it for fit scores and comparisons.

  3. 3

    Score the fit

    Send a golfer profile and product IDs. You get a score out of 100 for each product, the breakdown by factor and any warnings.

    typescript
    const res = await fetch("https://www.fitmyswing.com/api/v1/fit-score", {
      method: "POST",
      headers: { "x-api-key": process.env.FITMYSWING_API_KEY!, "Content-Type": "application/json" },
      body: JSON.stringify({
        golferProfile: { swingSpeed: 95, handicap: 12, miss: "Slice", trajectory: "Mid", budget: "$300–600" },
        productIds: ["driver:callaway:paradym-ai-smoke-max:2024", "driver:taylormade:qi10-max:2024"],
      }),
    })
    const { data } = await res.json()
    
    data.scores.forEach((s) => {
      console.log(`${s.product.displayName}: ${s.totalScore}/100`)
      console.log(`  Reasons: ${s.reasons.join(", ")}`)
      if (s.warnings.length) console.log(`  Warnings: ${s.warnings.join(", ")}`)
    })

    Fit credits. Each call to /fit-score or /recommendations uses one fit credit. The sandbox includes 100 a month.