Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

How to set studio hostname via API?

7 replies
Last updated: Nov 13, 2020
I saw that I have a new problem but with sanity now, when i doing sanity deploy, i getting to choose my studio hostname, and when i choose one and click enter, nothing else happens, it just stops there, so it doesnt deploy it, anyone know why?
Nov 13, 2020, 8:10 AM
Hi Markus, if you’re comfortable using the HTTP API, you could try setting your studio hostname that way:
curl --request PATCH '<https://api.sanity.io/v1/projects/><projectId>' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
	"studioHost": "<hostname>"
To get the token, you can run 
sanity debug --secrets
 in the CLI and use the auth token listed in the output.
As for why it's not working with the deploy command, I'm not sure but it's something we'll investigate. Are you on the latest version (
sanity versions
Nov 13, 2020, 10:27 AM
Hi thanks for answer, I will try it out. Yeah I guess so, I did sanity init and create the blog schema one so i guess so.
Nov 13, 2020, 10:51 AM
Sorry for asking, that curl --request one, should i use that in the terminal? with my auth token?
Nov 13, 2020, 10:53 AM
totally new to this
Nov 13, 2020, 10:53 AM
That's correct! 🙂
Nov 13, 2020, 10:54 AM
Thanks a lot, now it works! 🙂
Is it possbile to make a .env to protect the id in sanity project aswell?
Nov 13, 2020, 11:06 AM
Glad to hear!
Check Bjørge's response in your previous thread regarding the project ID: it's not considered a secret, but you can load it from an env variable, yep
Nov 13, 2020, 11:13 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?