Endpoint
Despite being a POST request, this endpoint performs an update operation. Itβs configured this way in the Nitro.js handler.
Update an existing race record in the F1 PitLane Predict database. This endpoint requires admin authentication via JWT token.
Authentication
This endpoint requires admin privileges. Include a valid JWT token in the request body with userType set to admin.
Request body
JWT authentication token with admin privileges
Current race ID to identify which race to update
New race ID (can be the same as oldRaceId if not changing)
Season year (4-character string)
Round number in the season
Unique identifier for the circuit
City or locality where the race takes place
Country where the race takes place
Race date (ISO 8601 format)
URL with additional race information
Example request
curl -X POST https://api.f1pitlanepredict.com/api/races/update \
-H "Content-Type: application/json" \
-d '{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"oldRaceId": 1,
"newRaceId": 1,
"season": "2024",
"round": 1,
"raceName": "Bahrain Grand Prix",
"circuitId": "bahrain",
"circuitName": "Bahrain International Circuit",
"locality": "Sakhir",
"country": "Bahrain",
"date": "2024-03-02T00:00:00.000Z",
"time": "16:00:00",
"url": "https://en.wikipedia.org/wiki/2024_Bahrain_Grand_Prix"
}'
Response
JSON stringified response containing the updated race object or error messageShow Success response properties
Unique identifier for the race
Season year (4-character string)
Round number in the season
Unique identifier for the circuit
City or locality where the race takes place
Country where the race takes place
Race date (ISO 8601 format)
URL with additional race information
Example response
{
"status": 200,
"body": "{
\"raceId\": 1,
\"season\": \"2024\",
\"round\": 1,
\"raceName\": \"Bahrain Grand Prix\",
\"circuitId\": \"bahrain\",
\"circuitName\": \"Bahrain International Circuit\",
\"locality\": \"Sakhir\",
\"country\": \"Bahrain\",
\"date\": \"2024-03-02T00:00:00.000Z\",
\"time\": \"16:00:00\",
\"url\": \"https://en.wikipedia.org/wiki/2024_Bahrain_Grand_Prix\"
}"
}
Error responses
Missing or invalid token in request body{
"status": 400,
"body": "{\"error\": \"Bad Request\"}"
}
JWT verification failed or token has expired{
"status": 401,
"body": "{\"error\": \"Unauthorized\"}"
}
or{
"status": 401,
"body": "{\"error\": \"Token has expired\"}"
}
User does not have admin privileges{
"status": 403,
"body": "{\"error\": \"Forbidden\"}"
}