# Custom endpoint POST error

**URL:** https://discuss.elastic.co/t/custom-endpoint-post-error/183901
**Category:** Kibana
**Created:** [June 3, 2019, 7:13am UTC](https://discuss.elastic.co/t/custom-endpoint-post-error/183901 "2019-06-03T07:13:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![masterThomas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masterthomas/32/42765_2.png) [@masterThomas](https://discuss.elastic.co/u/masterThomas)
#### Post date: [June 3, 2019, 7:13am UTC](https://discuss.elastic.co/t/custom-endpoint-post-error/183901/1 "2019-06-03T07:13:53Z")

</div>

Hi team,  
i m creating custom endpoint for my visualization. Code is:  
`server.route({ method: 'POST', path: '/api/rt_record', handler: function (req, h) { const payload = req.payload; return h.payload; }, });`  
so there is error while i m trying to record via this url :  
`"statusCode": 400, "error": "Bad Request", "message": "Request must contain a kbn-xsrf header."`

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [June 3, 2019, 6:35pm UTC](https://discuss.elastic.co/t/custom-endpoint-post-error/183901/2 "2019-06-03T18:35:46Z")

</div>

I believe the requests to your endpoint needs to set the `kbn-xsrf` header. [https://github.com/elastic/kibana/issues/19553#issuecomment-445378105](https://github.com/elastic/kibana/issues/19553#issuecomment-445378105)

---

<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 1, 2019, 6:35pm UTC](https://discuss.elastic.co/t/custom-endpoint-post-error/183901/3 "2019-07-01T18:35:49Z")

</div>

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