Creating Auto SSL Link Branding Records Using the Twilio SendGrid API

Objective

Programmatically create Link Branding records provisioned for Auto SSL

Product

Twilio SendGrid

Process

Creating Auto-SSL records via the API is as easy as adding the Auto SSL parameter ("auto_ssl":true) to the body of your API call. 

Endpoint: POST https://api.sendgrid.com/v3/whitelabel/links

Body: 

{
"domain": "twilio.com",
"region": "global",
"auto_ssl": true
}

Response:

{
    "id": 5629083,
    "user_id": {your_user_id},
    "domain": "twilio.com",
    "subdomain": "url3629",
    "username": "{your_username}",
    "valid": false,
    "default": false,
    "legacy": false,
    "dns": {
        "domain_cname": {
            "valid": false,
            "type": "cname",
            "host": "url3629.twilio.com",
            "data": "click.sendgrid.net"
        },
        "owner_cname": {
            "valid": false,
            "type": "cname",
            "host": "8119916.twilio.com",
            "data": "sendgrid.net"
        },
        "acme_challenge_cname": {
            "valid": false,
            "type": "cname",
            "host": "_acme-challenge.url3629.twilio.com",
            "data": "url3629.twilio.com.4a767ed83ff78982.dcv.cloudflare.com"
        },
        "cf_custom_hostname_txt": {
            "valid": false,
            "type": "txt",
            "host": "_cf-custom-hostname.url3629.twilio.com",
            "data": "06231e2e-5d7c-40c0-9b4a-ee31c2a8e98b"
        }
    },
    "region": "global",
    "auto_ssl": true
}

Once you've input these records into your DNS panel, you can validate the Link Branding instance using POST /v3/whitelabel/links/{id}/validate and the ID returned in the response body of the first call. 

After validation, all links using this Link Branding will be https by default. 

 

 

 

Have more questions? Submit a request