# Return down for specific api status code

**URL:** https://discuss.elastic.co/t/return-down-for-specific-api-status-code/248439
**Category:** Synthetics
**Created:** [September 13, 2020, 11:55am UTC](https://discuss.elastic.co/t/return-down-for-specific-api-status-code/248439 "2020-09-13T11:55:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![amr\_ibrahim](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@amr\_ibrahim](https://discuss.elastic.co/u/amr_ibrahim)
#### Post date: [September 13, 2020, 11:55am UTC](https://discuss.elastic.co/t/return-down-for-specific-api-status-code/248439/1 "2020-09-13T11:55:51Z")

</div>

Hello,  
i install heartbeat and need to check if it the api return 500 status code , it will return down , else the heartbeat will return up  
so it's something like Not (check.response.status: [500]) rather than check response code  
so any one know the syntax for this

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [September 13, 2020, 11:00pm UTC](https://discuss.elastic.co/t/return-down-for-specific-api-status-code/248439/2 "2020-09-13T23:00:54Z")

</div>

Hi @amr_ibrahim

Welcome to the community?

Did you take a look here :

[https://www.elastic.co/guide/en/beats/heartbeat/current/monitor-http-options.html](https://www.elastic.co/guide/en/beats/heartbeat/current/monitor-http-options.html)

Lots of options, does your API return JSON? Perhaps look at that section, there are some sample syntax.

And use these conditions

[https://www.elastic.co/guide/en/beats/heartbeat/current/defining-processors.html#conditions](https://www.elastic.co/guide/en/beats/heartbeat/current/defining-processors.html#conditions)

---

<div class="post-metadata">

### Author: ![amr\_ibrahim](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@amr\_ibrahim](https://discuss.elastic.co/u/amr_ibrahim)
#### Post date: [September 15, 2020, 8:25am UTC](https://discuss.elastic.co/t/return-down-for-specific-api-status-code/248439/3 "2020-09-15T08:25:20Z")

</div>

Hello @stephenb,  
no it's not contain json i try alot of example and it fail , here is the right configuration only worked for me but some cases it's fail so i need to change  
check.response.status: [200,400,401,403,409,404] with  
not check.response.status: [500] so can you provide me the right syntax for that

```auto
 - type: http
  name: MCI_API_one
  enabled: true
  schedule: "@every 5m"
  urls: ["http://url"]
  check.response.status: [200,400,401,403,409,404]
  check.request:
    method: GET

```

---

<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: [October 9, 2020, 8:25am UTC](https://discuss.elastic.co/t/return-down-for-specific-api-status-code/248439/4 "2020-10-09T08:25:25Z")

</div>

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