Mouser provides two separate API keys:
- one for the cart and orders
- one for part searches.
Go to Mouser's API hub to request the keys.
To store the keys, two options:
- create two environmental variables
MOUSER_ORDER_API_KEYandMOUSER_PART_API_KEYwith the respective values of each key - create a file named
mouser_api_keys.yamlwith the order API key on the first line and the part API key on a second line.
⚠️ Using themouser_api_keys.yamlfile method, make sure to runmousercommands in the same folder!
The keys will be automatically loaded for each API request.
pip install mouser- Install
uv:pip install uv - Create virtual environment:
uv venv - Activate the virtual environment:
source .venv/bin/activate(Linux/Mac) or.venv\Scripts\activate(Windows) - Install the package:
uv pip install -e .
To install with development dependencies:
uv pip install -e ".[dev]"mouserpython mouser_cli.py# After activating the virtual environment
mouserThis command line tool reflects the usage from Mouser's API structure documented here.
The first positional argument is the category of the request: cart (for MouserCart), order, history (for MouserOrderHistory) and search (for SearchAPI).
The second argument is the type of operation from the list of operations for each category.
Run mouser --help for more information about the usage.
The examples below assume this package was installed using Pip (for more options, see above)
mouser search partnumber --number XXXmouser order get --number XXX --export