# Create Rule API not working

**URL:** <https://discuss.elastic.co/t/create-rule-api-not-working/335228>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [June 5, 2023, 2:34pm UTC](https://discuss.elastic.co/t/create-rule-api-not-working/335228 "2023-06-05T14:34:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [June 5, 2023, 2:34pm UTC](https://discuss.elastic.co/t/create-rule-api-not-working/335228/1 "2023-06-05T14:34:03Z")

</div>

Hi  
I'm a bit struggling using the Rules creation API

> **[Create rule API | Kibana Guide \[8.6\] | Elastic](https://www.elastic.co/guide/en/kibana/8.6/create-rule-api.html)**
>
> Conceptual and step-by-step procedures for using runtime fields, scripted fields, and field formatters.

I'm trying to create a `"rule_type_id":".es-query"`.  
In the parameters it asks me for the `"es-Query"', I tried to use the triple quotes but it gives me an error that  
` "Bad Request","message":"Invalid request payload JSON format"`  
If i give no quotes then it gives me an error that it is expecting a string and instead it got an object.  
So how can I safely send it over?  
Thanks  
A

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [June 21, 2023, 10:17am UTC](https://discuss.elastic.co/t/create-rule-api-not-working/335228/2 "2023-06-21T10:17:32Z")

</div>

Hi @A_Mightiev,

Can you share your request payload and the query you are trying to create the rule for?

---

<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:** [July 19, 2023, 10:17am UTC](https://discuss.elastic.co/t/create-rule-api-not-working/335228/3 "2023-07-19T10:17:38Z")

</div>

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