Upsert Driver Group
curl --request PUT \
--url https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalIdentifier": "<string>",
"displayName": "<string>",
"isActive": true,
"unassignedDriverTimeoutMinutes": 123,
"driverIds": [
"<string>"
]
}
'import requests
url = "https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert"
payload = {
"externalIdentifier": "<string>",
"displayName": "<string>",
"isActive": True,
"unassignedDriverTimeoutMinutes": 123,
"driverIds": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
externalIdentifier: '<string>',
displayName: '<string>',
isActive: true,
unassignedDriverTimeoutMinutes: 123,
driverIds: ['<string>']
})
};
fetch('https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert', 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://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert",
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([
'externalIdentifier' => '<string>',
'displayName' => '<string>',
'isActive' => true,
'unassignedDriverTimeoutMinutes' => 123,
'driverIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert"
payload := strings.NewReader("{\n \"externalIdentifier\": \"<string>\",\n \"displayName\": \"<string>\",\n \"isActive\": true,\n \"unassignedDriverTimeoutMinutes\": 123,\n \"driverIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalIdentifier\": \"<string>\",\n \"displayName\": \"<string>\",\n \"isActive\": true,\n \"unassignedDriverTimeoutMinutes\": 123,\n \"driverIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalIdentifier\": \"<string>\",\n \"displayName\": \"<string>\",\n \"isActive\": true,\n \"unassignedDriverTimeoutMinutes\": 123,\n \"driverIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"firstVersionContractId": "<string>",
"displayName": "<string>",
"isActive": true,
"providerId": "<string>",
"drivers": [
{
"id": "<string>",
"enabled": true,
"isShiftActive": true,
"externalIdentifier": "<string>",
"firstName": "<string>",
"lastName": "<string>"
}
],
"created": true,
"externalIdentifier": "<string>",
"unassignedDriverTimeoutMinutes": 123
}[
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"response_status": "<string>",
"RequestID": "<string>"
}
]Upsert Driver Group
Create or update a driver group, keyed on your own identifier.
PUT
/
v1
/
fleet
/
driver-groups
/
upsert
Upsert Driver Group
curl --request PUT \
--url https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalIdentifier": "<string>",
"displayName": "<string>",
"isActive": true,
"unassignedDriverTimeoutMinutes": 123,
"driverIds": [
"<string>"
]
}
'import requests
url = "https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert"
payload = {
"externalIdentifier": "<string>",
"displayName": "<string>",
"isActive": True,
"unassignedDriverTimeoutMinutes": 123,
"driverIds": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
externalIdentifier: '<string>',
displayName: '<string>',
isActive: true,
unassignedDriverTimeoutMinutes: 123,
driverIds: ['<string>']
})
};
fetch('https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert', 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://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert",
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([
'externalIdentifier' => '<string>',
'displayName' => '<string>',
'isActive' => true,
'unassignedDriverTimeoutMinutes' => 123,
'driverIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert"
payload := strings.NewReader("{\n \"externalIdentifier\": \"<string>\",\n \"displayName\": \"<string>\",\n \"isActive\": true,\n \"unassignedDriverTimeoutMinutes\": 123,\n \"driverIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalIdentifier\": \"<string>\",\n \"displayName\": \"<string>\",\n \"isActive\": true,\n \"unassignedDriverTimeoutMinutes\": 123,\n \"driverIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.usenash.com/v1/fleet/driver-groups/upsert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalIdentifier\": \"<string>\",\n \"displayName\": \"<string>\",\n \"isActive\": true,\n \"unassignedDriverTimeoutMinutes\": 123,\n \"driverIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"firstVersionContractId": "<string>",
"displayName": "<string>",
"isActive": true,
"providerId": "<string>",
"drivers": [
{
"id": "<string>",
"enabled": true,
"isShiftActive": true,
"externalIdentifier": "<string>",
"firstName": "<string>",
"lastName": "<string>"
}
],
"created": true,
"externalIdentifier": "<string>",
"unassignedDriverTimeoutMinutes": 123
}[
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"response_status": "<string>",
"RequestID": "<string>"
}
]Your
externalIdentifier is the upsert key. Send a new value to create a group, which needs a displayName; send the same value again to update that group. created in the response says which happened. Fields you leave out keep their current values.
driverIds is the group’s full roster. Sending it replaces the list, [] removes everyone, and leaving it out changes nothing. To add or remove one driver without resending the roster, use addFirstVersionContractIds and removeFirstVersionContractIds on Upsert Driver.
There is no delete call. To disable a group, upsert it with isActive: false. A disabled group can lose members but can’t gain new ones.Authorizations
Body
application/json
PUT /v1/fleet/driver-groups/upsert request body.
Keyed on external_identifier within the calling org's own internal fleet. Omitted fields
are left unchanged; an explicit null unassigned_driver_timeout_minutes clears it.
Response
OK
Was this page helpful?