curl --request POST \
--url https://api.sandbox.teal.dev/v0/tags/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'teal-instance-id: <teal-instance-id>' \
--data '
{
"name": "Tag gas expense",
"tag_id": "NCB2xo5S1yQbNgyWskXpwG",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"priority": 10
}
'import requests
url = "https://api.sandbox.teal.dev/v0/tags/rules"
payload = {
"name": "Tag gas expense",
"tag_id": "NCB2xo5S1yQbNgyWskXpwG",
"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.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'teal-instance-id': '<teal-instance-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Tag gas expense',
tag_id: 'NCB2xo5S1yQbNgyWskXpwG',
expression: 'match(".*(?i)SHELL GAS", t.description)',
priority: 10
})
};
fetch('https://api.sandbox.teal.dev/v0/tags/rules', 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",
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' => 'Tag gas expense',
'tag_id' => 'NCB2xo5S1yQbNgyWskXpwG',
'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"
payload := strings.NewReader("{\n \"name\": \"Tag gas expense\",\n \"tag_id\": \"NCB2xo5S1yQbNgyWskXpwG\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sandbox.teal.dev/v0/tags/rules")
.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\": \"NCB2xo5S1yQbNgyWskXpwG\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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\": \"NCB2xo5S1yQbNgyWskXpwG\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}"
response = http.request(request)
puts response.read_body{
"id": "yB2xokXpQb5S1NgyWsNCwG",
"name": "Tag gas expense",
"tag_id": "NCB2xo5S1yQbNgyWskXpwG",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"priority": 10
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}Create a tag rule
Creates a new tag rule for an existing instance.
curl --request POST \
--url https://api.sandbox.teal.dev/v0/tags/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'teal-instance-id: <teal-instance-id>' \
--data '
{
"name": "Tag gas expense",
"tag_id": "NCB2xo5S1yQbNgyWskXpwG",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"priority": 10
}
'import requests
url = "https://api.sandbox.teal.dev/v0/tags/rules"
payload = {
"name": "Tag gas expense",
"tag_id": "NCB2xo5S1yQbNgyWskXpwG",
"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.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'teal-instance-id': '<teal-instance-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Tag gas expense',
tag_id: 'NCB2xo5S1yQbNgyWskXpwG',
expression: 'match(".*(?i)SHELL GAS", t.description)',
priority: 10
})
};
fetch('https://api.sandbox.teal.dev/v0/tags/rules', 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",
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' => 'Tag gas expense',
'tag_id' => 'NCB2xo5S1yQbNgyWskXpwG',
'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"
payload := strings.NewReader("{\n \"name\": \"Tag gas expense\",\n \"tag_id\": \"NCB2xo5S1yQbNgyWskXpwG\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sandbox.teal.dev/v0/tags/rules")
.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\": \"NCB2xo5S1yQbNgyWskXpwG\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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\": \"NCB2xo5S1yQbNgyWskXpwG\",\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"priority\": 10\n}"
response = http.request(request)
puts response.read_body{
"id": "yB2xokXpQb5S1NgyWsNCwG",
"name": "Tag gas expense",
"tag_id": "NCB2xo5S1yQbNgyWskXpwG",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"priority": 10
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}{
"message": "<string>",
"data": "<unknown>",
"display_message": "<string>",
"error_code": "invalid_date"
}Authorizations
Bearer authentication header of the form Bearer , where is your auth token.
Headers
The teal instance ID
An optional identifier for audit logging.
Body
An arbitrary string, useful for identifying the tag rule.
"Tag gas expense"
If the rule finds a match, the ID of the tag that will be assigned.
"NCB2xo5S1yQbNgyWskXpwG"
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
"match(\".*(?i)SHELL GAS\", t.description)"
The priority of the rule.
10
Response
Successful Response
The unique ID of the object.
"yB2xokXpQb5S1NgyWsNCwG"
An arbitrary string, useful for identifying the tag rule.
"Tag gas expense"
If the rule finds a match, the ID of the tag that will be assigned.
"NCB2xo5S1yQbNgyWskXpwG"
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
"match(\".*(?i)SHELL GAS\", t.description)"
The priority of the rule.
10