POST
/
v2
/
domains
/
{domain}
/
records
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.dns.createRecord({
    domain: "example.com",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      type: "CNAME",
      ttl: 60,
      https: {
        priority: 10,
        target: "host.example.com",
        params: "alpn=h2,h3",
      },
      comment: "used to verify ownership of domain",
    },
  });

  // Handle the result
  console.log(result);
}

run();
{
  "uid": "<string>",
  "updated": 123
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

domain
string
required

The domain used to create the DNS record.

Example:

"example.com"

Query Parameters

teamId
string

The Team identifier to perform the request on behalf of.

Example:

"team_1a2b3c4d5e6f7g8h9i0j1k2l"

slug
string

The Team slug to perform the request on behalf of.

Example:

"my-team-url-slug"

Body

application/json
name
string
required

A subdomain name or an empty string for the root domain.

Example:

"subdomain"

type
enum<string>
required

The type of record, it could be one of the valid DNS records.

Available options:
A
value
string
required

The record value must be a valid IPv4 address.

Example:

"192.0.2.42"

ttl
number

The TTL value. Must be a number between 60 and 2147483647. Default value is 60.

Required range: 60 <= x <= 2147483647
Example:

60

comment
string

A comment to add context on what this DNS record is for

Maximum length: 500
Example:

"used to verify ownership of domain"

Response

200
application/json
Successful response showing the uid of the newly created DNS record.
uid
string
required
updated
number
required