An example of a transaction review page

The goal of categorizing transactions is to ensure that your user’s accounting reports are accurate. Teal’s auto-categorization pipeline streamlines much of this tedious process, but there are times where you will want to prompt your users to confirm some transactions.

We call this key accounting workflow Reviewing Transactions, and versions of this workflow exist in most popular accounting products. Using a combination of the Transactions and Ledger endpoints, you can build a customizable transaction review workflow for your users.


Implementation example

1

Display a list of Transactions for review

Display the transactions that you want your users to review. In this example, all transactions with review_status = unreviewed are displayed. This is the default status for all newly created transactions.

Use the Get Categorized Transactions endpoint with the ledger_id of a specific ledger to get a list of all unreviewed transactions.

const options = {
	method: 'GET',
	headers: {
		Authorization: AUTHORIZATION_KEY
		'teal-instance-id': TEAL_INSTANCE_ID,
	}
};
const ledger_id = 12345;

const request = await fetch(`https://api.sandbox.teal.dev/v0/ledgers/${ledger_id}/transactions/categories?review_status=unreviewed`, options)
const data = await request.json();

Display these to the user by iterating over data.records.

2

Update the category (Optional)

Sometimes a user needs to change how a Transaction is categorized. To do this, you need a list of all Ledgers and then allow the user to select which one they would like to assign as the new category.

  1. Use the Get Ledgers endpoint to retrieve all Ledgers.
const options = {
	method: 'GET',
	headers: {
		Authorization: AUTHORIZATION_KEY,
		'teal-instance-id': TEAL_INSTANCE_ID
	}
};
const request = await fetch(`https://api.sandbox.teal.dev/v0/ledgers`, options)
const data = await request.json();

Display the possible ledgers in a <select> element by iterating over data.records.

  1. After a user has selected a category, submit the ledger_id of the new category to the Recategorize Transaction endpoint.
const selected_ledger_id = '67890';

const options = {
	method: 'PUT',
	headers: {
		Authorization: AUTHORIZATION_KEY,
		'Content-Type': 'application/json',
		'teal-instance-id': TEAL_INSTANCE_ID
	},
	body: {
		"updated_category_ledger_id": selected_ledger_id
	}
};
const ledger_id = 12345;

const request = await fetch(`https://api.sandbox.teal.dev/v0/ledgers/${ledger_id}/transactions/${transaction_id}/categories`, options)
const response = await request.json();
3

Confirm the Transaction and remove from the list

Once the user has reviewed the transaction and confirm the category, update the Transaction review_status from unreviewed to reviewed using the Update Transaction Status endpoint with ledger_id and transaction_id, passing along the new review status.

const options = {
	method: 'PUT',
	headers: {
		Authorization: AUTHORIZATION_KEY,
		'Content-Type': 'application/json',
		'teal-instance-id': TEAL_INSTANCE_ID
	},
	body: {
		"review_status": "reviewed"
	}
};

const request = await fetch(`https://api.sandbox.teal.dev/v0/ledgers/${ledger_id}/transactions/${transaction_id}`, options);
const response = await request.json();

Notes

  • When a Transaction is processed in Teal’s auto-categorization pipeline and it does not match any ledger, it will be categorized as either an uncategorized cash inflow or uncategorized cash outflow. You can choose to only display transactions with these categories in your review list.
  • Coming soon: the ability to apply more granular filters to transactions based on the auto-categorization method applied.

Relevant resources