Trello API: Add Card
This endpoint allows you to add a new card to a specified list within a Trello board. It is commonly used to create tasks or items in project management workflows.
Endpoint Details
- Method:
POST
- Endpoint URL:
https://api.trello.com/1/cards
- Authentication: Requires
key
and token
as query parameters.
Required Parameters
Parameter |
Type |
Description |
name |
String |
The name of the card. |
idList |
String |
The ID of the list where the card will be added. |
Optional Parameters
Parameter |
Type |
Description |
desc |
String |
A description for the card. |
due |
Date |
A due date for the card in ISO 8601 format. |
pos |
String |
Position of the card in the list (e.g., "top" or "bottom"). |
Example API Request
POST https://api.trello.com/1/cards
Content-Type: application/json
{
"name": "New Task",
"idList": "60d21b4967d0d810b8f8b456",
"desc": "This is a sample task.",
"due": "2024-12-10T09:00:00.000Z",
"pos": "top",
"key": "YOUR_API_KEY",
"token": "YOUR_ACCESS_TOKEN"
}
Example API Response
{
"id": "60d21b4967d0d810b8f8b456",
"name": "New Task",
"desc": "This is a sample task.",
"url": "https://trello.com/c/12345abcd/NewTask"
}
Common Errors & Solutions
Error Code |
Possible Cause |
Solution |
400 Bad Request |
Missing required parameters |
Ensure name and idList are provided. |
401 Unauthorized |
Invalid API key or token |
Check API credentials and re-authenticate. |
404 Not Found |
Invalid list ID |
Verify the idList parameter matches an existing Trello list. |