Skip to content
Docs

Create a DNS record

POSThttps://api.vercel.com/v2/domains/{domain}/records
Creates a DNS record for a domain.
https://api.vercel.com/v2/domains/{domain}/records
const response = await fetch('https://api.vercel.com/v2/domains/domain/records?teamId=string&slug=string', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"type": "A",
"name": "subdomain",
"ttl": "60",
"value": "192.0.2.42",
"comment": "used to verify ownership of domain"
}),
});
const data = await response.json();
console.log(data);
Response
{
"uid": "example_id",
"updated": "123"
}
AuthorizationbearerToken

Default authentication mechanism

domainstringRequired
The domain used to create the DNS record.
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
typestringRequired
Must be of type A.
namestringRequired
A subdomain name or an empty string for the root domain.
ttlnumberOptional
The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
valuestringRequired
The record value must be a valid IPv4 address.
commentstringOptional
A comment to add context on what this DNS record is for
200Successful response showing the uid of the newly created DNS record.
uidstringOptional
updatednumberRequired
400One of the provided values in the request body is invalid. One of the provided values in the request query 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.
404Error
409Error
410Error