Correct Enrichment

Correct Enrichment

Manually update the enrichment categories for a specific transaction. The transaction will be updated with your corrections, which are then used to refine future categorizations. This endpoint returns the updated transaction, along with similar past transactions, using the same format as when retrieving transactions for a link.

URL

POST
/links/{id}/transactions/{txn_id}/enrichment
Request
curl --request POST \
--url https://api.moneykit.com/links/[id]/transactions/[txn_id]/enrichment \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"category":"banking","subcategory":"account_fees_and_other_bank_charges"}'
const options = {
method: 'POST',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN',
'content-type': 'application/json'
},
body: '{"category":"banking","subcategory":"account_fees_and_other_bank_charges"}'
};

fetch('https://api.moneykit.com/links/[id]/transactions/[txn_id]/enrichment', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests

url = "https://api.moneykit.com/links/[id]/transactions/[txn_id]/enrichment"

payload = {
"category": "banking",
"subcategory": "account_fees_and_other_bank_charges"
}
headers = {
"Authorization": "Bearer REPLACE_BEARER_TOKEN",
"content-type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.moneykit.com/links/[id]/transactions/[txn_id]/enrichment"

payload := strings.NewReader("{\"category\":\"banking\",\"subcategory\":\"account_fees_and_other_bank_charges\"}")

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

req.Header.Add("Authorization", "Bearer REPLACE_BEARER_TOKEN")
req.Header.Add("content-type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.moneykit.com/links/[id]/transactions/[txn_id]/enrichment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer REPLACE_BEARER_TOKEN'
request["content-type"] = 'application/json'
request.body = "{\"category\":\"banking\",\"subcategory\":\"account_fees_and_other_bank_charges\"}"

response = http.request(request)
puts response.read_body
import Foundation

let headers = [
"Authorization": "Bearer REPLACE_BEARER_TOKEN",
"content-type": "application/json"
]
let parameters = [
"category": "banking",
"subcategory": "account_fees_and_other_bank_charges"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moneykit.com/links/[id]/transactions/[txn_id]/enrichment")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})

dataTask.resume()
Response
{
"transactions": [
{
"transaction_id": "c7318ff7-257c-490e-8242-03a815b223b7",
"account_id": "acc_6Tef269B6ZArSVpYrxtjBV",
"amount": 384.05,
"type": "debit",
"currency": "USD",
"date": "2023-02-16T00:00:00",
"datetime": "2023-02-16T09:14:11",
"description": "Regina's Mulberry",
"raw_description": "Regina's Mulberry #1402 T48999-84",
"pending": true,
"enrichment": {
"category": {
"value": "food_and_drink",
"confidence": 99
},
"subcategory": {
"value": "coffee",
"confidence": 99
},
"merchant": {
"id": "a0822a4f-a59b-4fc9-a768-d880da5bd090",
"name": "Starbucks",
"logo": "https://example.com/starbucks.png",
"confidence": 99
},
"processor": {
"id": "a0822a4f-a59b-4fc9-a768-d880da5bd090",
"name": "Square",
"logo": "https://example.com/square.png",
"confidence": 99
},
"recurrence": {
"frequency": "monthly",
"next_predicted_date": "2024-08-03"
}
},
"original_id": string
}
],
"accounts": [
{
"account_id": "acc_6Tef269B6ZArSVpYrxtjBV",
"account_type": "depository.checking",
"name": "Premier Checking",
"nickname": "John's Account",
"account_mask": "3748",
"balances": {
"currency": "USD",
"available": 340.12,
"current": 445.89,
"limit": 500,
"balance_date": "2021-08-12T15:23:00Z"
},
"original_id": null,
"closed": true
}
],
"link": {
"link_id": "mk_eqkWN34UEoa2NxyALG8pcV",
"institution_id": "chase",
"institution_name": "Chase",
"institution_avatar": "https://example.com/avatar.png",
"state": "connected",
"error_code": null,
"link_tags": [
"smoke_test",
"user_type:admin"
],
"webhook": "https://example.com/webhook",
"products": {
"accounts": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"account_numbers": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"identity": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"transactions": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"investments": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
},
"enrichment": {
"refreshed_at": "2023-02-16T09:14:11",
"last_attempted_at": "2023-02-16T09:14:11",
"error_code": "rate_limit",
"error_message": string,
"unavailable": string
}
},
"available_products": [
"account_numbers"
]
},
"cursor": {
"next": "c2FtcGxlIGN1cnNvcg=="
}
}
{
"error_code": "api_error.auth.expired_access_token",
"error_message": "Access token expired",
"documentation_url": string
}
{
"error_code": "link_error.forbidden_action",
"error_message": "Accounts access not permitted",
"documentation_url": string
}
{
"error_code": "link_error.not_found",
"error_message": "Link not found.",
"documentation_url": string
}
{
"error_code": "link_error.deleted",
"error_message": "This link was deleted at some earlier time.",
"documentation_url": string
}
{
"error_code": "link_error.bad_state",
"error_message": string,
"documentation_url": string,
"link_error_code": string
}
{
"error_code": "api_error.rate_limit_exceeded",
"error_message": "Rate limit exceeded",
"documentation_url": string
}

category

: string

required

Allowed values:

banking

borrowing_and_loans

charity

dependent_costs

education

entertainment

expenses

food_and_drink

gambling_and_lotteries

general

health_and_personal_care

home

income

insurance

media_and_telecoms

mortgage_and_rent

pensions_savings_and_investments

shopping

taxes

transfers

transport

travel

utilities

subcategory

Allowed values:

account_fees_and_other_bank_charges

atm_fees

cash_withdrawals

currency_exchange_and_fees

interest

nsf_and_overdraft_fees

other_banking

outgoing_checks

overdraft_protection

refunds_and_reversals

unpaid_transactions

buy_now_pay_later

car_payment

cash_advance_loans

credit_cards

debt_management

loan_incoming

loan_repayment

other_borrowing_and_loans

student_loan

vehicle_loan

charity

other_charity

child_support

childcare

childrens_expenses

other_dependent_costs

driving_lessons

other_education

university_and_tuition

books_and_reading

cinema

gaming

leisure_and_amusement_activities

other_entertainment

other_events

sport_events

theatre_concerts_and_tickets

business_expenses

financial_and_legal_expenses

other_expenses

other_memberships_and_services

postage_and_office_supplies

bars_and_pubs

coffee

convenience_stores

eating_out_and_takeaways

groceries

other_eating_out

other_food_and_drink

speciality_food_and_drink

gambling_and_betting

lotteries_and_sweepstakes

other_gambling_and_lotteries

other_general

beauty

dental

gym_and_fitness

healthcare

other_health_and_personal_care

optical

pharmacies_and_health_products

sport_accessories_and_equipment

furniture

gardening

home_maintenance

household_goods

laundry

other_home

pets

benefits_and_social_security

child_support_income

crypto_platform_incoming

deposits

employment_income

investment_income

other_income

pension_income

rental_income

business_insurance

health_and_life_insurance

home_insurance

other_insurance

pet_insurance

travel_insurance

vehicle_insurance

broadband_phone_tv

digital_media_and_software

other_media_and_telecoms

tv_streaming_services

mortgage

other_mortgage_and_rent

rent

crypto_platform_outgoing

investments

pensions

other_pensions_savings_and_investments

savings

clothing_and_accessories

department_stores

electronics_appliances_and_technology

flowers_and_gifts

general_online_shopping

hobbies

other_shopping

smoking_and_vaping

federal_tax

other_taxes

internal_transfers

other_transfers

transfers_in

transfers_out

other_transport

parking_and_tolls

public_transport

taxi

vehicle

vehicle_fuel_and_charging

vehicle_rental

petrol_and_vehicle_charging

flights_and_airport_expenses

holiday_and_travel_expenses

other_travel

other_utilities

utilities_energy

utilities_water_and_sewage

waste_and_recycling

id

: string

required

The unique ID for this link.

example: mk_eqkWN34UEoa2NxyALG8pcV

txn_id

: string

required

Responses

200

Successful Response

transactions

: array

A list of transactions.

accounts

: array

A list of accounts for which transactions are being returned.

cursor

: object

Pagination information

403

Forbidden by link owner. The user did not give permission to access this data when linking.

error_code

: string

default: "link_error.forbidden_action"

Allowed values:

link_error.forbidden_action

error_message

: string

Error message

example: Accounts access not permitted

documentation_url

: string

404

Link not found.

error_code

: string

default: "link_error.not_found"

Allowed values:

link_error.not_found

error_message

: string

default: "Link not found."

documentation_url

: string

410

Link deleted.

error_code

: string

default: "link_error.deleted"

Allowed values:

link_error.deleted

error_message

: string

default: "This link was deleted at some earlier time."

documentation_url

: string

422

Link error.

error_code

: string

default: "link_error.bad_state"

Allowed values:

link_error.bad_state

error_message

: string

documentation_url

: string

429

Rate limit exceeded.

error_code

: string

default: "api_error.rate_limit_exceeded"

Allowed values:

api_error.rate_limit_exceeded

error_message

: string

Error message

default: "Rate limit exceeded"

documentation_url

: string