Update a Tenant Classification Rule
Update a tenant rule. Omitted fields keep their current values.
Scopes: tenant:update
curl --request PATCH \
--url https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"target_ledger_name": "Software Expenses",
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
}
},
"splits": [
{
"ledger_name": "Sales Tax Payable",
"percentage": 8.875
},
{
"ledger_name": "Bank Fees",
"percentage": 10
}
],
"tags": {
"Job": [
{
"percentage": 60,
"value": "Maple Street Remodel"
},
{
"percentage": 40,
"value": "Oak Avenue Deck"
}
],
"Location": "NYC"
}
}
],
"auto_confirm": true,
"is_active": true
}
'import requests
url = "https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}"
payload = {
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"target_ledger_name": "Software Expenses",
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
}
},
"splits": [
{
"ledger_name": "Sales Tax Payable",
"percentage": 8.875
},
{
"ledger_name": "Bank Fees",
"percentage": 10
}
],
"tags": {
"Job": [
{
"percentage": 60,
"value": "Maple Street Remodel"
},
{
"percentage": 40,
"value": "Oak Avenue Deck"
}
],
"Location": "NYC"
}
}
],
"auto_confirm": True,
"is_active": True
}
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({
merchant: '<string>',
description_value: '<string>',
classifications: [
{
target_ledger_name: 'Software Expenses',
conditions: {
amount: {value: 100, max_value: 250},
date: {value: '2023-12-25', max_value: '2023-12-25'}
},
splits: [
{ledger_name: 'Sales Tax Payable', percentage: 8.875},
{ledger_name: 'Bank Fees', percentage: 10}
],
tags: {
Job: [
{percentage: 60, value: 'Maple Street Remodel'},
{percentage: 40, value: 'Oak Avenue Deck'}
],
Location: 'NYC'
}
}
],
auto_confirm: true,
is_active: true
})
};
fetch('https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}', 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.getasset.com/v0/tenant/rules/classifications/{rule_id}",
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([
'merchant' => '<string>',
'description_value' => '<string>',
'classifications' => [
[
'target_ledger_name' => 'Software Expenses',
'conditions' => [
'amount' => [
'value' => 100,
'max_value' => 250
],
'date' => [
'value' => '2023-12-25',
'max_value' => '2023-12-25'
]
],
'splits' => [
[
'ledger_name' => 'Sales Tax Payable',
'percentage' => 8.875
],
[
'ledger_name' => 'Bank Fees',
'percentage' => 10
]
],
'tags' => [
'Job' => [
[
'percentage' => 60,
'value' => 'Maple Street Remodel'
],
[
'percentage' => 40,
'value' => 'Oak Avenue Deck'
]
],
'Location' => 'NYC'
]
]
],
'auto_confirm' => true,
'is_active' => true
]),
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.getasset.com/v0/tenant/rules/classifications/{rule_id}"
payload := strings.NewReader("{\n \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\n \"target_ledger_name\": \"Software Expenses\",\n \"conditions\": {\n \"amount\": {\n \"value\": 100,\n \"max_value\": 250\n },\n \"date\": {\n \"value\": \"2023-12-25\",\n \"max_value\": \"2023-12-25\"\n }\n },\n \"splits\": [\n {\n \"ledger_name\": \"Sales Tax Payable\",\n \"percentage\": 8.875\n },\n {\n \"ledger_name\": \"Bank Fees\",\n \"percentage\": 10\n }\n ],\n \"tags\": {\n \"Job\": [\n {\n \"percentage\": 60,\n \"value\": \"Maple Street Remodel\"\n },\n {\n \"percentage\": 40,\n \"value\": \"Oak Avenue Deck\"\n }\n ],\n \"Location\": \"NYC\"\n }\n }\n ],\n \"auto_confirm\": true,\n \"is_active\": true\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.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\n \"target_ledger_name\": \"Software Expenses\",\n \"conditions\": {\n \"amount\": {\n \"value\": 100,\n \"max_value\": 250\n },\n \"date\": {\n \"value\": \"2023-12-25\",\n \"max_value\": \"2023-12-25\"\n }\n },\n \"splits\": [\n {\n \"ledger_name\": \"Sales Tax Payable\",\n \"percentage\": 8.875\n },\n {\n \"ledger_name\": \"Bank Fees\",\n \"percentage\": 10\n }\n ],\n \"tags\": {\n \"Job\": [\n {\n \"percentage\": 60,\n \"value\": \"Maple Street Remodel\"\n },\n {\n \"percentage\": 40,\n \"value\": \"Oak Avenue Deck\"\n }\n ],\n \"Location\": \"NYC\"\n }\n }\n ],\n \"auto_confirm\": true,\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}")
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 \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\n \"target_ledger_name\": \"Software Expenses\",\n \"conditions\": {\n \"amount\": {\n \"value\": 100,\n \"max_value\": 250\n },\n \"date\": {\n \"value\": \"2023-12-25\",\n \"max_value\": \"2023-12-25\"\n }\n },\n \"splits\": [\n {\n \"ledger_name\": \"Sales Tax Payable\",\n \"percentage\": 8.875\n },\n {\n \"ledger_name\": \"Bank Fees\",\n \"percentage\": 10\n }\n ],\n \"tags\": {\n \"Job\": [\n {\n \"percentage\": 60,\n \"value\": \"Maple Street Remodel\"\n },\n {\n \"percentage\": 40,\n \"value\": \"Oak Avenue Deck\"\n }\n ],\n \"Location\": \"NYC\"\n }\n }\n ],\n \"auto_confirm\": true,\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "clr_GA6EG2qFxA97NZHtxeLPUy",
"classifications": [
{
"conditions": {
"amount": {
"operator": "equals",
"value": 100,
"max_value": 250
},
"direction": "money_in",
"date": {
"operator": "equals",
"value": "2023-12-25",
"max_value": "2023-12-25"
}
},
"target_ledger_name": "<string>",
"splits": [
{
"ledger_name": "<string>",
"percentage": 123
}
],
"tags": {}
}
],
"auto_confirm": true,
"is_active": true,
"match_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"merchant": "Starbucks",
"description_match_type": "contains",
"description_value": "MONTHLY SOFTWARE SUBSCRIPTION",
"last_matched_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
- Token URL
- /v0/auth/token
Path Parameters
The id of the classification rule
"clr_GA6EG2qFxA97NZHtxeLPUy"
Body
255contains, not_contains, equals 512Replaces the rule's full list of classifications; omit to keep the current ones.
1Show child attributes
Show child attributes
Whether the rule takes part in categorization and tagging.
Response
Successful Response
The id of the classification rule
"clr_GA6EG2qFxA97NZHtxeLPUy"
Classifications evaluated in order. Categorization applies the first one whose conditions match and whose ledger name the business has; tagging applies, per tag field, the first one whose conditions match and that sets the field.
Show child attributes
Show child attributes
Whether the rule takes part in categorization and tagging.
Number of transactions the rule has matched.
Case-insensitive exact merchant name to match. Mutually exclusive with the description criterion; exactly one of the two is required.
255"Starbucks"
How to match the transaction description.
contains, not_contains, equals Description text to match, case-insensitive.
512"MONTHLY SOFTWARE SUBSCRIPTION"
When the rule last matched a transaction.
curl --request PATCH \
--url https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"target_ledger_name": "Software Expenses",
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
}
},
"splits": [
{
"ledger_name": "Sales Tax Payable",
"percentage": 8.875
},
{
"ledger_name": "Bank Fees",
"percentage": 10
}
],
"tags": {
"Job": [
{
"percentage": 60,
"value": "Maple Street Remodel"
},
{
"percentage": 40,
"value": "Oak Avenue Deck"
}
],
"Location": "NYC"
}
}
],
"auto_confirm": true,
"is_active": true
}
'import requests
url = "https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}"
payload = {
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"target_ledger_name": "Software Expenses",
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
}
},
"splits": [
{
"ledger_name": "Sales Tax Payable",
"percentage": 8.875
},
{
"ledger_name": "Bank Fees",
"percentage": 10
}
],
"tags": {
"Job": [
{
"percentage": 60,
"value": "Maple Street Remodel"
},
{
"percentage": 40,
"value": "Oak Avenue Deck"
}
],
"Location": "NYC"
}
}
],
"auto_confirm": True,
"is_active": True
}
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({
merchant: '<string>',
description_value: '<string>',
classifications: [
{
target_ledger_name: 'Software Expenses',
conditions: {
amount: {value: 100, max_value: 250},
date: {value: '2023-12-25', max_value: '2023-12-25'}
},
splits: [
{ledger_name: 'Sales Tax Payable', percentage: 8.875},
{ledger_name: 'Bank Fees', percentage: 10}
],
tags: {
Job: [
{percentage: 60, value: 'Maple Street Remodel'},
{percentage: 40, value: 'Oak Avenue Deck'}
],
Location: 'NYC'
}
}
],
auto_confirm: true,
is_active: true
})
};
fetch('https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}', 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.getasset.com/v0/tenant/rules/classifications/{rule_id}",
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([
'merchant' => '<string>',
'description_value' => '<string>',
'classifications' => [
[
'target_ledger_name' => 'Software Expenses',
'conditions' => [
'amount' => [
'value' => 100,
'max_value' => 250
],
'date' => [
'value' => '2023-12-25',
'max_value' => '2023-12-25'
]
],
'splits' => [
[
'ledger_name' => 'Sales Tax Payable',
'percentage' => 8.875
],
[
'ledger_name' => 'Bank Fees',
'percentage' => 10
]
],
'tags' => [
'Job' => [
[
'percentage' => 60,
'value' => 'Maple Street Remodel'
],
[
'percentage' => 40,
'value' => 'Oak Avenue Deck'
]
],
'Location' => 'NYC'
]
]
],
'auto_confirm' => true,
'is_active' => true
]),
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.getasset.com/v0/tenant/rules/classifications/{rule_id}"
payload := strings.NewReader("{\n \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\n \"target_ledger_name\": \"Software Expenses\",\n \"conditions\": {\n \"amount\": {\n \"value\": 100,\n \"max_value\": 250\n },\n \"date\": {\n \"value\": \"2023-12-25\",\n \"max_value\": \"2023-12-25\"\n }\n },\n \"splits\": [\n {\n \"ledger_name\": \"Sales Tax Payable\",\n \"percentage\": 8.875\n },\n {\n \"ledger_name\": \"Bank Fees\",\n \"percentage\": 10\n }\n ],\n \"tags\": {\n \"Job\": [\n {\n \"percentage\": 60,\n \"value\": \"Maple Street Remodel\"\n },\n {\n \"percentage\": 40,\n \"value\": \"Oak Avenue Deck\"\n }\n ],\n \"Location\": \"NYC\"\n }\n }\n ],\n \"auto_confirm\": true,\n \"is_active\": true\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.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\n \"target_ledger_name\": \"Software Expenses\",\n \"conditions\": {\n \"amount\": {\n \"value\": 100,\n \"max_value\": 250\n },\n \"date\": {\n \"value\": \"2023-12-25\",\n \"max_value\": \"2023-12-25\"\n }\n },\n \"splits\": [\n {\n \"ledger_name\": \"Sales Tax Payable\",\n \"percentage\": 8.875\n },\n {\n \"ledger_name\": \"Bank Fees\",\n \"percentage\": 10\n }\n ],\n \"tags\": {\n \"Job\": [\n {\n \"percentage\": 60,\n \"value\": \"Maple Street Remodel\"\n },\n {\n \"percentage\": 40,\n \"value\": \"Oak Avenue Deck\"\n }\n ],\n \"Location\": \"NYC\"\n }\n }\n ],\n \"auto_confirm\": true,\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/tenant/rules/classifications/{rule_id}")
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 \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\n \"target_ledger_name\": \"Software Expenses\",\n \"conditions\": {\n \"amount\": {\n \"value\": 100,\n \"max_value\": 250\n },\n \"date\": {\n \"value\": \"2023-12-25\",\n \"max_value\": \"2023-12-25\"\n }\n },\n \"splits\": [\n {\n \"ledger_name\": \"Sales Tax Payable\",\n \"percentage\": 8.875\n },\n {\n \"ledger_name\": \"Bank Fees\",\n \"percentage\": 10\n }\n ],\n \"tags\": {\n \"Job\": [\n {\n \"percentage\": 60,\n \"value\": \"Maple Street Remodel\"\n },\n {\n \"percentage\": 40,\n \"value\": \"Oak Avenue Deck\"\n }\n ],\n \"Location\": \"NYC\"\n }\n }\n ],\n \"auto_confirm\": true,\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "clr_GA6EG2qFxA97NZHtxeLPUy",
"classifications": [
{
"conditions": {
"amount": {
"operator": "equals",
"value": 100,
"max_value": 250
},
"direction": "money_in",
"date": {
"operator": "equals",
"value": "2023-12-25",
"max_value": "2023-12-25"
}
},
"target_ledger_name": "<string>",
"splits": [
{
"ledger_name": "<string>",
"percentage": 123
}
],
"tags": {}
}
],
"auto_confirm": true,
"is_active": true,
"match_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"merchant": "Starbucks",
"description_match_type": "contains",
"description_value": "MONTHLY SOFTWARE SUBSCRIPTION",
"last_matched_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}