Creates a new driver in the system. This endpoint requires admin authentication via JWT token.
Endpoint
Authentication
This endpoint requires admin privileges. Include a valid JWT token in the request body with userType: "admin".
Request body
JWT authentication token with admin privileges
Unique identifier for the driver (e.g., “max_verstappen”)
Three-letter driver code (e.g., “VER”)
Driver’s permanent racing number
Driver’s date of birth in ISO 8601 format
URL to driver’s profile or additional information
URL to the driver’s image
ID of the team the driver belongs to
Response
JSON string containing the created driver object or error message
Error codes
Driver successfully created
Bad Request - Missing or invalid token
Unauthorized - Invalid token or token has expired
Forbidden - User does not have admin privileges
Example request
curl -X POST https://api.example.com/api/drivers/create \
-H "Content-Type: application/json" \
-d '{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"driverId": "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.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.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\"}"
}