Skip to main content
PUT
/
v0
/
tags
/
rules
/
{tag_rule_id}
Update a tag rule
curl --request PUT \
  --url https://api.sandbox.teal.dev/v0/tags/rules/{tag_rule_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'teal-instance-id: <teal-instance-id>' \
  --data '
{
  "name": "Tag gas expense",
  "tag_id": "Tag gas expense",
  "expression": "match(\".*(?i)SHELL GAS\", t.description)",
  "priority": 10
}
'
import requests

url = "https://api.sandbox.teal.dev/v0/tags/rules/{tag_rule_id}"

payload = {
"name": "Tag gas expense",
"tag_id": "Tag gas expense",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"priority": 10
}
headers = {
"teal-instance-id": "<teal-instance-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {
'teal-instance-id': '<teal-instance-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Tag gas expense',
tag_id: 'Tag gas expense',
expression: 'match(".*(?i)SHELL GAS", t.description)',
priority: 10
})
};

fetch('https://api.sandbox.teal.dev/v0/tags/rules/{tag_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.teal.dev/v0/tags/rules/{tag_rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Tag gas expense',
'tag_id' => 'Tag gas expense',
'expression' => 'match(".*(?i)SHELL GAS", t.description)',
'priority' => 10
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"teal-instance-id: <teal-instance-id>"
],
]);

$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.teal.dev/v0/tags/rules/{tag_rule_id}"

payload := strings.NewReader("{\n \"name\": \"Tag gas expense\",\n \"tag_id\": \"Tag gas expense\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("teal-instance-id", "<teal-instance-id>")
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.put("https://api.sandbox.teal.dev/v0/tags/rules/{tag_rule_id}")
.header("teal-instance-id", "<teal-instance-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Tag gas expense\",\n \"tag_id\": \"Tag gas expense\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.teal.dev/v0/tags/rules/{tag_rule_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["teal-instance-id"] = '<teal-instance-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Tag gas expense\",\n \"tag_id\": \"Tag gas expense\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}"

response = http.request(request)
puts response.read_body
{
  "message": "<string>",
  "data": "<unknown>",
  "display_message": "<string>"
}
{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>"
}
{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>"
}
{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer , where is your auth token.

Headers

teal-instance-id
string
required

The teal instance ID

modified-by
string | null

An optional identifier for audit logging.

Path Parameters

tag_rule_id
string
required

The tag ID

Body

application/json
name
string | null

An arbitrary string, useful for identifying the tag rule.

Example:

"Tag gas expense"

tag_id
string | null

An arbitrary string, useful for identifying the tag rule.

Example:

"Tag gas expense"

expression
string | null

A pattern matching expression using the match(pattern, field) function. Use t to access the Transaction object. The pattern supports regular expression syntax.

Read more: Categorization guide

Example:

"match(\".*(?i)SHELL GAS\", t.description)"

priority
integer | null

The priority of the rule.

Example:

10

Response

Successful Response