# API: create a new Trello card (with labels) via curl

**URL:** <https://community.developer.atlassian.com/t/api-create-a-new-trello-card-with-labels-via-curl/70016>\
**Category:** Trello\
**Tags:** curl, card, label, rest-api\
**Created:** [June 2, 2023, 2:58pm UTC](https://community.developer.atlassian.com/t/api-create-a-new-trello-card-with-labels-via-curl/70016 "2023-06-02T14:58:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbirl](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/sbirl/32/48348_2.png) [@sbirl](https://community.developer.atlassian.com/u/sbirl)\
**Post date:** [June 2, 2023, 2:58pm UTC](https://community.developer.atlassian.com/t/api-create-a-new-trello-card-with-labels-via-curl/70016/1 "2023-06-02T14:58:52Z")

</div>

Hello all:  
The [doc](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-group-cards) says that I should be able to create a new Trello card with labels. But anytime I try to add `idLabels` to my `POST`, I get a `400`:

```bash
LABELS='"61b744be68b816597ea0292a","632c98935ce7d701bc2c22e6"'
CARDID=$(curl --fail --no-progress-meter --header "Content-Type: application/json" \
--data "{\"name\":\"test\",\"idList\":\"${LIST}\",\"idLabels\":\"[${LABELS}]\"}" \
 "https://api.trello.com/1/cards?key=${TAK}&token=${TPT}" | jq -r '.id')

```

As I recall, passing a JSON array is `"idLabels":"["index0","index1"]"` but it has not been working for me (whether as a variable or not).  
Any workarounds or correct syntax would be appreciated.  
Thanks!

---

<div class="post-metadata">

**Author:** ![sbirl](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/sbirl/32/48348_2.png) [@sbirl](https://community.developer.atlassian.com/u/sbirl)\
**Post date:** [June 2, 2023, 3:50pm UTC](https://community.developer.atlassian.com/t/api-create-a-new-trello-card-with-labels-via-curl/70016/2 "2023-06-02T15:50:14Z")

</div>

I finally found my mistake: I had the outside of the array in double-quotes.  
It should be: `\"idLabels\":[${LABELS}]`
