If you run a SaaS and need to allow your customers to manage/add their custom domains you can do that with Appliku's API.
Generate your API Key¶
https://app.appliku.com/dashboard/account/settings?tab=api
Go here and generate an API key.
Save it - you won't be able to get it again, only generate a new one. Also keep it safe - it effectively gives access to your Appliku account.
Check the domain's DNS setup correctness¶
Even with endpoint it is still a tricky one.
POST https://api.appliku.com/api/team/{team_path}/applications/{application_id}/domain_check
{
"domain": "your-custom-domain.com"
}
You can try this endpoint here
https://api.appliku.com/api/schema/swagger-ui/#/team/team_applications_domain_check_create
You can click the lock icon on the right and use the API key (prepend it withToken
(There is a space character!))
AAAA records can't be present A record can be different from the server IP though, example is set up with cloudflare proxied mode. We support that, but cloudflare must have SSL Full setting, or they will end up in a redirect loop. So you probably should warn user that it is not recommended setup, but still allow it if they are using cloudflare.
Adding a custom domain to your Application¶
To tell Appliku to add a custom domain to your application make a request:
POST https://api.appliku.com/api/team/{team_path}/applications/{application_id}/domains
{
"domain": "your-custom-domain.com"
}
you can try it here
https://api.appliku.com/api/schema/swagger-ui/#/team/team_applications_domains_create
And then check for the domain adding result via
GET https://api.appliku.com/api/team/{team_path}/applications/{application_id}/domains
You can try it here:
https://api.appliku.com/api/schema/swagger-ui/#/team/team_applications_domains_list
That's the example when there is one domain and it all went thru just fine:
[
{
"id": 18,
"domain": "mycustomdomainname.com",
"a_records": [
"3.126.219.48"
],
"aaaa_records": [],
"deployment_status": "2",
"deployment_status_text": "Deployed",
"logs": "Deploying domain configuration\nDeployment successful\n"
}
]
Of course, you probably don't want to show logs to your users.
This works for CNAME as well.
You'll need to create A-record where your users will be pointing their custom domains at let's say cn.yourapp.com
and they will have to create a CNAME record that points to cn.yourapp.com.
(dot at the end is significant!)
Remove a custom domain via API¶
When time comes to remove the domain, issue an API call:
DELETE https://api.appliku.com/api/team/{team_path}/applications/{application_id}/domains/{id}
Try it here: https://api.appliku.com/api/schema/swagger-ui/#/team/team_applications_domains_destroy