-
Notifications
You must be signed in to change notification settings - Fork 0
T3 API : Getting Started
- Getting Started with the T3 API
- Next Steps
To take advantage of the T3 API, one only needs a basic knowledge of using the command line and running scripts. This knowledge can be picked up very quickly.
Note: The T3 API offers some free endpoints, but most will require a T3+ subscription.
The command line, also called the terminal or shell, is an interface that lets you interact with your computer using text commands. It’s especially useful for running programs like Python without needing a graphical interface.
-
Windows: Command Prompt (or PowerShell/Windows Terminal for more advanced usage).
- Press
Win + R
, typecmd
, and hit Enter for Command Prompt. - Alternatively, search for "PowerShell" or "Windows Terminal" and open it.
- Press
-
macOS: Terminal app.
- Press
Command + Space
to open Spotlight Search, type "Terminal," and press Enter.
- Press
-
Linux: Terminal (built-in for most distributions).
- Use the
Ctrl + Alt + T
shortcut, or find "Terminal" in your application menu.
- Use the
To run a Python script, you need to be in the directory (also known as a "folder") where the script is stored. It's easiest to just open a terminal directly in the same folder you’re browsing. Here’s how to do it on each major operating system.
-
Windows
-
Option 1: File Explorer Option:
- In Windows 10/11, navigate to the folder in File Explorer.
- Hold down the Shift key and right-click in the folder.
- Select Open PowerShell window here or Open Command Window here (depending on your system settings).
-
Option 2: File Explorer Address Bar:
- In File Explorer, click the folder path in the address bar.
- Type
cmd
for Command Prompt orpowershell
for PowerShell, then press Enter. - This will open the specified terminal directly in the current folder.
-
Option 3: Windows Terminal (PowerShell/Command Prompt):
- Install Windows Terminal from the Microsoft Store if not already installed.
- Follow the same Shift + Right-click steps, then select Open in Windows Terminal.
-
-
macOS
-
Option 1: Finder Context Menu:
- Open Finder and navigate to the desired folder.
- Right-click (or Control + click) in the folder.
- Select New Terminal at Folder (available in macOS Catalina and later).
- If this option doesn’t appear, enable it from System Preferences > Keyboard > Shortcuts under Services.
-
Option 2: Terminal Command:
- Open Terminal (Applications > Utilities > Terminal).
- Type
cd
(note the space aftercd
). - Drag and drop the folder from Finder into the Terminal window, then press Enter to change to that directory.
-
-
Linux
-
Option 1: File Manager Context Menu:
- In GNOME (Ubuntu) or KDE (Plasma) environments, right-click in the folder.
- Select Open in Terminal from the context menu.
- Some distributions may require enabling this feature in File Manager settings.
-
Option 2: Nautilus Quick Shortcut:
- In Nautilus (the default file manager for many Linux distributions), open the file manager and navigate to your folder.
- Press Ctrl + Alt + T to open a terminal in the current directory.
-
Option 3: Address Bar:
- In some Linux file managers, you can also type
terminal
orgnome-terminal
in the address bar to open a terminal.
- In some Linux file managers, you can also type
-
-
Windows: You may need to use
py script_name.py
ifpython
orpython3
doesn’t work. This launches the latest installed Python version. -
macOS/Linux: The command
python3
may be needed ifpython
points to Python 2.
- "Python is not recognized as an internal or external command": This error means Python isn’t in your PATH. Refer to step 7.
-
Permissions Errors: In macOS/Linux, use
chmod +x script_name.py
to give execute permissions, if needed.
For beginners, I recommend using Python to interact with the T3 API. All the T3 example scripts are written in Python.
Official Python getting started guide
Before running any Python script, verify that Python is installed.
- Type
python3 --version
and press Enter. You should see a version number likePython 3.x.x
. - If you see an error, install Python from python.org.

Once you have Python installed and configured, let's test to see if you have everything working properly. The T3 Examples repository has a script that checks to see if you have everything set up properly.
Running this curl
will download the file into the current terminal directory/folder:
curl -L -o api_check.py https://raw.githubusercontent.com/classvsoftware/t3-api-examples/refs/heads/master/api_check.py
You can find the check script here, and download it by clicking "download raw file".
Open a terminal in the same folder as your script file. Instructions for easily doing this can be found here.
A Python virtual environment is just a container to install Python packages into. It's not strictly required, but it's recommended, and some operating systems like OS X require it.
The following commands create a virtual environment next to your script file, and activates it. Run them in order.
-
Create a virtual environment named "venv":
python3 -m venv ./venv
-
Activate the virtual environment;
source ./venv/bin/activate

NOTE: You will need to reactiveate the virtual environment with source ./venv/bin/activate
every time you open up a terminal.
Once you have Python installed, you will also need the requests
library to send requests to the API.
Run pip3 install requests
to install the library. If you are using a virtual environment, ensure it is activated before running this command.
Tip: You might see error: externally-managed-environment
on OSX. This just means you need to create a "virtual environment" for Python.

Running Python scripts will take the following form: python3 [script filename] [extra stuff afterwards]
. For example, python3 example_script.py --flag1=FLAG1VALUE --flag2=FLAG2value
You're not expected to know this format, all the scripts in the example repository will tell you how to run them and provide detailed messages on how to fix problems.
To ask a script how it should be run, use the --help
flag. For example, python3 api_check.py --help
.
The response will be something like this:
usage: api_check.py [-h] --hostname HOSTNAME --username USERNAME
Check API access configuration for Track and Trace Tools.
options:
-h, --help show this help message and exit
--hostname HOSTNAME The hostname of the Track and Trace Tools API (e.g., mo.metrc.com). This is required to target the correct server. Example: --hostname=mo.metrc.com
--username USERNAME Username for authentication with the Track and Trace Tools API. This should be a valid email or user identifier for the account. Example: [email protected]
So in this case, the correct format would be python3 api_check.py --hostname=mo.metrc.com [email protected]
All the scripts in the examples repository include help documentation that describing how the script should be run.

Run the check script you downloaded to test if your credentials can access the API.
If everything is normal, you will see You successfully authenticated with the T3 API
. The output will also indicate if your Metrc username is registered for T3+.

- Refer to the T3 API documentation to explore all the available endpoints.
- Most API endpoints require a T3+ subscription. If you don't have a T3+ subscription, you can sign up here.
Created by Matt Frisbie
Contact: matt@trackandtracetools
Copyright © 2025 Track & Trace Tools. All rights reserved.
- Home
- FAQ
- Metrc
- T3 Chrome Extension
- T3 API
- OpenTag
- T3 API : Label Generation
- T3 Chrome Extension : Label PDF Generator
- T3 Chrome Extension : Scan Sheets
- RFID
- T3 Chrome Extension : CSV Form Fill
- T3+
- T3 Chrome Extension : Reports
- T3 Chrome Extension : T3+ Features
- T3 Chrome Extension : Primary Features
- T3 Chrome Extension : Getting Started
- T3 API : Reports and Spreadsheet Sync
- T3 API : Getting Started