Skip to main content
Updates an existing driver’s information in the system. This endpoint requires admin authentication via JWT token and allows changing the driver ID along with other fields.

Endpoint

POST /api/drivers/update
Despite being a POST request, this endpoint performs an update operation. It’s configured this way in the Nitro.js handler.

Authentication

This endpoint requires admin privileges. Include a valid JWT token in the request body with userType: "admin".

Request body

token
string
required
JWT authentication token with admin privileges
oldDriverId
string
required
Current driver ID to identify which driver to update
newDriverId
string
required
New driver ID (can be the same as oldDriverId if not changing)
code
string
Three-letter driver code (e.g., “VER”)
permanentNumber
integer
Driver’s permanent racing number
givenName
string
Driver’s first name
familyName
string
Driver’s last name
dateOfBirth
string
Driver’s date of birth in ISO 8601 format
nationality
string
Driver’s nationality
url
string
URL to driver’s profile or additional information
driverImage
string
URL to the driver’s image
teamId
string
ID of the team the driver belongs to

Response

status
integer
required
HTTP status code
body
string
required
JSON string containing the updated driver object or error message

Error codes

200
Driver successfully updated
400
Bad Request - Missing or invalid token
401
Unauthorized - Invalid token or token has expired
403
Forbidden - User does not have admin privileges

Example request

curl -X POST https://api.example.com/api/drivers/update \
  -H "Content-Type: application/json" \
  -d '{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "oldDriverId": "max_verstappen",
    "newDriverId": "max_verstappen",
    "code": "VER",
    "permanentNumber": 1,
    "givenName": "Max",
    "familyName": "Verstappen",
    "dateOfBirth": "1997-09-30",
    "nationality": "Dutch",
    "url": "http://en.wikipedia.org/wiki/Max_Verstappen",
    "driverImage": "https://example.com/images/verstappen-updated.jpg",
    "teamId": "red_bull"
  }'

Example response

Success (200)

{
  "status": 200,
  "body": "{\"driverId\":\"max_verstappen\",\"code\":\"VER\",\"permanentNumber\":1,\"givenName\":\"Max\",\"familyName\":\"Verstappen\",\"dateOfBirth\":\"1997-09-30T00:00:00.000Z\",\"nationality\":\"Dutch\",\"url\":\"http://en.wikipedia.org/wiki/Max_Verstappen\",\"driverImage\":\"https://example.com/images/verstappen-updated.jpg\",\"teamId\":\"red_bull\"}"
}

Error - Forbidden (403)

{
  "status": 403,
  "body": "{\"error\":\"Forbidden\"}"
}

Error - Unauthorized (401)

{
  "status": 401,
  "body": "{\"error\":\"Token has expired\"}"
}

Error - Bad Request (400)

{
  "status": 400,
  "body": "{\"error\":\"Bad Request\"}"
}

Build docs developers (and LLMs) love