A Python package that assists in categorizing Amazon transactions in YNAB (You Need A Budget) with rich item information, automatic memo generation, and tab-completion for categories.
When you paste in the text from your Amazon order page:
π― Smart Order Matching: Automatically matches YNAB transactions with Amazon orders by amount and date
π Enhanced Memos: Generates detailed memos with item names and direct Amazon order links
π Intelligent Splitting: Suggests splitting transactions with multiple items into separate categories
β‘ Streamlined Workflow: Smart defaults and tab completion for fast categorization
π UTF-8 Support: Full emoji support in category names
π Rich Previews: Shows category names and transaction details before updating
- Python 3.12+ (recommended; 3.10+ supported)
- uv (recommended) or standard Python tooling
- YNAB account with API access
# Run directly without installing (fastest and cleanest)
uvx ynab-amazon-categorizer# Install globally with uv
uv tool install ynab-amazon-categorizer
# Then run
ynab-amazon-categorizer# Clone the repository
git clone https://github.com/dizzlkheinz/ynab-amazon-categorizer.git
cd ynab-amazon-categorizer
# Install in development mode
uv pip install -e .After installation, you'll need to set up your YNAB API credentials:
Create a .env file in your working directory with your credentials:
YNAB_API_KEY=your_api_key_here
YNAB_BUDGET_ID=your_budget_id_here
YNAB_ACCOUNT_ID=none
# Windows
set YNAB_API_KEY=your_api_key_here
set YNAB_BUDGET_ID=your_budget_id_here
# Mac/Linux
export YNAB_API_KEY=your_api_key_here
export YNAB_BUDGET_ID=your_budget_id_here- Go to YNAB Developer Settings
- Click "New Token"
- Copy the generated token
- Open your budget in YNAB
- Look at the URL:
https://app.ynab.com/[budget_id]/budget - Copy the budget_id part
- Click on a specific account in YNAB
- Look at the URL:
https://app.ynab.com/[budget_id]/accounts/[account_id] - Copy the account_id part (or leave as 'none' to process all accounts)
# Run with uvx (no installation needed)
uvx ynab-amazon-categorizer
# Or if installed as a tool
ynab-amazon-categorizer
# Or run as a Python module
python -m ynab_amazon_categorizer-
Provide Amazon Orders Data (optional but recommended):
- Copy your Amazon orders page content
- For example go to https://www.amazon.ca/gp/css/order-history?ref_=nav_orders_first and select all and copy the text
- Run the tool and paste Amazon order info when prompted
- The script will automatically match transactions with orders
- Copy your Amazon orders page content
-
Review Matched Transactions:
- The script shows order details, items, and links before asking to categorize
- For multiple items, it suggests splitting the transaction
-
Categorize Transactions:
- Use tab completion to select categories
- Accept suggested memos or customize them
- Confirm updates with enhanced previews
- Tab: Auto-complete category names
- Enter: Accept defaults (categorize, use suggested memo, confirm update)
- Alt+Enter: Submit multiline input (Amazon orders data, custom memos)
- Ctrl+C: Cancel current operation
π― MATCHED ORDER FOUND:
Order ID: 702-8237239-1234567
Total: $57.57
Date: July 31, 2025
Order Link: https://www.amazon.ca/gp/your-account/order-details?ie=UTF8&orderID=702-8237239-1234567
Items:
- Fancy Feast Grilled Wet Cat Food, Tuna Feast - 85 g Can (24 Pack)
- Fancy Feast Grilled Wet Cat Food, Salmon & Shrimp Feast in Gravy - 85 g Can (24 Pack)
Action? (c = categorize/split, s = skip, q = quit, default c):
There is more than one item in this transaction.
Split this transaction? (y/n, default n): y
Fancy Feast Grilled Wet Cat Food, Tuna Feast - 85 g Can (24 Pack)
https://www.amazon.ca/gp/your-account/order-details?ie=UTF8&orderID=702-8237239-0563450
2 Items:
- Fancy Feast Grilled Wet Cat Food, Tuna Feast - 85 g Can (24 Pack)
- Fancy Feast Grilled Wet Cat Food, Salmon & Shrimp Feast in Gravy - 85 g Can (24 Pack)
.env file to version control!
- The script loads credentials from environment variables or config file
- Your API key is never hardcoded in the script
- Add
.envto your.gitignoreif using git
- Make sure you're copying the full Amazon orders page content
- Try copying from a different browser or clearing browser cache
- Verify your
.envfile exists and has the correct format - Check that your API key is valid in YNAB Developer Settings
- Ensure you have uncategorized Amazon transactions in YNAB
- Check that the payee names contain "amazon", "amzn", or "amz"
- Use
python -X utf8on Windows for proper emoji support - Ensure your terminal supports UTF-8 encoding
This package was developed to streamline YNAB Amazon transaction categorization. Feel free to suggest improvements or report issues!
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.
Please respect YNAB's API terms of service when using this software.