# Post API Error- {"status": 400, "body": "Request must contain a osd-xsrf header."}

**URL:** <https://forum.opensearch.org/t/post-api-error-status-400-body-request-must-contain-a-osd-xsrf-header/10886>\
**Category:** OpenSearch Client Libraries\
**Tags:** opensearch-py\
**Created:** [September 12, 2022, 8:06am UTC](https://forum.opensearch.org/t/post-api-error-status-400-body-request-must-contain-a-osd-xsrf-header/10886 "2022-09-12T08:06:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![divyank\_1](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@divyank\_1](https://forum.opensearch.org/u/divyank_1)\
**Post date:** [September 12, 2022, 8:06am UTC](https://forum.opensearch.org/t/post-api-error-status-400-body-request-must-contain-a-osd-xsrf-header/10886/1 "2022-09-12T08:06:28Z")

</div>

Hi,

I am using python client library to send post request.  
Below is my code, when I send post reuest without `osd-xsrf ` header,  
getting error - `{"status": 400, "body": "Request must contain a osd-xsrf header."}`.

While after adding `osd-xsrf=true` in header , then getting `invalid syntax error`.

Code-

```auto
import requests
headers = { 'osd-xsrf':'true'}
data = {
    "site_name": "XYZ",
    "location": "ABC",
    "latitude": "c",
    "longitude": "d"
}

resp = requests.post('hostname:9200',headers=headers,data=data,verify=False)
print(resp)
print(resp.json)
print(resp.content)
print(resp.text)

Output Error-

  File "<ipython-input-30-8918d81b837f>", line 3
    headers = { 'osd-xsrf=true'}
                                               ^
SyntaxError: invalid syntax

```

Pls let me konw the syntax for header in python client for `osd-xsrf:true`.

Ref link- [Common issues - OpenSearch documentation](https://opensearch.org/docs/latest/troubleshoot/index/#multi-tenancy-issues-in-opensearch-dashboards)

---

<div class="post-metadata">

**Author:** ![wbeckler](https://avatars.discourse-cdn.com/v4/letter/w/9d8465/32.png) [@wbeckler](https://forum.opensearch.org/u/wbeckler)\
**Post date:** [September 12, 2022, 3:25pm UTC](https://forum.opensearch.org/t/post-api-error-status-400-body-request-must-contain-a-osd-xsrf-header/10886/2 "2022-09-12T15:25:05Z")

</div>

Can you share more context on what you are trying to do? It sounds like you are interfacing with your dashboards? Which client are you using?
