Assign an Alias
POST
https://api.vercel.com/v2/deployments/{id}/aliasesCreates a new alias for the deployment resolved from the given deployment or alias ID or URL. The authenticated user or team must own this deployment. If the desired alias is already assigned to another deployment, then it will be removed from the old deployment and assigned to the new one.
https://api.vercel.com/v2/deployments/{id}/aliases
const response = await fetch('https://api.vercel.com/v2/deployments/id/aliases?teamId=string&slug=string', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ "alias": "my-alias.vercel.app", "redirect": "null" }),});
const data = await response.json();console.log(data);Response
{ "alias": "my-alias.vercel.app", "created": "2017-04-26T23:00:34.232Z", "oldDeploymentId": "dpl_FjvFJncQHQcZMznrUm9EoB8sFuPa", "uid": "2WjyKQmM8ZnGcJsPWMrHRHrE"}AuthorizationbearerToken
Default authentication mechanism
200The alias was successfully assigned to the deployment
400One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.
The cert for the provided alias is not ready
The deployment is not READY and can not be aliased
The supplied alias is invalid
401The request is not authorized.
402The account is missing a payment so payment method must be updated
403You do not have permission to access this resource.
If no .vercel.app alias exists then we fail (nothing to mirror)
404The domain used for the alias was not found
The deployment was not found
409The provided alias is already assigned to the given deployment
The domain is not allowed to be used
410Error