Custom Domains
Serve your mock API from your own domain with automatic SSL certificate provisioning and DNS verification.
Overview
Custom domains let you serve your mock API endpoints from a domain you own (e.g., api.yourcompany.com) instead of the default MockAPI URL. This is useful for keeping API URLs consistent with your production setup or for white-labeling mock APIs.
Plan Requirement
Custom domains are available on the Team plan and above. See Plans & Billing for details.
Setting Up a Custom Domain
- 1
Navigate to Custom Domains
Go to Custom Domains in the dashboard sidebar and click "Add Domain".
- 2
Enter your domain
Enter the domain name you want to use (e.g.,
api.yourcompany.com). The domain must be a valid domain name that you control. - 3
- 4
Select verification method
Choose how you want to verify domain ownership: DNS record, HTTP file, or email verification. DNS verification is the most common and recommended method.
- 5
Configure DNS records
MockAPI provides the DNS records you need to add to your domain's DNS settings. Copy these records and add them with your domain registrar or DNS provider.
- 6
Verify ownership
After adding the DNS records, click "Verify" to start the verification process. DNS changes can take up to 48 hours to propagate, though most complete within minutes.
Verification Methods
| Method | How It Works | Best For |
|---|---|---|
| DNS | Add a TXT or CNAME record to your domain's DNS | Most common and recommended method |
| HTTP | Place a verification file at a specific URL on your domain | When you control the web server |
| Receive a verification email at admin@yourdomain.com | Quick verification for email-enabled domains |
Domain Status
After adding a domain, it goes through several status stages:
| Status | Description |
|---|---|
| Pending Verification | Domain has been added but not yet verified |
| Verifying | Verification is in progress |
| Verified | Domain ownership has been confirmed |
| Active | Domain is fully configured and serving API requests |
| Failed | Verification failed. Check your DNS records and try again |
| Suspended | Domain has been temporarily disabled |
SSL Certificates
MockAPI automatically provisions and manages SSL certificates for your custom domains using AWS Certificate Manager (ACM). When your domain is verified:
- An SSL certificate is automatically issued
- HTTPS is enabled on your custom domain
- Certificates are automatically renewed before expiration
You can also manually trigger a certificate renewal from the domain's settings if needed.
Using Your Custom Domain
Once your domain is active, you can use it in place of the default MockAPI URL. For example:
curl -H "x-api-key: YOUR_API_KEY" \
https://api.mockapi.com/userscurl -H "x-api-key: YOUR_API_KEY" \
https://api.yourcompany.com/usersAuthentication works the same way: you still need to include your API key in requests. The custom domain provides an alternative URL for accessing your mock endpoints.
Domain Statistics
Each custom domain tracks usage statistics so you can monitor traffic. View stats from the domain's detail page including total requests and recent activity.
Managing Domains
- View: See all domains and their status on the Custom Domains page
- Verify: Retry verification if it failed or check current status
- View Instructions: See the DNS configuration instructions again
- Renew Certificate: Manually renew the SSL certificate
- Delete: Remove a custom domain (the domain immediately stops serving requests)
Troubleshooting
DNS records not propagating
DNS changes can take up to 48 hours to propagate globally. If verification fails immediately after adding records, wait a few hours and try again. You can use online DNS lookup tools to check if your records are visible.
Verification keeps failing
Check these common issues:
- Verify the DNS records match exactly what MockAPI provided (including trailing dots)
- Ensure you're adding records to the correct domain/subdomain
- Check that no conflicting records exist (e.g., existing CNAME records)
- Confirm your DNS provider supports the required record types