Skip to main content

Endpoint

POST /api/races/delete
Despite being a POST request, this endpoint performs a delete operation. It’s configured this way in the Nitro.js handler.
Delete a race record from 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

token
string
required
JWT authentication token with admin privileges
raceId
integer
required
Unique identifier of the race to delete

Example request

curl -X POST https://api.f1pitlanepredict.com/api/races/delete \
  -H "Content-Type: application/json" \
  -d '{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "raceId": 1
  }'

Response

status
integer
HTTP status code
body
string
JSON stringified response containing the deleted race object or error message

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\": \"15:00:00\",
    \"url\": \"https://en.wikipedia.org/wiki/2024_Bahrain_Grand_Prix\"
  }"
}

Error responses

400 Bad Request
Missing or invalid token in request body
{
  "status": 400,
  "body": "{\"error\": \"Bad Request\"}"
}
401 Unauthorized
JWT verification failed or token has expired
{
  "status": 401,
  "body": "{\"error\": \"Unauthorized\"}"
}
or
{
  "status": 401,
  "body": "{\"error\": \"Token has expired\"}"
}
403 Forbidden
User does not have admin privileges
{
  "status": 403,
  "body": "{\"error\": \"Forbidden\"}"
}

Build docs developers (and LLMs) love