Integrating claude-code with the Trello API
Here's a guide for setting up claude-code with Trello using the REST API to have it read and manage your boards for you, without you having to go and click around.
Pre-reqs
- you already have claude-code installed
- you already have a trello account
- install
jq
for linux & osx
Set up the Trello API Key & Token
You first need to create a Trello Power-Up - this is a feature meant for developers who are developing apps that integrate with Trello (such as the Slack app you can install).
You don't need to distribute them if you're going to be the only one using it.
At the end of this, you'll get both a Trello API Key and an API Token.
- Go to the Power-Up settings admin page https://trello.com/power-ups/admin. I have no idea how you get here via the web.
- Click New and follow the prompts
- Give it a name and fill in your details. Since this "Power-Up" is just used for us & claude-code, they aren't used for anything
- After you create it, you get the first part - the API Key. We'll use it in a sec.
- Then click the link right next to the API key, describing that you can generate a token for your own account. Follow the prompts and you get the second part - the API Token.
- For users on Mac, edit your
~/.zshrc
and add your token at the bottom
export TRELLO_API_KEY=replace-this-with-your-api-key
export TRELLO_API_TOKEN=replace-this-with-your-api-token
- Open a new terminal session
- Launch claude-code
Get Claude to use Trello
The important part here is to tell claude HOW to use Trello. They have done a fantastic job of it over here by defining it in their REST API https://developer.atlassian.com/cloud/trello/rest/api-group-actions
The only problem is that this is a very long HTML page with hidden sections that can't quickly be read by Claude.
Fortunately, they do offer an OpenAPI spec instead - a JSON file which contains all the data that is used to display the API endpoints. Its available on the top-right.
You'll land on a URL like https://dac-static.atlassian.com/cloud/trello/swagger.v3.json?_v=1.723.0
This returns a JSON file containing the OpenAPI spec. We can tell Claude to read this file, and then to read this JSON using jq
(this is important!)
If claude uses the
Read(your-file.json)
tool - it may overload the context window with useless information, it may only read a portion of the json, it may get confused on your original goal.Telling claude to
read the JSON with jq
makes it interact with the JSON programmatically - by inspecting the object's schema, and pulling real values, so you don't need to worry about hallucinated outputs.
In my case, I have a collection of recipes that I had put into a Trello board a long time ago. I can get Claude to go take a look at it. Here's my prompt
This is the Trello OpenAPI spec https://dac-static.atlassian.com/cloud/trello/swagger.v3.json?_v=1.723.0.
Use TRELLO_API_TOKEN & TRELLO_API_KEY to authenticate.
Read the OpenAPI spec to search and list available APIs based on the users query. Read this JSON using jq, save to a file if needed.
Give me a summary of my recipe collections
Troubleshooting
- Check if your key/token are set correctly in
~/.zshrc
by runningenv | grep TRELLO
. You should see your tokens. If you don't see them, try opening a new terminal session. - While
jq
is meant to get you better data, claude sometimes has issues with syntax and formatting of jq queries (it should make you feel better that both humans and machine-alike struggle with it). You can also tell it toread the json with python
and that will also get it to read the JSON programmatically. - Reading from a JSON file seems to work faster than reading straight from curl.
Then after a lot of trial and error, it works!
Here's a summary of your Recipe Collections board:
Board Overview: 84 total recipes
Lists by Category:
🍽️ Recipes on Deck (32 cards) - Your main recipe queue including:
- Mango Slaw, Indian Butter Chicken, Asian Cabbage Mango Slaw, Jalapeño
Sauce, Mango Papaya Salad + 27 more
🥩 Entrees (11 cards) - Main dishes like:
- Simple Turkey Chili, Haluski, Beef Wellington, Lasagna, Udon Noodle +
6 more
❌ Not Making Again (1 card) - Recipes to avoid:
- Shark Steaks
Interesting tastes from past Danny. I once decided to make shark steaks on a whim. The seafood section at my supermarket happened to have some shark steaks, I thought it sounded cool so I bought them, threw some salt and pepper, and started grilling them.
To top off this most gourmet of meals, I bought Uncle Ben's 2 Minute Rice and threw it in the microwave.
The results were ABSOLUTELY TERRIBLE. It was inedible to say the least.
I later learned that sharks pee through their skin, so you need to prep them in a specific way to release the ammonia before cooking it. I'm sure its good if prepared right for the right person, but NOT MAKING AGAIN.
Anyway - you can have Claude analyze your cards, reprioritize, walk you through your daily system, add comments, automatically add labels based on some criteria you set. All of the administrivia that you don't want to do in your Trello board.