# Email DNS records to a co-worker

## API Overview

If you don't have access to modify your companies DNS records, you can email the records to a co-worker who does to complete [Domain Authentication](/docs/sendgrid/ui/account-and-settings/how-to-set-up-domain-authentication) and/or [Link Branding](/docs/sendgrid/ui/account-and-settings/how-to-set-up-link-branding) setups. This email includes a direct link to the DNS records. The link does expire, but the recipient doesn't need login access to your Twilio SendGrid account.

## Operation overview

```json
{"path":"https://api.sendgrid.com/v3/whitelabel/dns/email","method":"post","servers":[{"url":"https://api.sendgrid.com","description":"for global users and subusers"},{"url":"https://api.eu.sendgrid.com","description":"for EU regional subusers"}]}
```

**This endpoint is used to share DNS records with a colleagues**

Use this endpoint to send SendGrid-generated DNS record information to a co-worker so they can enter it into your DNS provider to validate your domain and link branding.

What type of records are sent will depend on whether you have chosen Automated Security or not. When using Automated Security, SendGrid provides you with three CNAME records. If you turn Automated Security off, you are instead given TXT and MX records.

If you pass a `link_id` to this endpoint, the generated email will supply the DNS records necessary to complete [Link Branding](/docs/sendgrid/ui/account-and-settings/how-to-set-up-link-branding/) setup. If you pass a `domain_id` to this endpoint, the generated email will supply the DNS records needed to complete [Domain Authentication](/docs/sendgrid/ui/account-and-settings/how-to-set-up-domain-authentication/). Passing both IDs will generate an email with the records needed to complete both setup steps.

You can retrieve all your domain IDs from the returned `id` fields for each domain using the "List all authenticated domains" endpoint. You can retrieve all of your link IDs using the "Retrieve all branded links" endpoint.

## Operation details

### Authentication

API Key

### Headers

```json
[{"in":"header","name":"Authorization","required":true,"default":"Bearer <<YOUR_API_KEY_HERE>>","schema":{"type":"string"}}]
```

### Request body

```json
{"schema":{"type":"object","required":["link_id","domain_id","email"],"example":{"link_id":29719392,"domain_id":46873408,"email":"my_colleague@example.com","message":"DNS Record for verification"},"properties":{"link_id":{"type":"integer","minimum":0,"description":"The ID of the branded link."},"domain_id":{"type":"integer","minimum":0,"description":"The ID of your SendGrid domain record."},"email":{"type":"string","format":"email","description":"The email address to send the DNS information to."},"message":{"type":"string","default":"Please set these DNS records in our hosting solution.","description":"A custom text block to include in the email body sent with the records."}}},"encodingType":"application/json"}
```

### Responses

```json
[{"responseCode":"204","schema":{"description":""}},{"responseCode":"400","schema":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"object","properties":{"error":{"type":"string"},"field":{"type":"string"}}}}}}}}}]
```

Email DNS records to a co-worker

```js
const client = require("@sendgrid/client");
client.setApiKey(process.env.SENDGRID_API_KEY);

const data = {
  link_id: 29719392,
  domain_id: 46873408,
  email: "my_colleague@example.com",
  message: "DNS Record for verification",
};

const request = {
  url: `/v3/whitelabel/dns/email`,
  method: "POST",
  body: data,
};

client
  .request(request)
  .then(([response, body]) => {
    console.log(response.statusCode);
    console.log(response.body);
  })
  .catch((error) => {
    console.error(error);
  });
```

```python
import os
from sendgrid import SendGridAPIClient


sg = SendGridAPIClient(os.environ.get("SENDGRID_API_KEY"))

data = {
    "link_id": 29719392,
    "domain_id": 46873408,
    "email": "my_colleague@example.com",
    "message": "DNS Record for verification",
}

response = sg.client.whitelabel.dns.email.post(request_body=data)

print(response.status_code)
print(response.body)
print(response.headers)
```

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SendGrid;

public class Program {
    public static async Task Main() {
        string apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");
        var client = new SendGridClient(apiKey);

        var data =
            @"{
            ""link_id"": 29719392,
            ""domain_id"": 46873408,
            ""email"": ""my_colleague@example.com"",
            ""message"": ""DNS Record for verification""
        }";

        var response = await client.RequestAsync(
            method: SendGridClient.Method.POST, urlPath: "whitelabel/dns/email", requestBody: data);

        Console.WriteLine(response.StatusCode);
        Console.WriteLine(response.Body.ReadAsStringAsync().Result);
        Console.WriteLine(response.Headers.ToString());
    }
}
```

```java
import com.sendgrid.*;
import java.io.IOException;
import org.json.JSONObject;
import java.util.HashMap;

public class Example {
    public static void main(String[] args) throws IOException {
        try {
            SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
            Request request = new Request();
            request.setMethod(Method.POST);
            request.setEndpoint("/whitelabel/dns/email");
            request.setBody(new JSONObject(new HashMap<String, Object>() {
                {
                    put("link_id", 29719392);
                    put("domain_id", 46873408);
                    put("email", "my_colleague@example.com");
                    put("message", "DNS Record for verification");
                }
            }).toString());
            Response response = sg.api(request);
            System.out.println(response.getStatusCode());
            System.out.println(response.getBody());
            System.out.println(response.getHeaders());
        } catch (IOException ex) {
            throw ex;
        }
    }
}
```

```go
package main

import (
	"fmt"
	"github.com/sendgrid/sendgrid-go"
	"os"
)

func main() {
	apiKey := os.Getenv("SENDGRID_API_KEY")
	host := "https://api.sendgrid.com"
	request := sendgrid.GetRequest(apiKey, "/v3/whitelabel/dns/email", host)
	request.Method = "POST"
	request.Body = []byte(`{
  "link_id": 29719392,
  "domain_id": 46873408,
  "email": "my_colleague@example.com",
  "message": "DNS Record for verification"
}`)
	response, err := sendgrid.API(request)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(response.StatusCode)
		fmt.Println(response.Body)
		fmt.Println(response.Headers)
	}
}
```

```php
<?php
// Uncomment the next line if you're using a dependency loader (such as Composer) (recommended)
// require 'vendor/autoload.php';

// Uncomment next line if you're not using a dependency loader (such as Composer)
// require_once '<PATH TO>/sendgrid-php.php';

$apiKey = getenv("SENDGRID_API_KEY");
$sg = new \SendGrid($apiKey);
$request_body = json_decode('{
    "link_id": 29719392,
    "domain_id": 46873408,
    "email": "my_colleague@example.com",
    "message": "DNS Record for verification"
}');

try {
    $response = $sg->client
        ->whitelabel()
        ->dns()
        ->email()
        ->post($request_body);
    print $response->statusCode() . "\n";
    print_r($response->headers());
    print $response->body() . "\n";
} catch (Exception $ex) {
    echo "Caught exception: " . $ex->getMessage();
}
```

```ruby
require 'sendgrid-ruby'
include SendGrid

sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
data = JSON.parse('{
  "link_id": 29719392,
  "domain_id": 46873408,
  "email": "my_colleague@example.com",
  "message": "DNS Record for verification"
}')

response = sg.client.whitelabel.dns.email.post(request_body: data)
puts response.status_code
puts response.headers
puts response.body
```

```bash
curl -X POST "https://api.sendgrid.com/v3/whitelabel/dns/email" \
--header "Authorization: Bearer $SENDGRID_API_KEY" \
--header "Content-Type: application/json" \
--data '{"link_id": 29719392, "domain_id": 46873408, "email": "my_colleague@example.com", "message": "DNS Record for verification"}'
```
