Support Forums

Updating a site's custom domain from the cli does not work


I am trying to update a site’s custom domain from the cli.

The following command does not update the custom domain name change:

netlify api updateSite -d '{ "site_id": "mysite id", "custom_domain": "my-domain" }'

Any help would be greatly appreciated.



Hi there, @PDS :wave:

Welcome to the Netlify Forums! Can you share the custom domain in question? Do you receive any error messages when you attempt to do this?

Hi @hillary

Thanks for getting back.

I have a domain with the DNS managed by Netlify. When I run the following command I receive the output below. I don’t receive any error messages.

I have truncated the full output as it has too many links and won’t allow me to post it.

netlify api updateSite -d '{ "site_id": "e05a9952-f407-4638-8e58-30cdf3ee0189", "custom_domain": "api.liquidbinary.uk" }'

“id”: “e05a9952-f407-4638-8e58-30cdf3ee0189”,
“site_id”: “e05a9952-f407-4638-8e58-30cdf3ee0189”,
“plan”: “nf_team_new_business”,
“ssl_plan”: null,
“premium”: false,
“claimed”: true,
“name”: “vigorous-franklin-e9cac6”,
“custom_domain”: “angular-netlify-app.liquidbinary.uk”,
“domain_aliases”: ,
“password”: null,


Hi @PDS,

Just to be sure, are you able to make this change directly through the API (without CLI)?

Hi @hrishikesh

Yes I am able to make the change using the api directly.

The CLI version I am using is:

netlify -v
netlify-cli/6.0.8 darwin-x64 node-v14.17.5

Hi @PDS,

Thank you for confirming. That’s just what I assumed. In the past I’ve seen some problems with the updateSite API command not working as expected with the CLI. I’d pass this on to the devs and hopefully get a resolution. Meanwhile, I think you’d have to resort to use the API.

Hi @hrishikesh

Ok that’s fine I’ll update my deploy script to use the api instead. :+1:

1 Like

Hi @PDS,

On a side note, you can keep a track of the issue here:

Hi @PDS,

We heard back fro the CLI devs and the correct syntax for the CLI command is:

netlify api updateSite -d '{ "site_id": "e05a9952-f407-4638-8e58-30cdf3ee0189", "body": {"custom_domain": "api.liquidbinary.uk"}}'

Let us know if that works for you.

1 Like

Hi @hrishikesh ,

That works a treat. :ok_hand:

It is not obvious from the cli docs that you need nest the custom domain name in body. I’ll raise and issue on their repo.

Thanks for resolving that.

1 Like

Glad to know that worked!

1 Like