How To Add A Card In Trello Using Trello Api

How To Articles

Inserting a card into Trello through the Trello API is a useful method for streamlining and improving your project management flow. As someone who frequently uses Trello, I frequently require the ability to programmatically add cards to maintain organization and ensure accuracy within my projects. This article will walk you through the steps of adding a card to Trello using the Trello API, providing insight and advice from my own experiences.

Before we begin

To get started, you will need to have a Trello account and a Trello API key. If you don’t have an API key yet, don’t worry; obtaining one is a quick and easy process. Simply visit the Trello Developer Portal and create a new application. Once you’ve created your application, you will be provided with an API key, which you can use to authenticate your requests to the Trello API.

Step 1: Install Required Libraries

Before we dive into the code, make sure you have the necessary libraries installed. In this case, we’ll be using the requests library, which is a popular library for making HTTP requests in Python. To install it, open your terminal and run the following command:

pip install requests

Step 2: Import Libraries and Set Up Authentication

Now that we have the requests library installed, let’s start our Python script by importing the necessary libraries and setting up the authentication with our Trello API key. Here’s an example of how this can be done:

import requests

API_KEY = 'your-api-key-goes-here'
API_TOKEN = 'your-api-token-goes-here'

Make sure to replace ‘your-api-key-goes-here’ with your actual Trello API key and ‘your-api-token-goes-here’ with your API token, which can be obtained from the Trello Developer Portal.

Step 3: Create a New Card

Now comes the exciting part: creating a new card in Trello! To do this, we’ll make a POST request to the Trello API’s cards endpoint. Here’s an example of how this can be achieved:

url = ''
params = {
'key': API_KEY,
'token': API_TOKEN,
'idList': 'your-list-id-goes-here',
'name': 'Your Card Name',
'desc': 'Your Card Description',
'due': '2022-12-31'

response =, params=params)

In the code snippet above, make sure to replace ‘your-list-id-goes-here’ with the ID of the list where you want to add the card. You can find the ID of a list by navigating to the list in Trello and checking the URL – it should contain a segment like ‘/lists/{listId}’.

Additionally, customize the ‘name’, ‘desc’ (description), and ‘due’ (due date) fields to match your desired card details.


Adding a card in Trello using the Trello API opens up a world of possibilities for automating your project management workflow. By following the steps outlined in this article, you can seamlessly integrate card creation into your own applications and scripts. Whether you’re building a custom Trello integration or simply looking to streamline your personal project management, the Trello API is a powerful tool that can help you achieve your goals.