Create an AddOn
curl --request POST \
--url https://api.tread-horizon.com/v1/add_ons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"add_on_types": [
"driver_pay"
],
"cost_rate_value": 123,
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"quantity": 123,
"external_id": "<string>",
"percentage": 0,
"accounting_id": "<string>",
"rate": 123,
"add_on_rate_type": "RateForEach",
"fuel_surcharge_schedule_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxable": false
}
'import requests
url = "https://api.tread-horizon.com/v1/add_ons"
payload = {
"name": "<string>",
"add_on_types": ["driver_pay"],
"cost_rate_value": 123,
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"quantity": 123,
"external_id": "<string>",
"percentage": 0,
"accounting_id": "<string>",
"rate": 123,
"add_on_rate_type": "RateForEach",
"fuel_surcharge_schedule_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxable": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
add_on_types: ['driver_pay'],
cost_rate_value: 123,
revenue_rate_value: 123,
revenue_cost_rate_type: 'RateForEach',
quantity: 123,
external_id: '<string>',
percentage: 0,
accounting_id: '<string>',
rate: 123,
add_on_rate_type: 'RateForEach',
fuel_surcharge_schedule_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
taxable: false
})
};
fetch('https://api.tread-horizon.com/v1/add_ons', 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.tread-horizon.com/v1/add_ons",
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([
'name' => '<string>',
'add_on_types' => [
'driver_pay'
],
'cost_rate_value' => 123,
'revenue_rate_value' => 123,
'revenue_cost_rate_type' => 'RateForEach',
'quantity' => 123,
'external_id' => '<string>',
'percentage' => 0,
'accounting_id' => '<string>',
'rate' => 123,
'add_on_rate_type' => 'RateForEach',
'fuel_surcharge_schedule_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'taxable' => false
]),
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.tread-horizon.com/v1/add_ons"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"add_on_types\": [\n \"driver_pay\"\n ],\n \"cost_rate_value\": 123,\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"quantity\": 123,\n \"external_id\": \"<string>\",\n \"percentage\": 0,\n \"accounting_id\": \"<string>\",\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"fuel_surcharge_schedule_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxable\": false\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tread-horizon.com/v1/add_ons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"add_on_types\": [\n \"driver_pay\"\n ],\n \"cost_rate_value\": 123,\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"quantity\": 123,\n \"external_id\": \"<string>\",\n \"percentage\": 0,\n \"accounting_id\": \"<string>\",\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"fuel_surcharge_schedule_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxable\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/add_ons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"add_on_types\": [\n \"driver_pay\"\n ],\n \"cost_rate_value\": 123,\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"quantity\": 123,\n \"external_id\": \"<string>\",\n \"percentage\": 0,\n \"accounting_id\": \"<string>\",\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"fuel_surcharge_schedule_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxable\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"add_on_types": [
"driver_pay"
],
"quantity": "<string>",
"cost_rate_value": "<string>",
"revenue_rate_value": "<string>",
"revenue_cost_rate_type": "RateForEach",
"external_id": "<string>",
"percentage": "<string>",
"company": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tread_id": "ABC123",
"legal_name": "<string>",
"company_type": "hauler"
},
"accounting_id": "<string>",
"rate": "<string>",
"add_on_rate_type": "RateForEach",
"taxable": false,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"fuel_surcharge_schedule": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"error_type": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
{
"model": "<string>",
"field": "<string>",
"message": "<string>"
}
]
}
}AddOns
Create an AddOn
Create an AddOn
POST
/
v1
/
add_ons
Create an AddOn
curl --request POST \
--url https://api.tread-horizon.com/v1/add_ons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"add_on_types": [
"driver_pay"
],
"cost_rate_value": 123,
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"quantity": 123,
"external_id": "<string>",
"percentage": 0,
"accounting_id": "<string>",
"rate": 123,
"add_on_rate_type": "RateForEach",
"fuel_surcharge_schedule_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxable": false
}
'import requests
url = "https://api.tread-horizon.com/v1/add_ons"
payload = {
"name": "<string>",
"add_on_types": ["driver_pay"],
"cost_rate_value": 123,
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"quantity": 123,
"external_id": "<string>",
"percentage": 0,
"accounting_id": "<string>",
"rate": 123,
"add_on_rate_type": "RateForEach",
"fuel_surcharge_schedule_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxable": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
add_on_types: ['driver_pay'],
cost_rate_value: 123,
revenue_rate_value: 123,
revenue_cost_rate_type: 'RateForEach',
quantity: 123,
external_id: '<string>',
percentage: 0,
accounting_id: '<string>',
rate: 123,
add_on_rate_type: 'RateForEach',
fuel_surcharge_schedule_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
taxable: false
})
};
fetch('https://api.tread-horizon.com/v1/add_ons', 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.tread-horizon.com/v1/add_ons",
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([
'name' => '<string>',
'add_on_types' => [
'driver_pay'
],
'cost_rate_value' => 123,
'revenue_rate_value' => 123,
'revenue_cost_rate_type' => 'RateForEach',
'quantity' => 123,
'external_id' => '<string>',
'percentage' => 0,
'accounting_id' => '<string>',
'rate' => 123,
'add_on_rate_type' => 'RateForEach',
'fuel_surcharge_schedule_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'taxable' => false
]),
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.tread-horizon.com/v1/add_ons"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"add_on_types\": [\n \"driver_pay\"\n ],\n \"cost_rate_value\": 123,\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"quantity\": 123,\n \"external_id\": \"<string>\",\n \"percentage\": 0,\n \"accounting_id\": \"<string>\",\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"fuel_surcharge_schedule_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxable\": false\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tread-horizon.com/v1/add_ons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"add_on_types\": [\n \"driver_pay\"\n ],\n \"cost_rate_value\": 123,\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"quantity\": 123,\n \"external_id\": \"<string>\",\n \"percentage\": 0,\n \"accounting_id\": \"<string>\",\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"fuel_surcharge_schedule_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxable\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/add_ons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"add_on_types\": [\n \"driver_pay\"\n ],\n \"cost_rate_value\": 123,\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"quantity\": 123,\n \"external_id\": \"<string>\",\n \"percentage\": 0,\n \"accounting_id\": \"<string>\",\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"fuel_surcharge_schedule_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxable\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"add_on_types": [
"driver_pay"
],
"quantity": "<string>",
"cost_rate_value": "<string>",
"revenue_rate_value": "<string>",
"revenue_cost_rate_type": "RateForEach",
"external_id": "<string>",
"percentage": "<string>",
"company": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tread_id": "ABC123",
"legal_name": "<string>",
"company_type": "hauler"
},
"accounting_id": "<string>",
"rate": "<string>",
"add_on_rate_type": "RateForEach",
"taxable": false,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"fuel_surcharge_schedule": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"error_type": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
{
"model": "<string>",
"field": "<string>",
"message": "<string>"
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The Accept-Language request HTTP header indicates the natural language and locale that the client prefers.
Example:
"en"
Body
application/json
Available options:
driver_pay, invoicing, job, settlement, driver_day The cost rate or buy price of the add on.
The revenue rate or sell price of the add on.
Available options:
RateForEach, RatePercentOfTotal, PerLoad, FuelSurcharge Example:
"RateForEach"
RatePercentTotal specific field
Required range:
-100 <= x <= 100Deprecated in favor of revenue_rate_value.
Deprecated in favor of revenue_cost_rate_type.
Available options:
RateForEach, RatePercentOfTotal, PerLoad, FuelSurcharge Example:
"RateForEach"
Whether this add-on is eligible for taxation
Response
Created
Show child attributes
Show child attributes
⌘I