> For the complete documentation index, see [llms.txt](https://docs.kick.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kick.co/api/ai-categorization.md).

# AI Categorization

How Kick assigns each transaction to an account, and what your integration does to set up and steer each source of categorization.

Kick assigns every transaction imported from a bank feed to an account in the entity's Chart of Accounts. It has three sources: the transaction's own metadata, the entity's migrated history, and the categorizations made once the bank feed is live.

***

### How Kick decides which categorization to use

When a transaction comes in, Kick checks these in order and stops at the first match:

1. Rules created in Kick by a user (such as the accountant or business owner) or through the [Transaction Rules API](/api/api-reference/transaction-rules.md)
2. Rules Kick built from the entity's migrated history
3. AI categorization, based on the transaction's description and amount

An account a person assigned, in Kick or by updating the transaction's `accountId` through the API, is never changed automatically.

***

### 1. Categorization from transaction metadata

When a transaction is imported, Kick reads its bank description, amount, and direction (cash in or cash out), identifies the counterparty, and assigns the account the transaction belongs to. This needs no history, so it applies from the entity's first transaction.

What you set up first depends on the chart of accounts the entity was created with:

| Chart of accounts                     | Setup                                                                                                |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `{ "type": "standard" }`, the default | None. Kick's categories map to the accounts it seeds, so categorization works out of the box         |
| `{ "type": "custom" }`                | Create the entity's accounts, then call prepare categorization so Kick maps its categories onto them |

→ [Entities](/api/api-reference/entities.md)

On a custom chart of accounts, call prepare categorization once the entity's accounts exist. Kick only categorizes transactions that are still uncategorized. It never changes a category that's already been assigned. The request has no body:

```bash
curl -X POST https://use.kick.co/api/platform/v1/entities/0192f3a4-7c1e-7b2d-9f40-5d8e6a1b3c27/chart-of-accounts/prepare-categorization \
  -H "Authorization: Bearer kick_org_..." \
  -H "Idempotency-Key: 7b2e4c9a-1d5f-4a83-b6e0-3c8d9f1a2e57"
```

Kick answers `202` and maps the categories in the background. Automatic categorization for the entity is paused until the mapping finishes. Once mapping finishes, Kick categorizes the entity's existing uncategorized transactions and new transactions going forward.

* **Adding accounts later.** Call it again. Categories that are already mapped keep their account.
* **`409`**. A mapping for the entity is still running. Wait for it to finish, then retry.
* **`422`**. The entity is on the standard chart of accounts, which doesn't need the call.

To see what Kick categorized, open **Activity** in Kick and select the 'Kick updated cash ledger' row.

→ [Chart of Accounts](/api/api-reference/chart-of-accounts.md)

***

### 2. Categorization from historical data

When you move an entity from another accounting system, Kick builds rules from the migrated journal entries. Lines with similar descriptions form a group, and each group gets a rule that assigns the account the old books used most often. New transactions that match a rule get that account, so categorization follows the entity's existing books from day one.

→ [Migration](/api/migration.md)

***

### 3. Learning from ongoing categorization

Kick learns the entity's patterns from the transactions already categorized in it, including the ones you recategorize. Kick learns separately for each entity, so categorizations in one workspace don't affect another.

To recategorize a transaction, update its `accountId`:

```bash
curl -X PATCH https://use.kick.co/api/platform/v1/workspaces/0192f3a2-9e6b-7d14-a8c3-4f0b2d7e1c95/transactions/0192f3c7-3a1e-7f58-9d2b-6e4c0a8f1b73 \
  -H "Authorization: Bearer kick_org_..." \
  -H "Content-Type: application/json" \
  -d '{ "accountId": "0192f3a6-2e4c-7a18-b3d5-8f1a6c0e9b47" }'
```

→ [Transactions](/api/api-reference/transactions.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kick.co/api/ai-categorization.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
