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 (1 domain), the Business plan (3 domains) and, without a limit, the Enterprise plan. See Plans & billing for details.

Setting up a custom domain

  1. 1

    Navigate to custom domains

    Open the Custom domains page 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 domain" 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

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.

Managing domains

  • View: See all domains and their status on the Custom domains page
  • Verify: Retry verification if it failed or check current status
  • 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