Is it possible to setup SSL protected subdomains using the DigitalOcean API?

I am building an application that allows users to build out-static websites on a subdomain within my application. I am curious what the most scaleable way to go about this is.

Currently, I plan on using the DigitalOcean API’s domain endpoints to create new CNAME and A records for the user. but I am not sure how to also provide SSL solely through the API.

Techstack: Next.js, Vercel, Node, DigitalOcean, NGINX, MongoDB

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there @alexdc2,

I don’t think that this could be achieved via the API. The DigitalOcean managed SSL certificates, are primarily used for managed services like load balancers and Spaces.

In your case, you could have a different automation system on your server itself that triggers a Let’s Encrypt validation process once your DNS records are in place.

You could use the certbot command-line tool to do that. And you could build this into your application creation process right after the DNS creation step.

You could follow the steps on how to use certbot here:

Alternatively, you could issue a single wildcard SSL certificate for your main domain name and it would cover all of the possible subdomains (eg *, that way you would not have to issue separate SSL certificates for each subdomain. You could follow the steps here on how to set that up:

Hope that this helps!

Regards, Bobby