Update Driver
curl --request PUT \
--url https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"account": {
"first_name": "John",
"last_name": "Smith",
"email": "jsmith@example.com"
},
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"is_main": true,
"mc_number": 1,
"brith_date": "1985-06-15",
"telegram_number": null,
"driver_license": "D1234567",
"driver_license_issue_date": "2020-03-10",
"driver_license_state": "CA",
"driver_license_expiration": "2028-03-10",
"driver_license_class": "A",
"dispatch_status": 1
}
'import requests
url = "https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/"
payload = {
"account": {
"first_name": "John",
"last_name": "Smith",
"email": "jsmith@example.com"
},
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"is_main": True,
"mc_number": 1,
"brith_date": "1985-06-15",
"telegram_number": None,
"driver_license": "D1234567",
"driver_license_issue_date": "2020-03-10",
"driver_license_state": "CA",
"driver_license_expiration": "2028-03-10",
"driver_license_class": "A",
"dispatch_status": 1
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account: {first_name: 'John', last_name: 'Smith', email: 'jsmith@example.com'},
contact_number: '+1-555-0123',
driver_type: 'Company Driver',
new_employee_status: 'Active',
status: 'Available',
is_main: true,
mc_number: 1,
brith_date: '1985-06-15',
telegram_number: null,
driver_license: 'D1234567',
driver_license_issue_date: '2020-03-10',
driver_license_state: 'CA',
driver_license_expiration: '2028-03-10',
driver_license_class: 'A',
dispatch_status: 1
})
};
fetch('https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account' => [
'first_name' => 'John',
'last_name' => 'Smith',
'email' => 'jsmith@example.com'
],
'contact_number' => '+1-555-0123',
'driver_type' => 'Company Driver',
'new_employee_status' => 'Active',
'status' => 'Available',
'is_main' => true,
'mc_number' => 1,
'brith_date' => '1985-06-15',
'telegram_number' => null,
'driver_license' => 'D1234567',
'driver_license_issue_date' => '2020-03-10',
'driver_license_state' => 'CA',
'driver_license_expiration' => '2028-03-10',
'driver_license_class' => 'A',
'dispatch_status' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/"
payload := strings.NewReader("{\n \"account\": {\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"email\": \"jsmith@example.com\"\n },\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"brith_date\": \"1985-06-15\",\n \"telegram_number\": null,\n \"driver_license\": \"D1234567\",\n \"driver_license_issue_date\": \"2020-03-10\",\n \"driver_license_state\": \"CA\",\n \"driver_license_expiration\": \"2028-03-10\",\n \"driver_license_class\": \"A\",\n \"dispatch_status\": 1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account\": {\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"email\": \"jsmith@example.com\"\n },\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"brith_date\": \"1985-06-15\",\n \"telegram_number\": null,\n \"driver_license\": \"D1234567\",\n \"driver_license_issue_date\": \"2020-03-10\",\n \"driver_license_state\": \"CA\",\n \"driver_license_expiration\": \"2028-03-10\",\n \"driver_license_class\": \"A\",\n \"dispatch_status\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account\": {\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"email\": \"jsmith@example.com\"\n },\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"brith_date\": \"1985-06-15\",\n \"telegram_number\": null,\n \"driver_license\": \"D1234567\",\n \"driver_license_issue_date\": \"2020-03-10\",\n \"driver_license_state\": \"CA\",\n \"driver_license_expiration\": \"2028-03-10\",\n \"driver_license_class\": \"A\",\n \"dispatch_status\": 1\n}"
response = http.request(request)
puts response.read_body{
"detail": "success"
}{
"error": 123,
"message": "<string>"
}Endpoints
Update Driver
Updates an existing driver’s account info, contact details, driver type, employee status, license details, and dispatch status.
PUT
/
drivers
/
update
/
{pk}
/
Update Driver
curl --request PUT \
--url https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"account": {
"first_name": "John",
"last_name": "Smith",
"email": "jsmith@example.com"
},
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"is_main": true,
"mc_number": 1,
"brith_date": "1985-06-15",
"telegram_number": null,
"driver_license": "D1234567",
"driver_license_issue_date": "2020-03-10",
"driver_license_state": "CA",
"driver_license_expiration": "2028-03-10",
"driver_license_class": "A",
"dispatch_status": 1
}
'import requests
url = "https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/"
payload = {
"account": {
"first_name": "John",
"last_name": "Smith",
"email": "jsmith@example.com"
},
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"is_main": True,
"mc_number": 1,
"brith_date": "1985-06-15",
"telegram_number": None,
"driver_license": "D1234567",
"driver_license_issue_date": "2020-03-10",
"driver_license_state": "CA",
"driver_license_expiration": "2028-03-10",
"driver_license_class": "A",
"dispatch_status": 1
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account: {first_name: 'John', last_name: 'Smith', email: 'jsmith@example.com'},
contact_number: '+1-555-0123',
driver_type: 'Company Driver',
new_employee_status: 'Active',
status: 'Available',
is_main: true,
mc_number: 1,
brith_date: '1985-06-15',
telegram_number: null,
driver_license: 'D1234567',
driver_license_issue_date: '2020-03-10',
driver_license_state: 'CA',
driver_license_expiration: '2028-03-10',
driver_license_class: 'A',
dispatch_status: 1
})
};
fetch('https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account' => [
'first_name' => 'John',
'last_name' => 'Smith',
'email' => 'jsmith@example.com'
],
'contact_number' => '+1-555-0123',
'driver_type' => 'Company Driver',
'new_employee_status' => 'Active',
'status' => 'Available',
'is_main' => true,
'mc_number' => 1,
'brith_date' => '1985-06-15',
'telegram_number' => null,
'driver_license' => 'D1234567',
'driver_license_issue_date' => '2020-03-10',
'driver_license_state' => 'CA',
'driver_license_expiration' => '2028-03-10',
'driver_license_class' => 'A',
'dispatch_status' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/"
payload := strings.NewReader("{\n \"account\": {\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"email\": \"jsmith@example.com\"\n },\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"brith_date\": \"1985-06-15\",\n \"telegram_number\": null,\n \"driver_license\": \"D1234567\",\n \"driver_license_issue_date\": \"2020-03-10\",\n \"driver_license_state\": \"CA\",\n \"driver_license_expiration\": \"2028-03-10\",\n \"driver_license_class\": \"A\",\n \"dispatch_status\": 1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account\": {\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"email\": \"jsmith@example.com\"\n },\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"brith_date\": \"1985-06-15\",\n \"telegram_number\": null,\n \"driver_license\": \"D1234567\",\n \"driver_license_issue_date\": \"2020-03-10\",\n \"driver_license_state\": \"CA\",\n \"driver_license_expiration\": \"2028-03-10\",\n \"driver_license_class\": \"A\",\n \"dispatch_status\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{company}.datatruck.io/api/v1/openapi/drivers/update/{pk}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account\": {\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"email\": \"jsmith@example.com\"\n },\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"brith_date\": \"1985-06-15\",\n \"telegram_number\": null,\n \"driver_license\": \"D1234567\",\n \"driver_license_issue_date\": \"2020-03-10\",\n \"driver_license_state\": \"CA\",\n \"driver_license_expiration\": \"2028-03-10\",\n \"driver_license_class\": \"A\",\n \"dispatch_status\": 1\n}"
response = http.request(request)
puts response.read_body{
"detail": "success"
}{
"error": 123,
"message": "<string>"
}API Url
https://{company_name}.datatruck.io/api/v1/openapi/drivers/update/{pk}/
{company_name} with your company name and {pk} with the driver ID.
Sample Request
curl --request PUT \
--url https://{company_name}.datatruck.io/api/v1/openapi/drivers/update/102/ \
--header "Authorization: Token YOUR_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"account": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@companyx.com"
},
"contact_number": "+1 234-567-8901",
"driver_type": "company_driver",
"new_employee_status": "employed",
"status": "active",
"is_main": true,
"mc_number": 12345,
"brith_date": "1990-05-15",
"telegram_number": "@johndoe",
"driver_license": "D1234567",
"driver_license_issue_date": "2015-06-01",
"driver_license_state": "TX",
"driver_license_expiration": "2025-06-01",
"driver_license_class": "A",
"dispatch_status": 1
}'
| Field | Type | Required | Description |
|---|---|---|---|
account | object | yes | Nested driver account info |
account.first_name | string | yes | First name of the driver |
account.last_name | string | yes | Last name of the driver |
account.email | string | yes | Email address |
contact_number | string | yes | Contact number |
driver_type | string | yes | Type of driver (company_driver, owner_operator, etc.) |
new_employee_status | string | yes | New employee status |
status | string | yes | Current status of the driver |
is_main | boolean | yes | Is main driver |
mc_number | integer | yes | MC number |
brith_date | string (date) | yes | Date of birth |
telegram_number | string | no | Telegram username / handle |
driver_license | string | no | Driver license number |
driver_license_issue_date | string (date) | no | License issue date |
driver_license_state | string | no | License issuing state |
driver_license_expiration | string (date) | no | License expiration date |
driver_license_class | string | no | License class |
dispatch_status | integer | no | Dispatch status code |
Sample Response
[
{
"id": 102,
"account": {
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"email": "john.doe@companyx.com"
},
"contact_number": "+1 234-567-8901",
"driver_type": "company_driver",
"employee_status": "employed",
"status": "active",
"is_main": true,
"mc_number": 12345,
"brith_date": "1990-05-15",
"telegram_number": "@johndoe",
"driver_license": "D1234567",
"driver_license_issue_date": "2015-06-01",
"driver_license_state": "TX",
"driver_license_expiration": "2025-06-01",
"driver_license_class": "A",
"dispatch_status": 1
}
]
Authorizations
Path Parameters
Unique identifier of the driver to update.
Body
application/json
Show child attributes
Show child attributes
Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Response
Driver successfully updated.
Example:
"success"
⌘I