curl --request POST \
--url https://{company}.datatruck.io/api/v1/openapi/drivers/create/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "John",
"last_name": "Smith",
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"telegram_number": "blank",
"is_main": true,
"mc_number": 1,
"birth_date": "1985-06-15",
"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,
"email": "jsmith@example.com"
}
'import requests
url = "https://{company}.datatruck.io/api/v1/openapi/drivers/create/"
payload = {
"first_name": "John",
"last_name": "Smith",
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"telegram_number": "blank",
"is_main": True,
"mc_number": 1,
"birth_date": "1985-06-15",
"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,
"email": "jsmith@example.com"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: 'John',
last_name: 'Smith',
contact_number: '+1-555-0123',
driver_type: 'Company Driver',
new_employee_status: 'Active',
status: 'Available',
telegram_number: 'blank',
is_main: true,
mc_number: 1,
birth_date: '1985-06-15',
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,
email: 'jsmith@example.com'
})
};
fetch('https://{company}.datatruck.io/api/v1/openapi/drivers/create/', 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/create/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'first_name' => 'John',
'last_name' => 'Smith',
'contact_number' => '+1-555-0123',
'driver_type' => 'Company Driver',
'new_employee_status' => 'Active',
'status' => 'Available',
'telegram_number' => 'blank',
'is_main' => true,
'mc_number' => 1,
'birth_date' => '1985-06-15',
'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,
'email' => 'jsmith@example.com'
]),
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/create/"
payload := strings.NewReader("{\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"telegram_number\": \"blank\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"birth_date\": \"1985-06-15\",\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 \"email\": \"jsmith@example.com\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{company}.datatruck.io/api/v1/openapi/drivers/create/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"telegram_number\": \"blank\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"birth_date\": \"1985-06-15\",\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 \"email\": \"jsmith@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{company}.datatruck.io/api/v1/openapi/drivers/create/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"telegram_number\": \"blank\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"birth_date\": \"1985-06-15\",\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 \"email\": \"jsmith@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"detail": "success"
}{
"error": 123,
"message": "<string>"
}Create Driver
Creates a new driver with the provided details, including name, contact information, driver type, employee status, and optional license and dispatch information.
curl --request POST \
--url https://{company}.datatruck.io/api/v1/openapi/drivers/create/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "John",
"last_name": "Smith",
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"telegram_number": "blank",
"is_main": true,
"mc_number": 1,
"birth_date": "1985-06-15",
"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,
"email": "jsmith@example.com"
}
'import requests
url = "https://{company}.datatruck.io/api/v1/openapi/drivers/create/"
payload = {
"first_name": "John",
"last_name": "Smith",
"contact_number": "+1-555-0123",
"driver_type": "Company Driver",
"new_employee_status": "Active",
"status": "Available",
"telegram_number": "blank",
"is_main": True,
"mc_number": 1,
"birth_date": "1985-06-15",
"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,
"email": "jsmith@example.com"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: 'John',
last_name: 'Smith',
contact_number: '+1-555-0123',
driver_type: 'Company Driver',
new_employee_status: 'Active',
status: 'Available',
telegram_number: 'blank',
is_main: true,
mc_number: 1,
birth_date: '1985-06-15',
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,
email: 'jsmith@example.com'
})
};
fetch('https://{company}.datatruck.io/api/v1/openapi/drivers/create/', 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/create/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'first_name' => 'John',
'last_name' => 'Smith',
'contact_number' => '+1-555-0123',
'driver_type' => 'Company Driver',
'new_employee_status' => 'Active',
'status' => 'Available',
'telegram_number' => 'blank',
'is_main' => true,
'mc_number' => 1,
'birth_date' => '1985-06-15',
'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,
'email' => 'jsmith@example.com'
]),
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/create/"
payload := strings.NewReader("{\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"telegram_number\": \"blank\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"birth_date\": \"1985-06-15\",\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 \"email\": \"jsmith@example.com\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{company}.datatruck.io/api/v1/openapi/drivers/create/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"telegram_number\": \"blank\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"birth_date\": \"1985-06-15\",\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 \"email\": \"jsmith@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{company}.datatruck.io/api/v1/openapi/drivers/create/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"John\",\n \"last_name\": \"Smith\",\n \"contact_number\": \"+1-555-0123\",\n \"driver_type\": \"Company Driver\",\n \"new_employee_status\": \"Active\",\n \"status\": \"Available\",\n \"telegram_number\": \"blank\",\n \"is_main\": true,\n \"mc_number\": 1,\n \"birth_date\": \"1985-06-15\",\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 \"email\": \"jsmith@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"detail": "success"
}{
"error": 123,
"message": "<string>"
}Authorizations
Body
First name of the driver.
"John"
Last name of the driver.
"Smith"
Contact number of the driver.
"+1-555-0123"
Type of driver.
"Company Driver"
Employment status of the driver.
"Active"
Motor carrier number ID (must be an existing MC number ID).
1
Current status of the driver, if applicable.
"Available"
Telegram contact number, if provided.
"blank"
Indicates if the driver is the main driver.
true
Driver's birth date in YYYY-MM-DD format, if provided.
"1985-06-15"
Driver's license number, if provided.
"D1234567"
Issue date of the driver's license in YYYY-MM-DD format, if provided.
"2020-03-10"
State issuing the driver's license, if provided.
"CA"
Expiration date of the driver's license in YYYY-MM-DD format, if provided.
"2028-03-10"
Class of the driver's license, if provided.
"A"
Dispatch status ID (integer), if applicable.
1
Email address of the driver, if provided.
"jsmith@example.com"
Response
Driver successfully created.
"success"