# Certain watches never execute when added via the API

**URL:** <https://discuss.elastic.co/t/certain-watches-never-execute-when-added-via-the-api/330883>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [April 26, 2023, 9:23pm UTC](https://discuss.elastic.co/t/certain-watches-never-execute-when-added-via-the-api/330883 "2023-04-26T21:23:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tang214](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tang214/32/120273_2.png) [@tang214](https://discuss.elastic.co/u/tang214)\
**Post date:** [April 26, 2023, 9:23pm UTC](https://discuss.elastic.co/t/certain-watches-never-execute-when-added-via-the-api/330883/1 "2023-04-26T21:23:21Z")

</div>

I have certain watches that never execute when being added via the API. The exact same watch json will work fine when added via the UI or Dev Tools Console. The watch code does update when pushed to the API but still won't execute. If you view it in the UI and save it without making changes then the watch does execute properly. I just don't get it, it's the exact same watch code.

I've played around with setting it in different text formats. I thought maybe it was something with how it was resolving my metadata variables in the condition, but I have another watch set up like that and it does not have the same issue. If I replace the variable with a fixed value in the condition then it does work. I don't know what else to try at this point. Please help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 24, 2023, 9:23pm UTC](https://discuss.elastic.co/t/certain-watches-never-execute-when-added-via-the-api/330883/2 "2023-05-24T21:23:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
