Skip to main content
GET
/
api
/
calculations
/
history
Calculation History
curl --request GET \
  --url https://api.example.com/api/calculations/history
{
  "success": true,
  "data": [
    {
      "query_id": 123,
      "query_type": "<string>",
      "query_date": "<string>",
      "status": "<string>",
      "tractor_name": "<string>",
      "terrain_name": "<string>"
    }
  ],
  "pagination": {
    "currentPage": 123,
    "totalPages": 123,
    "totalItems": 123,
    "itemsPerPage": 123
  }
}

Overview

Retrieves the calculation history for the authenticated user. Returns both power loss and minimum power calculations with pagination support.
This endpoint only returns calculations performed by the authenticated user.

Authentication

Required: Bearer token in Authorization header
Authorization: Bearer <your_jwt_token>

Query Parameters

page
integer
default:"1"
Page number for pagination
limit
integer
default:"10"
Number of results per page (max 100)
type
string
Filter by calculation type: power_loss or minimum_power

Response

success
boolean
Indicates if the request was successful
data
array
Array of calculation records
pagination
object
Pagination metadata

Examples

curl -X GET "http://localhost:4000/api/calculations/history?page=1&limit=10" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json"

Response Example (200 OK)

{
  "success": true,
  "data": [
    {
      "query_id": 42,
      "query_type": "power_loss",
      "query_date": "2026-03-10T15:30:00.000Z",
      "status": "completed",
      "tractor_name": "John Deere 6130M",
      "terrain_name": "Highland Farm North"
    },
    {
      "query_id": 41,
      "query_type": "minimum_power",
      "query_date": "2026-03-09T10:15:00.000Z",
      "status": "completed",
      "tractor_name": null,
      "terrain_name": "Valley Field 3"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalItems": 47,
    "itemsPerPage": 10
  }
}

Error Responses

Status CodeDescription
401Missing or invalid authentication token
500Internal server error

Power Loss Calculation

Calculate power losses

Minimum Power Calculation

Calculate minimum power requirements

Source Code Reference

  • Route: src/routes/calculation.routes.js:256
  • Controller: src/controllers/calculationController.js:getCalculationHistory

Build docs developers (and LLMs) love