# No action when adding label through API

**URL:** <https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140>\
**Category:** Trello\
**Tags:** trello, label, rest-api\
**Created:** [February 9, 2024, 2:17pm UTC](https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140 "2024-02-09T14:17:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arne](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Arne](https://community.developer.atlassian.com/u/Arne)\
**Post date:** [February 9, 2024, 2:17pm UTC](https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140/1 "2024-02-09T14:17:04Z")

</div>

Using the REST API, one can obtain the actions on a board or card through `boards/{id}/actions?filter=all` and `cards/id}/actions?filter=all` respectively.

When adding a label to an already existing label through the UI, we can find an action of type `updateCard` describing this change.  
However, when adding the label through the REST API endpoint `cards/{id}/idLabels?value={id}` does not lead to any action to show up on either of the reading endpoints `boards/{id}/actions?filter=all` and `cards/id}/actions?filter=all` respectively.

Why is that? Is this a bug? Is there a way to add a label through the REST API, so that we can also observe it through the REST API?

---

<div class="post-metadata">

**Author:** ![anon96974232](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@anon96974232](https://community.developer.atlassian.com/u/anon96974232)\
**Post date:** [February 9, 2024, 11:32pm UTC](https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140/2 "2024-02-09T23:32:01Z")

</div>

Hello @Arne

If you refer to the [Action Types](https://developer.atlassian.com/cloud/trello/guides/rest-api/action-types/) documentation, it describes which ones are excluded from being returned from the GET lookups via the REST API.

You will see that all actions related to labels are excluded.

---

<div class="post-metadata">

**Author:** ![Arne](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Arne](https://community.developer.atlassian.com/u/Arne)\
**Post date:** [February 12, 2024, 11:01am UTC](https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140/3 "2024-02-12T11:01:49Z")

</div>

Hi @anon96974232,

Thank you for your response. I was aware of the action type `addLabelToCard` not being returned through the REST API, though I cannot understand why that is the case: Shouldn’t I be able to get those when I explicitly ask for it through `filter=addLabelToCard`?

But setting that aside, what I aimed this topic at was: When I **manually** add a label, I get an action with type `updateCard`, with

```auto
		"data": {
			"card": {
				"idLabels": [
					"xyz"
				],
				"id": "abc",
				"name": "Title",
				"idShort": 999,
				"shortLink": "123456"
			},
			"old": {
				"idLabels": []
			},

```

so, that I can **infer** that label with id `xyz` has been added. This is not the case when I add the label through the REST API.

This looks like a bug to me, but I am open to have my mind changed ;-).

---

<div class="post-metadata">

**Author:** ![anon96974232](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@anon96974232](https://community.developer.atlassian.com/u/anon96974232)\
**Post date:** [February 12, 2024, 8:38pm UTC](https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140/4 "2024-02-12T20:38:53Z")

</div>

OK, I get what you mean now. Yes, you can read the `updateCard` object in the JSON response to see the action where a label was changed for a card.

I just did a quick test. I created a new card via the GUI. I then used the PUT method via the [Update a card endpoint](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put) to add two labels to it. I then used the REST API to get the actions on that card and I saw there was an `updateCard` action and within the `data` object there were entries related to those labels changing, the same as your example.

I then went back to the GUI, removed both the labels from the card, then used the REST API to get what actions had been recorded. There were two new `updateCard` actions, each of which showed the corresponding changes for the labels being removed.

So, at first glance, it seemed using the REST API was identical in outcome to using the GUI.

I then tried using the POST method via the [Add a label to a card endpoint](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post) to add a label to the card using its ID. When I looked at the card via the GUI, I could see the label was there. When I used the REST API to check what labels the card had, it correctly reported the label was there, in the `idLabels` object. However, when I then got all the actions on the card, there was no new `updateCard` action to show the label had been added!

I then tried the DEL method via the [Remove a label from a card endpoint](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-idlabel-delete) to delete that label based on its ID. The GUI correctly shows the change, the `idLabels` object for the card was correctly updated and become null (empty array), but there was no corresponding `updateCard` action recorded.

**Summary :**

1. Changing labels on a card via the POST and DEL endpoints _is not_ recorded as an `updateCard` action
2. Changing labels on a card via the PUT method of the [Update a Card](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put) endpoint _is_ recorded as an `updateCard` action.

Maybe this isn’t a bug, but intended behaviour (IE, you must use the PUT method if you want the action recorded)? The documentation doesn’t provide enough detail to know for sure. You’d have to test all the POST / DEL endpoints against their PUT cousin to validate that.

---

<div class="post-metadata">

**Author:** ![Arne](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Arne](https://community.developer.atlassian.com/u/Arne)\
**Post date:** [February 13, 2024, 4:08pm UTC](https://community.developer.atlassian.com/t/no-action-when-adding-label-through-api/77140/5 "2024-02-13T16:08:01Z")

</div>

Hi @anon96974232,

Thanks a lot for digging into this. I think your analysis makes a lot of sense and that it is a bit unfortunate that this is not readily described in the documentation.
