Jobs
Create a job
POST /dn/jobs creates a single delivery or collection job. Only do_number and date are always required. Returns 201 Created.
POST
/
dn
/
jobs
Create a job
curl --request POST \
--url https://app.detrack.com/api/v2/dn/jobs \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"data": {
"do_number": "DO-10001",
"date": "2026-09-15",
"type": "Delivery",
"address": "Singapore 470140",
"address_1": "<string>",
"address_2": "<string>",
"address_3": "<string>",
"deliver_to_collect_from": "James Li",
"phone_number": "65432178",
"fax_number": "65432179",
"notify_email": "test@example.com",
"tracking_number": "T0",
"order_number": "ORN12345678",
"job_sequence": 1,
"assign_to": "Driver 1",
"items": [
{
"sku": "12345678",
"description": "iPad",
"quantity": 10,
"unit_of_measure": "pcs",
"purchase_order_number": "<string>",
"batch_number": "<string>",
"expiry_date": "2023-12-25",
"comments": "<string>",
"serial_numbers": [
"<string>"
],
"weight": 123,
"unit_price": 123,
"fixed_price": 123,
"minimum_quantity": 123,
"position": 123,
"checked": true,
"actual_quantity": 123,
"inbound_quantity": 123,
"follow_up_quantity": 123,
"follow_up_reason": "<string>",
"rework_quantity": 123,
"rework_reason": "<string>",
"reject_quantity": 123,
"reject_reason": "<string>",
"unload_time_estimate": "<string>",
"unload_time_actual": "<string>"
}
]
}
}
'import requests
url = "https://app.detrack.com/api/v2/dn/jobs"
payload = { "data": {
"do_number": "DO-10001",
"date": "2026-09-15",
"type": "Delivery",
"address": "Singapore 470140",
"address_1": "<string>",
"address_2": "<string>",
"address_3": "<string>",
"deliver_to_collect_from": "James Li",
"phone_number": "65432178",
"fax_number": "65432179",
"notify_email": "test@example.com",
"tracking_number": "T0",
"order_number": "ORN12345678",
"job_sequence": 1,
"assign_to": "Driver 1",
"items": [
{
"sku": "12345678",
"description": "iPad",
"quantity": 10,
"unit_of_measure": "pcs",
"purchase_order_number": "<string>",
"batch_number": "<string>",
"expiry_date": "2023-12-25",
"comments": "<string>",
"serial_numbers": ["<string>"],
"weight": 123,
"unit_price": 123,
"fixed_price": 123,
"minimum_quantity": 123,
"position": 123,
"checked": True,
"actual_quantity": 123,
"inbound_quantity": 123,
"follow_up_quantity": 123,
"follow_up_reason": "<string>",
"rework_quantity": 123,
"rework_reason": "<string>",
"reject_quantity": 123,
"reject_reason": "<string>",
"unload_time_estimate": "<string>",
"unload_time_actual": "<string>"
}
]
} }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
do_number: 'DO-10001',
date: '2026-09-15',
type: 'Delivery',
address: 'Singapore 470140',
address_1: '<string>',
address_2: '<string>',
address_3: '<string>',
deliver_to_collect_from: 'James Li',
phone_number: '65432178',
fax_number: '65432179',
notify_email: 'test@example.com',
tracking_number: 'T0',
order_number: 'ORN12345678',
job_sequence: 1,
assign_to: 'Driver 1',
items: [
{
sku: '12345678',
description: 'iPad',
quantity: 10,
unit_of_measure: 'pcs',
purchase_order_number: '<string>',
batch_number: '<string>',
expiry_date: '2023-12-25',
comments: '<string>',
serial_numbers: ['<string>'],
weight: 123,
unit_price: 123,
fixed_price: 123,
minimum_quantity: 123,
position: 123,
checked: true,
actual_quantity: 123,
inbound_quantity: 123,
follow_up_quantity: 123,
follow_up_reason: '<string>',
rework_quantity: 123,
rework_reason: '<string>',
reject_quantity: 123,
reject_reason: '<string>',
unload_time_estimate: '<string>',
unload_time_actual: '<string>'
}
]
}
})
};
fetch('https://app.detrack.com/api/v2/dn/jobs', 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://app.detrack.com/api/v2/dn/jobs",
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([
'data' => [
'do_number' => 'DO-10001',
'date' => '2026-09-15',
'type' => 'Delivery',
'address' => 'Singapore 470140',
'address_1' => '<string>',
'address_2' => '<string>',
'address_3' => '<string>',
'deliver_to_collect_from' => 'James Li',
'phone_number' => '65432178',
'fax_number' => '65432179',
'notify_email' => 'test@example.com',
'tracking_number' => 'T0',
'order_number' => 'ORN12345678',
'job_sequence' => 1,
'assign_to' => 'Driver 1',
'items' => [
[
'sku' => '12345678',
'description' => 'iPad',
'quantity' => 10,
'unit_of_measure' => 'pcs',
'purchase_order_number' => '<string>',
'batch_number' => '<string>',
'expiry_date' => '2023-12-25',
'comments' => '<string>',
'serial_numbers' => [
'<string>'
],
'weight' => 123,
'unit_price' => 123,
'fixed_price' => 123,
'minimum_quantity' => 123,
'position' => 123,
'checked' => true,
'actual_quantity' => 123,
'inbound_quantity' => 123,
'follow_up_quantity' => 123,
'follow_up_reason' => '<string>',
'rework_quantity' => 123,
'rework_reason' => '<string>',
'reject_quantity' => 123,
'reject_reason' => '<string>',
'unload_time_estimate' => '<string>',
'unload_time_actual' => '<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://app.detrack.com/api/v2/dn/jobs"
payload := strings.NewReader("{\n \"data\": {\n \"do_number\": \"DO-10001\",\n \"date\": \"2026-09-15\",\n \"type\": \"Delivery\",\n \"address\": \"Singapore 470140\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"address_3\": \"<string>\",\n \"deliver_to_collect_from\": \"James Li\",\n \"phone_number\": \"65432178\",\n \"fax_number\": \"65432179\",\n \"notify_email\": \"test@example.com\",\n \"tracking_number\": \"T0\",\n \"order_number\": \"ORN12345678\",\n \"job_sequence\": 1,\n \"assign_to\": \"Driver 1\",\n \"items\": [\n {\n \"sku\": \"12345678\",\n \"description\": \"iPad\",\n \"quantity\": 10,\n \"unit_of_measure\": \"pcs\",\n \"purchase_order_number\": \"<string>\",\n \"batch_number\": \"<string>\",\n \"expiry_date\": \"2023-12-25\",\n \"comments\": \"<string>\",\n \"serial_numbers\": [\n \"<string>\"\n ],\n \"weight\": 123,\n \"unit_price\": 123,\n \"fixed_price\": 123,\n \"minimum_quantity\": 123,\n \"position\": 123,\n \"checked\": true,\n \"actual_quantity\": 123,\n \"inbound_quantity\": 123,\n \"follow_up_quantity\": 123,\n \"follow_up_reason\": \"<string>\",\n \"rework_quantity\": 123,\n \"rework_reason\": \"<string>\",\n \"reject_quantity\": 123,\n \"reject_reason\": \"<string>\",\n \"unload_time_estimate\": \"<string>\",\n \"unload_time_actual\": \"<string>\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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://app.detrack.com/api/v2/dn/jobs")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"do_number\": \"DO-10001\",\n \"date\": \"2026-09-15\",\n \"type\": \"Delivery\",\n \"address\": \"Singapore 470140\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"address_3\": \"<string>\",\n \"deliver_to_collect_from\": \"James Li\",\n \"phone_number\": \"65432178\",\n \"fax_number\": \"65432179\",\n \"notify_email\": \"test@example.com\",\n \"tracking_number\": \"T0\",\n \"order_number\": \"ORN12345678\",\n \"job_sequence\": 1,\n \"assign_to\": \"Driver 1\",\n \"items\": [\n {\n \"sku\": \"12345678\",\n \"description\": \"iPad\",\n \"quantity\": 10,\n \"unit_of_measure\": \"pcs\",\n \"purchase_order_number\": \"<string>\",\n \"batch_number\": \"<string>\",\n \"expiry_date\": \"2023-12-25\",\n \"comments\": \"<string>\",\n \"serial_numbers\": [\n \"<string>\"\n ],\n \"weight\": 123,\n \"unit_price\": 123,\n \"fixed_price\": 123,\n \"minimum_quantity\": 123,\n \"position\": 123,\n \"checked\": true,\n \"actual_quantity\": 123,\n \"inbound_quantity\": 123,\n \"follow_up_quantity\": 123,\n \"follow_up_reason\": \"<string>\",\n \"rework_quantity\": 123,\n \"rework_reason\": \"<string>\",\n \"reject_quantity\": 123,\n \"reject_reason\": \"<string>\",\n \"unload_time_estimate\": \"<string>\",\n \"unload_time_actual\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.detrack.com/api/v2/dn/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"do_number\": \"DO-10001\",\n \"date\": \"2026-09-15\",\n \"type\": \"Delivery\",\n \"address\": \"Singapore 470140\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"address_3\": \"<string>\",\n \"deliver_to_collect_from\": \"James Li\",\n \"phone_number\": \"65432178\",\n \"fax_number\": \"65432179\",\n \"notify_email\": \"test@example.com\",\n \"tracking_number\": \"T0\",\n \"order_number\": \"ORN12345678\",\n \"job_sequence\": 1,\n \"assign_to\": \"Driver 1\",\n \"items\": [\n {\n \"sku\": \"12345678\",\n \"description\": \"iPad\",\n \"quantity\": 10,\n \"unit_of_measure\": \"pcs\",\n \"purchase_order_number\": \"<string>\",\n \"batch_number\": \"<string>\",\n \"expiry_date\": \"2023-12-25\",\n \"comments\": \"<string>\",\n \"serial_numbers\": [\n \"<string>\"\n ],\n \"weight\": 123,\n \"unit_price\": 123,\n \"fixed_price\": 123,\n \"minimum_quantity\": 123,\n \"position\": 123,\n \"checked\": true,\n \"actual_quantity\": 123,\n \"inbound_quantity\": 123,\n \"follow_up_quantity\": 123,\n \"follow_up_reason\": \"<string>\",\n \"rework_quantity\": 123,\n \"rework_reason\": \"<string>\",\n \"reject_quantity\": 123,\n \"reject_reason\": \"<string>\",\n \"unload_time_estimate\": \"<string>\",\n \"unload_time_actual\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "5b22055510c92b1a046ece04",
"type": "Delivery",
"do_number": "DO-10001",
"date": "2026-09-15",
"status": "dispatched",
"primary_job_status": "dispatched",
"tracking_status": "Info received",
"attempt": 1,
"detrack_number": "DET2000001",
"tracking_number": "T0",
"order_number": "ORN12345678",
"address": "Singapore 470140",
"postal_code": "470140",
"deliver_to_collect_from": "James Li",
"phone_number": "65432178",
"notify_email": "test@example.com",
"items_count": 2,
"created_at": "2026-09-15T06:04:06.017Z",
"items": [
{
"id": "5b22055510c92b1a046ece05",
"sku": "12345678",
"description": "iPad",
"quantity": 10,
"checked": false
}
],
"milestones": [
{
"status": "info_recv",
"assign_to": null,
"reason": null,
"pod_at": "2026-09-15T06:04:06.017Z",
"created_at": "2026-09-15T06:04:06.017Z",
"user_name": "Simon"
}
]
}
}{
"code": "invalid_json_format"
}{
"code": "invalid_key",
"message": "Invalid key"
}{
"code": "forbidden"
}{
"code": "validation_failed",
"message": "Validation Failed",
"errors": [
{
"field": "do_number",
"codes": [
"can't be blank"
]
}
]
}Use the Create Job endpoint to add a single job to Detrack. You must provide
do_number and date, plus an address (either address or the address lines). You can also include items, contact details, instructions, and many other job fields.
For what status, primary_job_status, and tracking_status mean, see Status fields.
See also Retrieve job, Update job, and List jobs.Authorizations
Your Detrack API key, from Integrations > API Key in the dashboard.
Body
application/json
Fields for creating a job. do_number and date are required. address is required unless you send address_1, address_2, or address_3. Your account settings can make other fields mandatory.
Show child attributes
Show child attributes
Response
Created. The Location header has the job's retrieve URL.
A delivery or collection job. Only the most-used fields are listed; the API returns more.
Show child attributes
Show child attributes
Create a job
curl --request POST \
--url https://app.detrack.com/api/v2/dn/jobs \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"data": {
"do_number": "DO-10001",
"date": "2026-09-15",
"type": "Delivery",
"address": "Singapore 470140",
"address_1": "<string>",
"address_2": "<string>",
"address_3": "<string>",
"deliver_to_collect_from": "James Li",
"phone_number": "65432178",
"fax_number": "65432179",
"notify_email": "test@example.com",
"tracking_number": "T0",
"order_number": "ORN12345678",
"job_sequence": 1,
"assign_to": "Driver 1",
"items": [
{
"sku": "12345678",
"description": "iPad",
"quantity": 10,
"unit_of_measure": "pcs",
"purchase_order_number": "<string>",
"batch_number": "<string>",
"expiry_date": "2023-12-25",
"comments": "<string>",
"serial_numbers": [
"<string>"
],
"weight": 123,
"unit_price": 123,
"fixed_price": 123,
"minimum_quantity": 123,
"position": 123,
"checked": true,
"actual_quantity": 123,
"inbound_quantity": 123,
"follow_up_quantity": 123,
"follow_up_reason": "<string>",
"rework_quantity": 123,
"rework_reason": "<string>",
"reject_quantity": 123,
"reject_reason": "<string>",
"unload_time_estimate": "<string>",
"unload_time_actual": "<string>"
}
]
}
}
'import requests
url = "https://app.detrack.com/api/v2/dn/jobs"
payload = { "data": {
"do_number": "DO-10001",
"date": "2026-09-15",
"type": "Delivery",
"address": "Singapore 470140",
"address_1": "<string>",
"address_2": "<string>",
"address_3": "<string>",
"deliver_to_collect_from": "James Li",
"phone_number": "65432178",
"fax_number": "65432179",
"notify_email": "test@example.com",
"tracking_number": "T0",
"order_number": "ORN12345678",
"job_sequence": 1,
"assign_to": "Driver 1",
"items": [
{
"sku": "12345678",
"description": "iPad",
"quantity": 10,
"unit_of_measure": "pcs",
"purchase_order_number": "<string>",
"batch_number": "<string>",
"expiry_date": "2023-12-25",
"comments": "<string>",
"serial_numbers": ["<string>"],
"weight": 123,
"unit_price": 123,
"fixed_price": 123,
"minimum_quantity": 123,
"position": 123,
"checked": True,
"actual_quantity": 123,
"inbound_quantity": 123,
"follow_up_quantity": 123,
"follow_up_reason": "<string>",
"rework_quantity": 123,
"rework_reason": "<string>",
"reject_quantity": 123,
"reject_reason": "<string>",
"unload_time_estimate": "<string>",
"unload_time_actual": "<string>"
}
]
} }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
do_number: 'DO-10001',
date: '2026-09-15',
type: 'Delivery',
address: 'Singapore 470140',
address_1: '<string>',
address_2: '<string>',
address_3: '<string>',
deliver_to_collect_from: 'James Li',
phone_number: '65432178',
fax_number: '65432179',
notify_email: 'test@example.com',
tracking_number: 'T0',
order_number: 'ORN12345678',
job_sequence: 1,
assign_to: 'Driver 1',
items: [
{
sku: '12345678',
description: 'iPad',
quantity: 10,
unit_of_measure: 'pcs',
purchase_order_number: '<string>',
batch_number: '<string>',
expiry_date: '2023-12-25',
comments: '<string>',
serial_numbers: ['<string>'],
weight: 123,
unit_price: 123,
fixed_price: 123,
minimum_quantity: 123,
position: 123,
checked: true,
actual_quantity: 123,
inbound_quantity: 123,
follow_up_quantity: 123,
follow_up_reason: '<string>',
rework_quantity: 123,
rework_reason: '<string>',
reject_quantity: 123,
reject_reason: '<string>',
unload_time_estimate: '<string>',
unload_time_actual: '<string>'
}
]
}
})
};
fetch('https://app.detrack.com/api/v2/dn/jobs', 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://app.detrack.com/api/v2/dn/jobs",
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([
'data' => [
'do_number' => 'DO-10001',
'date' => '2026-09-15',
'type' => 'Delivery',
'address' => 'Singapore 470140',
'address_1' => '<string>',
'address_2' => '<string>',
'address_3' => '<string>',
'deliver_to_collect_from' => 'James Li',
'phone_number' => '65432178',
'fax_number' => '65432179',
'notify_email' => 'test@example.com',
'tracking_number' => 'T0',
'order_number' => 'ORN12345678',
'job_sequence' => 1,
'assign_to' => 'Driver 1',
'items' => [
[
'sku' => '12345678',
'description' => 'iPad',
'quantity' => 10,
'unit_of_measure' => 'pcs',
'purchase_order_number' => '<string>',
'batch_number' => '<string>',
'expiry_date' => '2023-12-25',
'comments' => '<string>',
'serial_numbers' => [
'<string>'
],
'weight' => 123,
'unit_price' => 123,
'fixed_price' => 123,
'minimum_quantity' => 123,
'position' => 123,
'checked' => true,
'actual_quantity' => 123,
'inbound_quantity' => 123,
'follow_up_quantity' => 123,
'follow_up_reason' => '<string>',
'rework_quantity' => 123,
'rework_reason' => '<string>',
'reject_quantity' => 123,
'reject_reason' => '<string>',
'unload_time_estimate' => '<string>',
'unload_time_actual' => '<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://app.detrack.com/api/v2/dn/jobs"
payload := strings.NewReader("{\n \"data\": {\n \"do_number\": \"DO-10001\",\n \"date\": \"2026-09-15\",\n \"type\": \"Delivery\",\n \"address\": \"Singapore 470140\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"address_3\": \"<string>\",\n \"deliver_to_collect_from\": \"James Li\",\n \"phone_number\": \"65432178\",\n \"fax_number\": \"65432179\",\n \"notify_email\": \"test@example.com\",\n \"tracking_number\": \"T0\",\n \"order_number\": \"ORN12345678\",\n \"job_sequence\": 1,\n \"assign_to\": \"Driver 1\",\n \"items\": [\n {\n \"sku\": \"12345678\",\n \"description\": \"iPad\",\n \"quantity\": 10,\n \"unit_of_measure\": \"pcs\",\n \"purchase_order_number\": \"<string>\",\n \"batch_number\": \"<string>\",\n \"expiry_date\": \"2023-12-25\",\n \"comments\": \"<string>\",\n \"serial_numbers\": [\n \"<string>\"\n ],\n \"weight\": 123,\n \"unit_price\": 123,\n \"fixed_price\": 123,\n \"minimum_quantity\": 123,\n \"position\": 123,\n \"checked\": true,\n \"actual_quantity\": 123,\n \"inbound_quantity\": 123,\n \"follow_up_quantity\": 123,\n \"follow_up_reason\": \"<string>\",\n \"rework_quantity\": 123,\n \"rework_reason\": \"<string>\",\n \"reject_quantity\": 123,\n \"reject_reason\": \"<string>\",\n \"unload_time_estimate\": \"<string>\",\n \"unload_time_actual\": \"<string>\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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://app.detrack.com/api/v2/dn/jobs")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"do_number\": \"DO-10001\",\n \"date\": \"2026-09-15\",\n \"type\": \"Delivery\",\n \"address\": \"Singapore 470140\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"address_3\": \"<string>\",\n \"deliver_to_collect_from\": \"James Li\",\n \"phone_number\": \"65432178\",\n \"fax_number\": \"65432179\",\n \"notify_email\": \"test@example.com\",\n \"tracking_number\": \"T0\",\n \"order_number\": \"ORN12345678\",\n \"job_sequence\": 1,\n \"assign_to\": \"Driver 1\",\n \"items\": [\n {\n \"sku\": \"12345678\",\n \"description\": \"iPad\",\n \"quantity\": 10,\n \"unit_of_measure\": \"pcs\",\n \"purchase_order_number\": \"<string>\",\n \"batch_number\": \"<string>\",\n \"expiry_date\": \"2023-12-25\",\n \"comments\": \"<string>\",\n \"serial_numbers\": [\n \"<string>\"\n ],\n \"weight\": 123,\n \"unit_price\": 123,\n \"fixed_price\": 123,\n \"minimum_quantity\": 123,\n \"position\": 123,\n \"checked\": true,\n \"actual_quantity\": 123,\n \"inbound_quantity\": 123,\n \"follow_up_quantity\": 123,\n \"follow_up_reason\": \"<string>\",\n \"rework_quantity\": 123,\n \"rework_reason\": \"<string>\",\n \"reject_quantity\": 123,\n \"reject_reason\": \"<string>\",\n \"unload_time_estimate\": \"<string>\",\n \"unload_time_actual\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.detrack.com/api/v2/dn/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"do_number\": \"DO-10001\",\n \"date\": \"2026-09-15\",\n \"type\": \"Delivery\",\n \"address\": \"Singapore 470140\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"address_3\": \"<string>\",\n \"deliver_to_collect_from\": \"James Li\",\n \"phone_number\": \"65432178\",\n \"fax_number\": \"65432179\",\n \"notify_email\": \"test@example.com\",\n \"tracking_number\": \"T0\",\n \"order_number\": \"ORN12345678\",\n \"job_sequence\": 1,\n \"assign_to\": \"Driver 1\",\n \"items\": [\n {\n \"sku\": \"12345678\",\n \"description\": \"iPad\",\n \"quantity\": 10,\n \"unit_of_measure\": \"pcs\",\n \"purchase_order_number\": \"<string>\",\n \"batch_number\": \"<string>\",\n \"expiry_date\": \"2023-12-25\",\n \"comments\": \"<string>\",\n \"serial_numbers\": [\n \"<string>\"\n ],\n \"weight\": 123,\n \"unit_price\": 123,\n \"fixed_price\": 123,\n \"minimum_quantity\": 123,\n \"position\": 123,\n \"checked\": true,\n \"actual_quantity\": 123,\n \"inbound_quantity\": 123,\n \"follow_up_quantity\": 123,\n \"follow_up_reason\": \"<string>\",\n \"rework_quantity\": 123,\n \"rework_reason\": \"<string>\",\n \"reject_quantity\": 123,\n \"reject_reason\": \"<string>\",\n \"unload_time_estimate\": \"<string>\",\n \"unload_time_actual\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "5b22055510c92b1a046ece04",
"type": "Delivery",
"do_number": "DO-10001",
"date": "2026-09-15",
"status": "dispatched",
"primary_job_status": "dispatched",
"tracking_status": "Info received",
"attempt": 1,
"detrack_number": "DET2000001",
"tracking_number": "T0",
"order_number": "ORN12345678",
"address": "Singapore 470140",
"postal_code": "470140",
"deliver_to_collect_from": "James Li",
"phone_number": "65432178",
"notify_email": "test@example.com",
"items_count": 2,
"created_at": "2026-09-15T06:04:06.017Z",
"items": [
{
"id": "5b22055510c92b1a046ece05",
"sku": "12345678",
"description": "iPad",
"quantity": 10,
"checked": false
}
],
"milestones": [
{
"status": "info_recv",
"assign_to": null,
"reason": null,
"pod_at": "2026-09-15T06:04:06.017Z",
"created_at": "2026-09-15T06:04:06.017Z",
"user_name": "Simon"
}
]
}
}{
"code": "invalid_json_format"
}{
"code": "invalid_key",
"message": "Invalid key"
}{
"code": "forbidden"
}{
"code": "validation_failed",
"message": "Validation Failed",
"errors": [
{
"field": "do_number",
"codes": [
"can't be blank"
]
}
]
}