Skip to main content

Overview

The Math Solver API uses Claude AI to solve mathematical problems with detailed step-by-step explanations. It supports various problem types including algebra, calculus, geometry, trigonometry, and statistics.

Endpoints

Solve Math Problem

curl -X POST https://api.inspir.uk/api/math-solver/solve \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "problemText": "Solve for x: 2x + 5 = 15",
    "showSteps": true
  }'
Solve a math problem with AI-powered step-by-step solution. Authentication: Optional (guests get solution without saving)

Request Body

problemText
string
required
The math problem to solve
showSteps
boolean
default:true
Whether to include detailed step-by-step explanation

Response

success
boolean
Whether the request was successful
solution
object
Solution details

Get Solution History

curl -X GET https://api.inspir.uk/api/math-solver/history \
  -H "Authorization: Bearer YOUR_TOKEN"
Get user’s math solution history (authenticated users only). Authentication: Required

Response

success
boolean
Whether the request was successful
solutions
array
Array of past solutions (up to 50 most recent)

Generate Practice Problems

curl -X POST https://api.inspir.uk/api/math-solver/solution/123/practice \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "count": 3
  }'
Generate similar practice problems based on a previously solved problem. Authentication: Required

Path Parameters

id
string
required
ID of the original solution to base practice problems on

Request Body

count
number
default:3
Number of practice problems to generate (1-10)

Response

success
boolean
Whether the request was successful
problems
array
Generated practice problems with solutions

Error Responses

error
string
Error message
Common error codes:
  • 400 - Missing or invalid problem text
  • 401 - Authentication required
  • 404 - Solution not found
  • 500 - AI service error or parsing failure

Example Usage

// Solve a math problem
const response = await fetch('https://api.inspir.uk/api/math-solver/solve', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token}`
  },
  body: JSON.stringify({
    problemText: 'Find the derivative of f(x) = 3x^2 + 2x - 1',
    showSteps: true
  })
});

const data = await response.json();
console.log(data.solution.finalAnswer); // "f'(x) = 6x + 2"
console.log(data.solution.steps); // Step-by-step solution

Supported Problem Types

  • Algebra - Equations, systems, polynomials, factoring
  • Calculus - Derivatives, integrals, limits
  • Geometry - Area, perimeter, volume, angles
  • Trigonometry - Identities, equations, graphing
  • Statistics - Mean, median, standard deviation, probability
  • Other - Number theory, combinatorics, logic
The Math Solver uses Claude Sonnet 4.5 for accurate mathematical reasoning and can handle problems ranging from basic arithmetic to advanced calculus.

Build docs developers (and LLMs) love