With the whitelabel API calls you will be able to retrieve whitelabel settings related to your account.

List

Parameter Required Requirements
task Yes Must be set to list

Call

POST https://api.sendgrid.com/apiv2/customer.whitelabel.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=list

Response

1
2
3
4
5
6
7
8
{
      mail_domain:'email.sendgrid.com',
      url_domain:'email.sendgrid.com'
  },
  {
      mail_domain:'email.example.com',
      url_domain:'email.example.com'
  }

Call

POST https://api.sendgrid.com/apiv2/customer.whitelabel.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=list

Response

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>

<whitelabels>
   <whitelabel>
      <mail_domain>email.sendgrid.com</mail_domain>
      <url_domain>email.sendgrid.com</url_domain>
   </whitelabel>
   <whitelabel>
      <mail_domain>email.example.com</mail_domain>
      <url_domain>email.example.com</url_domain>
   </whitelabel>
</whitelabels>

Append

Parameter Required Requirements
task Yes Must be set to append
user Yes Subuser must be registered under your account
mail_domain Yes Whitelabel mail_domain used to append a whitelabel record to a subuser

Call

POST https://api.sendgrid.com/apiv2/customer.whitelabel.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=append&user=example@example.com&mail_domain=email.sendgrid.com

Response

1
2
3
4
5
6
7
8
9
10
11
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.whitelabel.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=append&user=example@example.com&mail_domain=email.sendgrid.com

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error</message>
   <errors>
      ...
      <error>... error messages ...</error>
      ...
   </errors>
</result>