Skip to content
Docs

Update a project domain

PATCHhttps://api.vercel.com/v9/projects/{idOrName}/domains/{domain}
Update a project domain's configuration, including the name, git branch and redirect of the domain.
https://api.vercel.com/v9/projects/{idOrName}/domains/{domain}
const response = await fetch('https://api.vercel.com/v9/projects/idOrName/domains/domain?teamId=string&slug=string', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"gitBranch": "null",
"redirect": "foobar.com",
"redirectStatusCode": "307"
}),
});
const data = await response.json();
console.log(data);
Response
{
"name": "Example Name",
"apexName": "Example Name",
"projectId": "example_id",
"redirect": "string",
"redirectStatusCode": "301",
"gitBranch": "string",
"customEnvironmentId": "example_id",
"updatedAt": "123",
"createdAt": "123",
"verified": "false",
"verification": [
{
"type": "string",
"domain": "string",
"value": "string",
"reason": "Customer requested refund"
}
]
}
AuthorizationbearerToken

Default authentication mechanism

idOrNamestringRequired
The unique project identifier or the project name
domainstringRequired
The project domain name
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
gitBranchstringOptional
Git branch to link the project domain
redirectstringOptional
Target destination domain for redirect
redirectStatusCodeintegerOptional
Status code for domain redirect
200The domain was updated successfuly
namestringRequired
apexNamestringRequired
projectIdstringRequired
redirectstringOptional
redirectStatusCodenumberOptional
gitBranchstringOptional
customEnvironmentIdstringOptional
updatedAtnumberOptional
createdAtnumberOptional
verifiedbooleanRequired
true if the domain is verified for use with the project. If false it will not be used as an alias on this project until the challenge in verification is completed.
verificationarrayOptional
A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete POST /projects/:idOrName/domains/:domain/verify to verify the domain. Possible challenges: - If verification.type = TXT the verification.domain will be checked for a TXT record matching verification.value.
400One of the provided values in the request body is invalid. One of the provided values in the request query is invalid. The domain redirect is not valid
401The request is not authorized.
403You do not have permission to access this resource.
409The project is currently being transferred
410Error