Replace transaction categories
Replace all categories on a transaction with a new set of categories.
curl --request PUT \
--url https://api.ai2fin.com/api/transaction-categories/{transactionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"categories": [
{
"categoryId": "<string>",
"categorySetId": "<string>",
"isPrimary": true,
"confidence": 123,
"assignedBy": "<string>"
}
]
}
'import requests
url = "https://api.ai2fin.com/api/transaction-categories/{transactionId}"
payload = { "categories": [
{
"categoryId": "<string>",
"categorySetId": "<string>",
"isPrimary": True,
"confidence": 123,
"assignedBy": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
categories: [
{
categoryId: '<string>',
categorySetId: '<string>',
isPrimary: true,
confidence: 123,
assignedBy: '<string>'
}
]
})
};
fetch('https://api.ai2fin.com/api/transaction-categories/{transactionId}', 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.ai2fin.com/api/transaction-categories/{transactionId}",
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([
'categories' => [
[
'categoryId' => '<string>',
'categorySetId' => '<string>',
'isPrimary' => true,
'confidence' => 123,
'assignedBy' => '<string>'
]
]
]),
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.ai2fin.com/api/transaction-categories/{transactionId}"
payload := strings.NewReader("{\n \"categories\": [\n {\n \"categoryId\": \"<string>\",\n \"categorySetId\": \"<string>\",\n \"isPrimary\": true,\n \"confidence\": 123,\n \"assignedBy\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.ai2fin.com/api/transaction-categories/{transactionId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"categories\": [\n {\n \"categoryId\": \"<string>\",\n \"categorySetId\": \"<string>\",\n \"isPrimary\": true,\n \"confidence\": 123,\n \"assignedBy\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ai2fin.com/api/transaction-categories/{transactionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"categories\": [\n {\n \"categoryId\": \"<string>\",\n \"categorySetId\": \"<string>\",\n \"isPrimary\": true,\n \"confidence\": 123,\n \"assignedBy\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"categories": [
{
"id": "<string>",
"transactionId": "<string>",
"categoryId": "<string>",
"categorySetId": "<string>",
"userId": "<string>",
"isPrimary": true,
"confidence": 0.5,
"assignedBy": "user",
"assignedAt": "2023-11-07T05:31:56Z",
"notes": "<string>",
"category": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"color": "<string>",
"icon": "<string>",
"emoji": "<string>",
"description": "<string>",
"isActive": true,
"categorySetId": "<string>",
"taxTreatment": "<string>"
}
}
]
}{
"success": false,
"error": "Description, amount, and date are required"
}{
"success": false,
"error": "Access token required"
}{
"success": false,
"error": "Access denied",
"message": "Feature not available in plan: automations",
"requiredPlan": "auto+"
}{
"success": false,
"error": "Idempotency-Key already used with a different request body",
"hint": "Generate a new Idempotency-Key for each unique request"
}{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Try again in 20 seconds.",
"retryAfter": 20,
"limit": 2000,
"windowMs": 900000
}Authorizations
First-party access token for your own signed-in session, obtained from the /api/enterprise-auth/login endpoint. The REST API returns your own account data to you — it is a first-party consumer surface, not a third-party integration channel. Data from connected bank feeds (open-banking / CDR data) is your own data, returned only to you in your own authenticated session.
Headers
Optional. Any string of at most 256 characters (a UUID is a good choice). The first response to a POST, PUT or PATCH carrying this key is stored for 24 hours, scoped to your account; repeating the request with the same key and the same body returns that stored response (with Idempotency-Replay: true) instead of running the request again. The same key with a different body returns 409. A key longer than 256 characters returns 400. Whatever the first response was, including an error, is what is replayed. The store is held in memory on the server instance that answered, so it does not survive a restart and is not shared between instances: treat it as protection against quick retries, not as a durable guarantee.
256Was this page helpful?
curl --request PUT \
--url https://api.ai2fin.com/api/transaction-categories/{transactionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"categories": [
{
"categoryId": "<string>",
"categorySetId": "<string>",
"isPrimary": true,
"confidence": 123,
"assignedBy": "<string>"
}
]
}
'import requests
url = "https://api.ai2fin.com/api/transaction-categories/{transactionId}"
payload = { "categories": [
{
"categoryId": "<string>",
"categorySetId": "<string>",
"isPrimary": True,
"confidence": 123,
"assignedBy": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
categories: [
{
categoryId: '<string>',
categorySetId: '<string>',
isPrimary: true,
confidence: 123,
assignedBy: '<string>'
}
]
})
};
fetch('https://api.ai2fin.com/api/transaction-categories/{transactionId}', 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.ai2fin.com/api/transaction-categories/{transactionId}",
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([
'categories' => [
[
'categoryId' => '<string>',
'categorySetId' => '<string>',
'isPrimary' => true,
'confidence' => 123,
'assignedBy' => '<string>'
]
]
]),
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.ai2fin.com/api/transaction-categories/{transactionId}"
payload := strings.NewReader("{\n \"categories\": [\n {\n \"categoryId\": \"<string>\",\n \"categorySetId\": \"<string>\",\n \"isPrimary\": true,\n \"confidence\": 123,\n \"assignedBy\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.ai2fin.com/api/transaction-categories/{transactionId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"categories\": [\n {\n \"categoryId\": \"<string>\",\n \"categorySetId\": \"<string>\",\n \"isPrimary\": true,\n \"confidence\": 123,\n \"assignedBy\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ai2fin.com/api/transaction-categories/{transactionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"categories\": [\n {\n \"categoryId\": \"<string>\",\n \"categorySetId\": \"<string>\",\n \"isPrimary\": true,\n \"confidence\": 123,\n \"assignedBy\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"categories": [
{
"id": "<string>",
"transactionId": "<string>",
"categoryId": "<string>",
"categorySetId": "<string>",
"userId": "<string>",
"isPrimary": true,
"confidence": 0.5,
"assignedBy": "user",
"assignedAt": "2023-11-07T05:31:56Z",
"notes": "<string>",
"category": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"color": "<string>",
"icon": "<string>",
"emoji": "<string>",
"description": "<string>",
"isActive": true,
"categorySetId": "<string>",
"taxTreatment": "<string>"
}
}
]
}{
"success": false,
"error": "Description, amount, and date are required"
}{
"success": false,
"error": "Access token required"
}{
"success": false,
"error": "Access denied",
"message": "Feature not available in plan: automations",
"requiredPlan": "auto+"
}{
"success": false,
"error": "Idempotency-Key already used with a different request body",
"hint": "Generate a new Idempotency-Key for each unique request"
}{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Try again in 20 seconds.",
"retryAfter": 20,
"limit": 2000,
"windowMs": 900000
}