Batch update AddOnCharges for an Invoice for a Company
curl --request PATCH \
--url https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"add_on_charges": [
{
"name": "<string>",
"percentage": 0,
"quantity": 123,
"rate": 123,
"add_on_rate_type": "RateForEach",
"add_on_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"accounting_id": "<string>",
"load_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"rebill_revenue_rate_value": 123,
"rebill_percentage": 123,
"cost_rate_value": 123
}
]
}
'import requests
url = "https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges"
payload = { "add_on_charges": [
{
"name": "<string>",
"percentage": 0,
"quantity": 123,
"rate": 123,
"add_on_rate_type": "RateForEach",
"add_on_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"accounting_id": "<string>",
"load_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"rebill_revenue_rate_value": 123,
"rebill_percentage": 123,
"cost_rate_value": 123
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
add_on_charges: [
{
name: '<string>',
percentage: 0,
quantity: 123,
rate: 123,
add_on_rate_type: 'RateForEach',
add_on_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
invoice_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
external_id: '<string>',
accounting_id: '<string>',
load_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
revenue_rate_value: 123,
revenue_cost_rate_type: 'RateForEach',
rebill_revenue_rate_value: 123,
rebill_percentage: 123,
cost_rate_value: 123
}
]
})
};
fetch('https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges', 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/companies/{company-id}/invoices/{invoice-id}/add_on_charges",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'add_on_charges' => [
[
'name' => '<string>',
'percentage' => 0,
'quantity' => 123,
'rate' => 123,
'add_on_rate_type' => 'RateForEach',
'add_on_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'invoice_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_id' => '<string>',
'accounting_id' => '<string>',
'load_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'revenue_rate_value' => 123,
'revenue_cost_rate_type' => 'RateForEach',
'rebill_revenue_rate_value' => 123,
'rebill_percentage' => 123,
'cost_rate_value' => 123
]
]
]),
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/companies/{company-id}/invoices/{invoice-id}/add_on_charges"
payload := strings.NewReader("{\n \"add_on_charges\": [\n {\n \"name\": \"<string>\",\n \"percentage\": 0,\n \"quantity\": 123,\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"add_on_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"accounting_id\": \"<string>\",\n \"load_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"rebill_revenue_rate_value\": 123,\n \"rebill_percentage\": 123,\n \"cost_rate_value\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"add_on_charges\": [\n {\n \"name\": \"<string>\",\n \"percentage\": 0,\n \"quantity\": 123,\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"add_on_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"accounting_id\": \"<string>\",\n \"load_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"rebill_revenue_rate_value\": 123,\n \"rebill_percentage\": 123,\n \"cost_rate_value\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"add_on_charges\": [\n {\n \"name\": \"<string>\",\n \"percentage\": 0,\n \"quantity\": 123,\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"add_on_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"accounting_id\": \"<string>\",\n \"load_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"rebill_revenue_rate_value\": 123,\n \"rebill_percentage\": 123,\n \"cost_rate_value\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"percentage": "<string>",
"quantity": "<string>",
"total_amount": "<string>",
"external_id": "<string>",
"revenue_rate_value": "<string>",
"revenue_cost_rate_type": "RateForEach",
"add_on_requestable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"add_on_applicable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accounting_id": "<string>",
"rate": "<string>",
"add_on_rate_type": "RateForEach",
"rebill_revenue_rate_value": "<string>",
"rebill_total_amount": "<string>",
"add_on": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"invoice": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"load": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"job": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"job_id": "<string>",
"loads_count": 123,
"job_start_at": "2023-11-07T05:31:56Z",
"unit_of_measure": "Load"
},
"rebill_percentage": "<string>"
}
]
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"error_type": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
{
"model": "<string>",
"field": "<string>",
"message": "<string>"
}
]
}
}AddOnCharges
Batch update AddOnCharges for an Invoice for a Company
Batch update AddOnCharges for an Invoice for a Company
This endpoint allows updating, creating, deleting AddOnCharges all at once.
If updating existing records:
- must provide the
idfor each record to be updated - only provide the fields to be updated e.g.
add_on_charges: [
{
"id": "some-uuid"
"quantity": 20.25,
"rate": 15.75
}
]
If creating new records:
- must not provide the
idfor each record to be created - provide all the fields needed for the record e.g.
add_on_charges: [
{
"quantity": 20.25,
"rate": 12.5,
"add_on_rate_type": "RateForEach"
},
{
"percentage": 10,
"add_on_rate_type": "RatePercentOfTotal"
}
]
If deleting exisitng records:
- must provide the
idand the property_destroy: 1
e.g.
add_on_charges: [
{
"id": "some-uuid"
"_destroy": 1
}
]
PATCH
/
v1
/
companies
/
{company-id}
/
invoices
/
{invoice-id}
/
add_on_charges
Batch update AddOnCharges for an Invoice for a Company
curl --request PATCH \
--url https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"add_on_charges": [
{
"name": "<string>",
"percentage": 0,
"quantity": 123,
"rate": 123,
"add_on_rate_type": "RateForEach",
"add_on_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"accounting_id": "<string>",
"load_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"rebill_revenue_rate_value": 123,
"rebill_percentage": 123,
"cost_rate_value": 123
}
]
}
'import requests
url = "https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges"
payload = { "add_on_charges": [
{
"name": "<string>",
"percentage": 0,
"quantity": 123,
"rate": 123,
"add_on_rate_type": "RateForEach",
"add_on_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"accounting_id": "<string>",
"load_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revenue_rate_value": 123,
"revenue_cost_rate_type": "RateForEach",
"rebill_revenue_rate_value": 123,
"rebill_percentage": 123,
"cost_rate_value": 123
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
add_on_charges: [
{
name: '<string>',
percentage: 0,
quantity: 123,
rate: 123,
add_on_rate_type: 'RateForEach',
add_on_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
invoice_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
external_id: '<string>',
accounting_id: '<string>',
load_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
revenue_rate_value: 123,
revenue_cost_rate_type: 'RateForEach',
rebill_revenue_rate_value: 123,
rebill_percentage: 123,
cost_rate_value: 123
}
]
})
};
fetch('https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges', 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/companies/{company-id}/invoices/{invoice-id}/add_on_charges",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'add_on_charges' => [
[
'name' => '<string>',
'percentage' => 0,
'quantity' => 123,
'rate' => 123,
'add_on_rate_type' => 'RateForEach',
'add_on_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'invoice_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_id' => '<string>',
'accounting_id' => '<string>',
'load_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'revenue_rate_value' => 123,
'revenue_cost_rate_type' => 'RateForEach',
'rebill_revenue_rate_value' => 123,
'rebill_percentage' => 123,
'cost_rate_value' => 123
]
]
]),
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/companies/{company-id}/invoices/{invoice-id}/add_on_charges"
payload := strings.NewReader("{\n \"add_on_charges\": [\n {\n \"name\": \"<string>\",\n \"percentage\": 0,\n \"quantity\": 123,\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"add_on_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"accounting_id\": \"<string>\",\n \"load_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"rebill_revenue_rate_value\": 123,\n \"rebill_percentage\": 123,\n \"cost_rate_value\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"add_on_charges\": [\n {\n \"name\": \"<string>\",\n \"percentage\": 0,\n \"quantity\": 123,\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"add_on_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"accounting_id\": \"<string>\",\n \"load_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"rebill_revenue_rate_value\": 123,\n \"rebill_percentage\": 123,\n \"cost_rate_value\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/companies/{company-id}/invoices/{invoice-id}/add_on_charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"add_on_charges\": [\n {\n \"name\": \"<string>\",\n \"percentage\": 0,\n \"quantity\": 123,\n \"rate\": 123,\n \"add_on_rate_type\": \"RateForEach\",\n \"add_on_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\",\n \"accounting_id\": \"<string>\",\n \"load_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"revenue_rate_value\": 123,\n \"revenue_cost_rate_type\": \"RateForEach\",\n \"rebill_revenue_rate_value\": 123,\n \"rebill_percentage\": 123,\n \"cost_rate_value\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"percentage": "<string>",
"quantity": "<string>",
"total_amount": "<string>",
"external_id": "<string>",
"revenue_rate_value": "<string>",
"revenue_cost_rate_type": "RateForEach",
"add_on_requestable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"add_on_applicable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accounting_id": "<string>",
"rate": "<string>",
"add_on_rate_type": "RateForEach",
"rebill_revenue_rate_value": "<string>",
"rebill_total_amount": "<string>",
"add_on": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"invoice": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"load": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"job": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"job_id": "<string>",
"loads_count": 123,
"job_start_at": "2023-11-07T05:31:56Z",
"unit_of_measure": "Load"
},
"rebill_percentage": "<string>"
}
]
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"error_type": "<string>"
}
}{
"error": {
"code": "<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
- AddOnCharge-Create
- AddOnCharge-Update-Destroyable
Show child attributes
Show child attributes
Response
OK
Show child attributes
Show child attributes
Create an AddOnCharge for an Invoice (company-scoped)Retrieve AddOnCharges for a Settlement (company-scoped)
⌘I