> ## Documentation Index
> Fetch the complete documentation index at: https://docs.teal.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction Source Account

> This is a migration guide to switch from ledger transaction endpoints to transaction source account endpoints.

## Deprecated endpoints

* `GET /v0/ledgers/{ledger_id}/transactions/{transaction_id}`
* `GET /v0/ledgers/{ledger_id}/transactions`
* `POST /v0/ledgers/{ledger_id}/transactions`
* `DELETE /v0/ledgers/{ledger_id}/transactions/{transaction_id}`
* `DELETE /v0/ledgers/{ledger_id}/transactions`
* `GET /v0/ledgers/{ledger_id}/transactions/categories`
* `GET /v0/ledgers/{ledger_id}/transactions/{transaction_id}/categories`
* `PUT /v0/ledgers/{ledger_id}/transactions/categories`

## Overview

Transactions are no longer written into ledgers. They are instead written into transaction source accounts, which represents accounts within a transaction source (e.g. Plaid, Unit, etc.)

Transactions written into a transaction source accounts are automatically posted into the appropriate ledgers.

If you use our data integrations (Plaid, Unit, etc.) then transaction source accounts are automatically created during the account linking process. The transaction source account id will be returned in the response object as `source_account_id`.

## Endpoint migration

### `GET /v0/ledgers/{ledger_id}/transactions/{transaction_id}`

Use the [retrieve a transaction endpoint](/api-reference/transactions/retrieve-a-transaction).

`GET /v0/source-accounts/{source_account_id}/transactions/{transaction_id}`

### `GET /v0/ledgers/{ledger_id}/transactions`

Use the [list a transaction source account's transaction endpoint](/api-reference/transactions/list-a-source-account's-transactions).

`GET /v0/source-accounts/{source_account_id}/transactions`

### `POST /v0/ledgers/{ledger_id}/transactions`

If you are manually creating transactions into a ledger, you are acting as a transaction source. You must [create a transaction source account](/api-reference/transaction-sources/create-a-source-account) and set the `ledger_id` to the financial account ledger where you want the transactions posted.

Use the [create transactions endpoint](/api-reference/transactions/create-transactions) to create transactions into the transaction source account.

`POST /v0/source-accounts/{source_account_id}/transactions`

### `DELETE /v0/ledgers/{ledger_id}/transactions/{transaction_id}`

Use the [delete a transaction endpoint](/api-reference/transactions/delete-a-transaction).

`DELETE /v0/source-accounts/{source_account_id}/transactions/{transaction_id}`

### `DELETE /v0/ledgers/{ledger_id}/transactions`

Use the [delete all transactions in a source account endpoint](/api-reference/transactions/delete-all-transactions-in-a-source-account).

`DELETE /v0/source-accounts/{source_account_id}/transactions`

### `GET /v0/ledgers/{ledger_id}/transactions/categories`

We will no longer provide a specialized endpoint to get transaction with categories because this information is available in the [list transactions endpoint](/api-reference/transactions/list-a-source-account's-transactions).

In the request to list transactions, expand the opposing line entry ledgers (i.e. `expand=opposing_line_entries.ledger`). The returned transaction objects will be populated with the opposing line entries and its ledger. The returned ledgers are the categories.

`GET /v0/source-accounts/{source_account_id}/transactions?expand=opposing_line_entries.ledger`

### `GET /v0/ledgers/{ledger_id}/transactions/{transaction_id}/categories`

We will no longer provide a specialized endpoint to get a transaction's categories because this information is available in the [retrieve a transaction endpoint](/api-reference/transactions/retrieve-a-transaction).

In the request to retrieve a transaction, expand the opposing line entry ledgers (i.e. `expand=opposing_line_entries.ledger`). The returned transaction object will be populated with the opposing line entries and its ledger. The returned ledgers are the categories.

`GET /v0/source-accounts/{source_account_id}/transactions/{transaction_id}?expand=opposing_line_entries.ledger`

### `PUT /v0/ledgers/{ledger_id}/transactions/categories`

We will no longer provide a specialized endpoint to update a transaction's category. Instead, the [update transaction endpoint](/api-reference/transactions/update-a-transaction) can be used to perform this function.

## Getting transaction source accounts IDs

You may use the [get transaction source accounts](/api-reference/transaction-sources/get-transaction-source-accounts) to get a list of all transaction source accounts for an instance. The returned objects contain a `ledger_id` field which corresponds to the ledger where the transactions will be posted.
