Import configuration depends on tenant using API

Hello,
I’m creating the environment using API, and I’m using multi tenants.
By default when I try to import some element (index, index pattern o ndjson file) insert objects in Private tenant (this tenant is in elasticsearch.yml).
But… could I choose the tenant in API request?

I believe you need to use the “securitytenant” header to identify the target tenant. For example, my calls to the API using curl include -H "securitytenant: global" to get them into the right tenant. I didn’t find that mentioned in the doc, but I believe it was mentioned in a post here at some point.

Thank for your reply
I didn’t find it (documentation and forum), but I have just tried and it works!!! So … thank you so much!!!

Hello! I have the same problem, but adding the header -H “securitytenant: test_tenant” when I create an index pattern always save it in the global tenant.

My curl is:

curl -X POST
-k -u “user:password”
http://localhost:9200/api/saved_objects/index-pattern/
-H “kbn-xsrf: true”
-H “content-type: application/json; charset=utf-8”
-H “securitytenant: test_tenant”
-d ‘{“attributes”:{“title”:“logger-*”,“timeFieldName”:“@timestamp”}}’

What I’m doing wrong? Could you give me a curl comand as example?

Thanks in advance