# Retrieve the default branded link

## API Overview

Email link branding (formerly "Link Whitelabel") allows all of the click-tracked links, opens, and images in your emails to be served from your domain rather than `sendgrid.net` for Global Email send or `eu.sendgrid.net` for Regional Email send. Spam filters and recipient servers look at the links within emails to determine whether the email looks trustworthy. They use the reputation of the root domain to determine whether the links can be trusted.

You can also manage link branding in the [Sender Authentication section of the Twilio SendGrid App](https://app.sendgrid.com/settings/sender_auth).

For more information, please see our [Link Branding documentation](/docs/sendgrid/ui/account-and-settings/how-to-set-up-link-branding/).

## Operation overview

```json
{"path":"https://api.sendgrid.com/v3/whitelabel/links/default","method":"get","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 allows you to retrieve the default branded link.**

The default branded link is the actual URL to be used when sending messages. If you have more than one branded link, the default is determined by the following order:

* The validated branded link marked as `default` (set when you call the "Create a branded link" endpoint or by calling the "Update a branded link" endpoint on an existing link)
* Legacy branded links (migrated from the whitelabel wizard)
* Default SendGrid-branded links (i.e., `100.ct.sendgrid.net`)

You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.

## Operation details

### Authentication

API Key

### Headers

```json
[{"in":"header","name":"Authorization","required":true,"default":"Bearer <<YOUR_API_KEY_HERE>>","schema":{"type":"string"}},{"name":"on-behalf-of","in":"header","description":"The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](/docs/sendgrid/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.","required":false,"schema":{"type":"string"},"refName":"#/components/parameters/OnBehalfOf","modelName":"__components_parameters_OnBehalfOf"}]
```

### Query string

```json
[{"name":"domain","in":"query","description":"The domain to match against when finding the default branded link.","schema":{"type":"string"}}]
```

### Responses

```json
[{"responseCode":"200","schema":{"description":"","content":{"application/json":{"schema":{"title":"Link Branding 200 Response","type":"object","required":["id","domain","username","user_id","default","valid","legacy","dns"],"refName":"LinkBranding200","modelName":"LinkBranding200","properties":{"id":{"type":"integer","description":"The ID of the branded link."},"domain":{"type":"string","description":"The root domain of the branded link."},"subdomain":{"type":"string","description":"The subdomain used to generate the DNS records for this link branding. This subdomain must be different from the subdomain used for your authenticated domain."},"username":{"type":"string","description":"The username of the account that this link branding is associated with."},"user_id":{"type":"integer","description":"The ID of the user that this link branding is associated with."},"default":{"type":"boolean","description":"Indicates if this is the default link branding.","enum":[true,false],"refName":"Default2","modelName":"Default2"},"valid":{"type":"boolean","description":"Indicates if this link branding is valid.","enum":[true,false],"refName":"Valid3","modelName":"Valid3"},"legacy":{"type":"boolean","description":"Indicates if this link branding was created using the legacy whitelabel tool. If it is a legacy whitelabel, it will still function, but you'll need to create new link branding if you need to update it.","enum":[true,false],"refName":"Legacy","modelName":"Legacy"},"dns":{"type":"object","description":"The DNS records generated for this link branding.","required":["domain_cname"],"properties":{"domain_cname":{"type":"object","description":"The DNS record generated to point to your link branding subdomain.","required":["valid","type","host","data"],"properties":{"valid":{"type":"boolean","description":"Indicates if the DNS record is valid.","enum":[true,false],"refName":"Valid4","modelName":"Valid4"},"type":{"type":"string","description":"The type of DNS record that was generated.","enum":["cname","txt","mx"],"refName":"Type","modelName":"Type"},"host":{"type":"string","description":"The domain that this link branding will use for the links in your email."},"data":{"type":"string","description":"The domain that the DNS record points to."}}},"owner_cname":{"type":"object","description":"The DNS record generated to verify who created the link branding.","required":["valid","host","data"],"properties":{"valid":{"type":"boolean","description":"Indicates if the DNS record is valid.","enum":[true,false],"refName":"Valid5","modelName":"Valid5"},"type":{"type":"string","description":"The type of DNS record generated.","enum":["cname","txt","mx"],"refName":"Type1","modelName":"Type1"},"host":{"type":"string","description":"Used to verify the link branding. The subdomain of this domain is the ID of the user who created the link branding."},"data":{"type":"string","description":"The domain that the DNS record points to."}}}}}}},"examples":{"response":{"value":{"id":1,"domain":"example.com","subdomain":"mail","username":"john@example.com","user_id":7,"default":false,"valid":true,"legacy":false,"dns":{"domain_cname":{"valid":true,"type":"cname","host":"mail.example.com","data":"sendgrid.net"},"owner_cname":{"valid":true,"type":"cname","host":"7.example.com","data":"sendgrid.net"}}}}}}}}}]
```

Retrieve the default branded link

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

const request = {
  url: `/v3/whitelabel/links/default`,
  method: "GET",
};

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"))


response = sg.client.whitelabel.links.default.get()

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 response = await client.RequestAsync(
            method: SendGridClient.Method.GET, urlPath: "whitelabel/links/default");

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

```java
import com.sendgrid.*;
import java.io.IOException;

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.GET);
            request.setEndpoint("/whitelabel/links/default");
            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/links/default", host)
	request.Method = "GET"
	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);

try {
    $response = $sg->client
        ->whitelabel()
        ->links()
        ->default()
        ->get();
    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'])

response = sg.client.whitelabel.links.default.get()
puts response.status_code
puts response.headers
puts response.body
```

```bash
curl -X GET "https://api.sendgrid.com/v3/whitelabel/links/default" \
--header "Authorization: Bearer $SENDGRID_API_KEY"
```
