Update a Classification Rule
Update a rule. Omitted fields keep their current values.
Scopes: classification_rule:update
curl --request PATCH \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/rules/classifications/{rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
},
"external_account_id": "eac_GA6EG2qFxA97NZHtxeLPUy"
},
"target_ledger_id": "ldg_GA6EG2qFxA97NZHtxeLPUy",
"tags": {
"Job": [
"Maple Street Remodel"
],
"Location": "NYC"
}
}
],
"auto_confirm": true,
"is_active": true
}
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/rules/classifications/{rule_id}"
payload = {
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
},
"external_account_id": "eac_GA6EG2qFxA97NZHtxeLPUy"
},
"target_ledger_id": "ldg_GA6EG2qFxA97NZHtxeLPUy",
"tags": {
"Job": ["Maple Street Remodel"],
"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: [
{
conditions: {
amount: {value: 100, max_value: 250},
date: {value: '2023-12-25', max_value: '2023-12-25'},
external_account_id: 'eac_GA6EG2qFxA97NZHtxeLPUy'
},
target_ledger_id: 'ldg_GA6EG2qFxA97NZHtxeLPUy',
tags: {Job: ['Maple Street Remodel'], Location: 'NYC'}
}
],
auto_confirm: true,
is_active: true
})
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/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/business/{business_id}/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' => [
[
'conditions' => [
'amount' => [
'value' => 100,
'max_value' => 250
],
'date' => [
'value' => '2023-12-25',
'max_value' => '2023-12-25'
],
'external_account_id' => 'eac_GA6EG2qFxA97NZHtxeLPUy'
],
'target_ledger_id' => 'ldg_GA6EG2qFxA97NZHtxeLPUy',
'tags' => [
'Job' => [
'Maple Street Remodel'
],
'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/business/{business_id}/rules/classifications/{rule_id}"
payload := strings.NewReader("{\n \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\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 \"external_account_id\": \"eac_GA6EG2qFxA97NZHtxeLPUy\"\n },\n \"target_ledger_id\": \"ldg_GA6EG2qFxA97NZHtxeLPUy\",\n \"tags\": {\n \"Job\": [\n \"Maple Street Remodel\"\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/business/{business_id}/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 \"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 \"external_account_id\": \"eac_GA6EG2qFxA97NZHtxeLPUy\"\n },\n \"target_ledger_id\": \"ldg_GA6EG2qFxA97NZHtxeLPUy\",\n \"tags\": {\n \"Job\": [\n \"Maple Street Remodel\"\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/business/{business_id}/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 \"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 \"external_account_id\": \"eac_GA6EG2qFxA97NZHtxeLPUy\"\n },\n \"target_ledger_id\": \"ldg_GA6EG2qFxA97NZHtxeLPUy\",\n \"tags\": {\n \"Job\": [\n \"Maple Street Remodel\"\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"
},
"external_account_id": "eac_GA6EG2qFxA97NZHtxeLPUy"
},
"tags": {},
"target_ledger_id": "<string>",
"target_ledger_name": "<string>"
}
],
"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.
Path Parameters
The id of the business
"biz_GA6EG2qFxA97NZHtxeLPUy"
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 that has a target ledger; tagging applies the tags of every one whose conditions match.
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/business/{business_id}/rules/classifications/{rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
},
"external_account_id": "eac_GA6EG2qFxA97NZHtxeLPUy"
},
"target_ledger_id": "ldg_GA6EG2qFxA97NZHtxeLPUy",
"tags": {
"Job": [
"Maple Street Remodel"
],
"Location": "NYC"
}
}
],
"auto_confirm": true,
"is_active": true
}
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/rules/classifications/{rule_id}"
payload = {
"merchant": "<string>",
"description_value": "<string>",
"classifications": [
{
"conditions": {
"amount": {
"value": 100,
"max_value": 250
},
"date": {
"value": "2023-12-25",
"max_value": "2023-12-25"
},
"external_account_id": "eac_GA6EG2qFxA97NZHtxeLPUy"
},
"target_ledger_id": "ldg_GA6EG2qFxA97NZHtxeLPUy",
"tags": {
"Job": ["Maple Street Remodel"],
"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: [
{
conditions: {
amount: {value: 100, max_value: 250},
date: {value: '2023-12-25', max_value: '2023-12-25'},
external_account_id: 'eac_GA6EG2qFxA97NZHtxeLPUy'
},
target_ledger_id: 'ldg_GA6EG2qFxA97NZHtxeLPUy',
tags: {Job: ['Maple Street Remodel'], Location: 'NYC'}
}
],
auto_confirm: true,
is_active: true
})
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/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/business/{business_id}/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' => [
[
'conditions' => [
'amount' => [
'value' => 100,
'max_value' => 250
],
'date' => [
'value' => '2023-12-25',
'max_value' => '2023-12-25'
],
'external_account_id' => 'eac_GA6EG2qFxA97NZHtxeLPUy'
],
'target_ledger_id' => 'ldg_GA6EG2qFxA97NZHtxeLPUy',
'tags' => [
'Job' => [
'Maple Street Remodel'
],
'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/business/{business_id}/rules/classifications/{rule_id}"
payload := strings.NewReader("{\n \"merchant\": \"<string>\",\n \"description_value\": \"<string>\",\n \"classifications\": [\n {\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 \"external_account_id\": \"eac_GA6EG2qFxA97NZHtxeLPUy\"\n },\n \"target_ledger_id\": \"ldg_GA6EG2qFxA97NZHtxeLPUy\",\n \"tags\": {\n \"Job\": [\n \"Maple Street Remodel\"\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/business/{business_id}/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 \"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 \"external_account_id\": \"eac_GA6EG2qFxA97NZHtxeLPUy\"\n },\n \"target_ledger_id\": \"ldg_GA6EG2qFxA97NZHtxeLPUy\",\n \"tags\": {\n \"Job\": [\n \"Maple Street Remodel\"\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/business/{business_id}/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 \"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 \"external_account_id\": \"eac_GA6EG2qFxA97NZHtxeLPUy\"\n },\n \"target_ledger_id\": \"ldg_GA6EG2qFxA97NZHtxeLPUy\",\n \"tags\": {\n \"Job\": [\n \"Maple Street Remodel\"\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"
},
"external_account_id": "eac_GA6EG2qFxA97NZHtxeLPUy"
},
"tags": {},
"target_ledger_id": "<string>",
"target_ledger_name": "<string>"
}
],
"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>"
}