Change domain or subdomain
Learn how to change your production instance's domain or subdomain on Clerk.
You cannot change the domain of the development instance of your Clerk application.
Change domain
Production domains can be changed in the Clerk Dashboard(opens in a new tab) or via our backend API(opens in a new tab). Once you make the change to your domain, you will need to update the following:
- Update DNS records
- Generate new SSL certificates
- Update your publishable key
- If using social connections, update the settings with your social connections so that the redirect URL they are using is correct.
- If using JWT templates, update JWT issuer and JWKS endpoint in external JWT SSO services.
Update your domain via Clerk Dashboard
To update the production URL from the Clerk Dashboard, navigate to the Domains(opens in a new tab) page and select the Danger tab. Select Change domain.
You will receive a prompt to enter your new production domain.
Update your domain via backend API
To update the production URL using the backend API, you can copy the following cURL code. You will want to replace YOUR_SECRET_KEY
with your Clerk secret key, which can be found on the API Keys(opens in a new tab) page of the Clerk Dashboard. Then, make sure to update the home_url
field with your new production URL.
curl -XPOST -H 'Authorization: <YOUR_SECRET_KEY>' -H "Content-type: application/json" -d '{ "home_url": "YOUR_PROD_URL" }' 'https://api.clerk.com/v1/instance/change_domain'
For more information on how to update your instance settings using the backend API, see our backend API reference(opens in a new tab).
Update your publishable key
After changing your domain, a new Publishable key will be automatically generated for your application. You will need to update your environment variables with this new key and redeploy your application. You can find your Publishable key on the API Keys(opens in a new tab) page of the Clerk Dashboard.
Failing to update your Publishable key will result in Clerk failing to load.
Specify subdomain
If you would like to specify your subdomain of your application, go to the Clerk Dashboard and navigate to the Domains(opens in a new tab) page. Select the Danger tab.
Change subdomain
You can update your subdomain via the Clerk Dashboard. Navigate to the Domains(opens in a new tab) page and select the Danger tab. Select Change subdomain.
You will receive a prompt to enter your new subdomain.
Last updated on April 18, 2024