curl --request POST \
--url https://api.sandbox.teal.dev/v0/platform/categorization/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"ledger_name": "Fuel Expenses",
"name": "Shell to Fuel Expenses",
"priority": "100"
}
'import requests
url = "https://api.sandbox.teal.dev/v0/platform/categorization/rules"
payload = {
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"ledger_name": "Fuel Expenses",
"name": "Shell to Fuel Expenses",
"priority": "100"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expression: 'match(".*(?i)SHELL GAS", t.description)',
ledger_name: 'Fuel Expenses',
name: 'Shell to Fuel Expenses',
priority: '100'
})
};
fetch('https://api.sandbox.teal.dev/v0/platform/categorization/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/platform/categorization/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([
'expression' => 'match(".*(?i)SHELL GAS", t.description)',
'ledger_name' => 'Fuel Expenses',
'name' => 'Shell to Fuel Expenses',
'priority' => '100'
]),
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.teal.dev/v0/platform/categorization/rules"
payload := strings.NewReader("{\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"ledger_name\": \"Fuel Expenses\",\n \"name\": \"Shell to Fuel Expenses\",\n \"priority\": \"100\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sandbox.teal.dev/v0/platform/categorization/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"ledger_name\": \"Fuel Expenses\",\n \"name\": \"Shell to Fuel Expenses\",\n \"priority\": \"100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.teal.dev/v0/platform/categorization/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"ledger_name\": \"Fuel Expenses\",\n \"name\": \"Shell to Fuel Expenses\",\n \"priority\": \"100\"\n}"
response = http.request(request)
puts response.read_body{
"id": "N6ntpvTtiA4L31vVyVat5n",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"ledger_name": "Fuel Expenses",
"name": "Shell to Fuel Expenses",
"priority": "100"
}{
"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 Platform rule
Creates a new Platform categorization rule.
curl --request POST \
--url https://api.sandbox.teal.dev/v0/platform/categorization/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"ledger_name": "Fuel Expenses",
"name": "Shell to Fuel Expenses",
"priority": "100"
}
'import requests
url = "https://api.sandbox.teal.dev/v0/platform/categorization/rules"
payload = {
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"ledger_name": "Fuel Expenses",
"name": "Shell to Fuel Expenses",
"priority": "100"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expression: 'match(".*(?i)SHELL GAS", t.description)',
ledger_name: 'Fuel Expenses',
name: 'Shell to Fuel Expenses',
priority: '100'
})
};
fetch('https://api.sandbox.teal.dev/v0/platform/categorization/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/platform/categorization/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([
'expression' => 'match(".*(?i)SHELL GAS", t.description)',
'ledger_name' => 'Fuel Expenses',
'name' => 'Shell to Fuel Expenses',
'priority' => '100'
]),
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.teal.dev/v0/platform/categorization/rules"
payload := strings.NewReader("{\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"ledger_name\": \"Fuel Expenses\",\n \"name\": \"Shell to Fuel Expenses\",\n \"priority\": \"100\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sandbox.teal.dev/v0/platform/categorization/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"ledger_name\": \"Fuel Expenses\",\n \"name\": \"Shell to Fuel Expenses\",\n \"priority\": \"100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.teal.dev/v0/platform/categorization/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expression\": \"match(\\\".*(?i)SHELL GAS\\\", t.description)\",\n \"ledger_name\": \"Fuel Expenses\",\n \"name\": \"Shell to Fuel Expenses\",\n \"priority\": \"100\"\n}"
response = http.request(request)
puts response.read_body{
"id": "N6ntpvTtiA4L31vVyVat5n",
"expression": "match(\".*(?i)SHELL GAS\", t.description)",
"ledger_name": "Fuel Expenses",
"name": "Shell to Fuel Expenses",
"priority": "100"
}{
"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.
Body
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 name of the destination ledger.
"Fuel Expenses"
An arbitrary string to name the rule.
"Shell to Fuel Expenses"
The priority of the rule.
"100"
Response
Successful Response
The unique ID of the object.
"N6ntpvTtiA4L31vVyVat5n"
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 name of the destination ledger.
"Fuel Expenses"
An arbitrary string to name the rule.
"Shell to Fuel Expenses"
The priority of the rule.
"100"