Skip to content

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. 1

    Navigate to Custom Domains

    Go to Custom Domains in the dashboard sidebar and click "Add Domain".

  2. 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. 3

    Choose a protocol

    Select whether this domain will serve REST or GraphQL endpoints.

  4. 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. 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. 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

MethodHow It WorksBest For
DNSAdd a TXT or CNAME record to your domain's DNSMost common and recommended method
HTTPPlace a verification file at a specific URL on your domainWhen you control the web server
EmailReceive a verification email at admin@yourdomain.comQuick verification for email-enabled domains

Domain Status

After adding a domain, it goes through several status stages:

StatusDescription
Pending VerificationDomain has been added but not yet verified
VerifyingVerification is in progress
VerifiedDomain ownership has been confirmed
ActiveDomain is fully configured and serving API requests
FailedVerification failed. Check your DNS records and try again
SuspendedDomain 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:

Default URL
curl -H "x-api-key: YOUR_API_KEY" \
  https://api.mockapi.com/users
Custom domain URL
curl -H "x-api-key: YOUR_API_KEY" \
  https://api.yourcompany.com/users

Authentication 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