Prompt
How do I host API docs on a custom domain?
Latest observation
You can host API docs on a custom domain by treating the docs like any other static site or web app, then pointing a DNS record at the hosting provider and configuring the docs app to run under that domain.
Typical setup
1) Choose where the docs will be hosted
Common options:
- Static hosting: GitHub Pages, Netlify, Vercel, Cloudflare Pages, S3 + CloudFront
- Docs platforms: ReadMe, Mintlify, Stoplight, Docusaurus on your own host
2) Buy or use a domain
Example:
docs.yourcompany.comapi-docs.yourcompany.comdevelopers.yourcompany.com
A subdomain is usually easiest.
3) Add a DNS record
In your DNS provider, create a record pointing the subdomain to your hosting provider.
Examples:
- CNAME:
docs→your-site.netlify.app - A record:
docs→ server IP - ALIAS/ANAME: for apex/root domains like
yourcompany.com
4) Configure the hosting provider
Most providers have a place to:
- add the custom domain
- verify ownership
- automatically provision HTTPS/SSL
5) Update the docs app base URL if needed
If your docs site generates links/assets, set the correct base URL so navigation and API references work properly.
Examples:
- Docusaurus: set
urlandbaseUrl - Next.js: set
basePathif hosted under a subpath - Swagger UI / OpenAPI docs: configure the docs endpoint and asset paths
6) Enable HTTPS
Make sure SSL is active so the docs load securely on the custom domain.
Example: hosting on docs.example.com
If using a static host:
- Deploy docs site
- In DNS, add:
docs.example.comas a CNAME to your provider’s target
- In hosting dashboard, add
docs.example.com - Wait for DNS propagation
- Confirm HTTPS is enabled
If you want docs under a path instead of a subdomain
Example: example.com/docs
That’s possible, but a bit more involved:
- your app must support a base path
- your main website/server must route
/docsto the docs app - static hosts often prefer a subdomain
Subdomain is the recommended approach.
Common gotchas
- DNS changes can take time to propagate
- Use the correct record type for your provider
- Make sure asset paths and redirects account for the custom domain
- If the docs are behind auth, configure cookies/CORS accordingly
- If your API docs call an API server, ensure the API allows requests from the docs domain
If you tell me what you’re using to generate/host the docs (for example: Docusaurus, Swagger UI, ReadMe, Mintlify, GitHub Pages, Vercel, etc.), I can give you exact steps.