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
POST /api/math-solver/solve
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
The math problem to solve
Whether to include detailed step-by-step explanation
Response
Whether the request was successful
Solution details Solution ID (null for guest users)
Problem classification: algebra, calculus, geometry, trigonometry, statistics, or other
Difficulty: easy, medium, or hard
Step-by-step solution Mathematical equation for this step
The final answer to the problem
Verification that the answer is correct
Get Solution History
GET /api/math-solver/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
Whether the request was successful
Array of past solutions (up to 50 most recent) The problem that was solved
Generate Practice Problems
POST /api/math-solver/solution/:id/practice
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 of the original solution to base practice problems on
Request Body
Number of practice problems to generate (1-10)
Response
Whether the request was successful
Generated practice problems with solutions The practice problem text
Solution steps (same structure as solve endpoint)
Error Responses
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.