UniLink API: Domains Endpoint (Manage Custom Domains Programmatically)

By UniLink May 02, 2026 10 min read
UniLink API: Domains Endpoint (Manage Custom Domains Programmatically)


UniLink API: Domains Endpoint (Manage Custom Domains Programmatically)

The /domains endpoint lets you connect, verify, and remove custom domains via API — the foundation for agencies that provision branded pages at scale without manual dashboard work.

  • Use GET /domains to list all connected custom domains and their current SSL and verification status.
  • Add a new domain with POST /domains and poll GET /domains/{id}/verify to track DNS propagation.
  • The endpoint is designed for agency automation — provision a custom domain for each client page programmatically.

For agencies managing dozens of client UniLink pages, manually connecting a custom domain through the dashboard for each client is a significant time sink. The /domains endpoint removes that friction entirely: your onboarding workflow can add the domain, monitor verification status, and confirm the SSL certificate is active — all without anyone touching the dashboard. The same endpoint powers automated provisioning tools, white-label reseller platforms, and client onboarding scripts that need to set up a fully branded UniLink page as part of a larger workflow.

What the Domains Endpoint Does

The GET /domains endpoint returns a list of all custom domains connected to your UniLink account. Each domain object includes the domain string (e.g., links.example.com), the status field with one of three values (pending, active, or error), the ssl_status field (pending, active, or failed), and the page_id of the UniLink page the domain is mapped to. This single list call tells you the complete state of your domain infrastructure without needing to check each domain individually.

Adding a new domain with POST /domains creates a domain record in pending status and returns the DNS records your customer needs to configure with their domain registrar. The response includes a cname_target value — the hostname your customer must point their DNS CNAME record to — and optionally a txt_verification token for TXT-based domain ownership verification if CNAME verification is not available. Once your customer configures DNS, you poll GET /domains/{id}/verify to check propagation status; the response updates to active once the DNS record is detected and the SSL certificate is issued.

Removing a domain with DELETE /domains/{id} disconnects the custom domain from the page and removes the SSL certificate. The domain is not deleted from the customer's registrar — that is outside UniLink's control — but traffic arriving on that domain will no longer resolve to the UniLink page. If the domain is later re-added to the same or a different page, it goes through the verification flow again from the beginning. The associated UniLink page continues to function on its default unil.ink/username URL regardless of whether a custom domain is connected.

How to Get Started

  1. Generate an API key with write scope from Settings → API in your dashboard at app.unilink.us. POST and DELETE operations on domains require at minimum write scope; DELETE requires admin scope.
  2. List your existing domains to understand the response structure: curl -H "Authorization: Bearer YOUR_KEY" https://unilink.us/api/v1/domains. Review the status, ssl_status, and page_id field values.
  3. Identify the page ID you want to attach a domain to by calling GET /pages and noting the ID of the target page.
  4. Add a test domain: POST /domains with body {"domain": "test.yourdomain.com", "page_id": "{page_id}"}. The response contains the cname_target DNS record to configure.
  5. Poll the verification endpoint after configuring DNS: GET /domains/{id}/verify. Expect the status to remain pending during DNS propagation (minutes to hours) before transitioning to active.

How to Use the Domains Endpoint

  1. List domains and check status: GET /domains — scan the list for any entries with status: "error" or ssl_status: "failed" to surface domains that need attention in your monitoring dashboard.
  2. Add a domain: POST /domains with JSON body {"domain": "links.clientsite.com", "page_id": "abc123"}. Extract cname_target from the response and display it to the client as the DNS record to set.
  3. Check verification status: GET /domains/{id}/verify — poll this endpoint every 5 minutes after DNS configuration. The response returns {"status": "pending"} until DNS propagates, then {"status": "active", "ssl_status": "active"}.
  4. Fetch a single domain: GET /domains/{id} returns the full domain object including current status, SSL status, and associated page ID. Use this for status display in your agency client portal.
  5. Remove a domain: DELETE /domains/{id} requires admin scope. The domain is disconnected immediately; the associated page remains accessible on its default unil.ink URL.

Key Settings

SettingWhat It DoesRecommended
domainThe custom hostname to connect (e.g., links.example.com)Use a subdomain (e.g., links. or bio.) rather than a root domain for easier DNS configuration
page_idThe UniLink page this domain serves traffic toOne domain maps to one page — create one domain record per client page in multi-client setups
statusCurrent domain connection state: pending, active, or errorMonitor for error status and alert your team — it indicates a DNS misconfiguration or a lapsed certificate
ssl_statusTLS certificate state: pending, active, or failedSSL is provisioned automatically after DNS verification — failed SSL usually means the CNAME was removed after initial setup
cname_targetThe DNS target your customer must point their CNAME record toDisplay this value prominently in client onboarding flows — it is the single required DNS change
Tip: Build a polling job that runs GET /domains daily and alerts you when any domain transitions to status: "error" or ssl_status: "failed". SSL certificates can fail if a client changes their DNS configuration after initial setup. Catching these proactively — before clients notice their branded page is broken — is a high-value service for agency operations.

Get the Most Out Of the Domains Endpoint

Design your client onboarding workflow as a step-by-step state machine driven by the domain status field. Step 1: create the UniLink page and record the page ID. Step 2: call POST /domains and surface the cname_target to the client. Step 3: poll GET /domains/{id}/verify on a schedule and email the client when status reaches active. Step 4: confirm with a final status check that ssl_status is also active. Each step has a clear API call and a clear completion condition, making the workflow automatable end-to-end.

For white-label reseller platforms, store the UniLink domain ID alongside the client record in your database. This gives you the reference needed to check status, update the page association, or delete the domain if a client churns — without scanning all your domains to find the right one. Include the domain ID in your client object at provisioning time, not as an afterthought.

DNS propagation times vary from minutes to 48 hours depending on the registrar and TTL settings. Design your verification polling with exponential backoff rather than a fixed interval: poll at 5, 10, 20, 40 minute intervals rather than every minute. This keeps your API call volume low during long propagation windows while still detecting fast propagations quickly. After 48 hours without an active status, escalate to a human review — the DNS configuration likely has an error.

If you manage domains across multiple UniLink accounts — for example, each agency client has their own UniLink account — you will need a separate API key per account. The domains endpoint is scoped to a single account; there is no cross-account domain management endpoint. Structure your provisioning script to accept an account API key as a parameter and call the domains endpoint with that key for each client account independently.

Troubleshooting

ProblemCauseFix
Domain stuck in pending after 48 hoursDNS CNAME record not configured, wrong target, or TTL too highHave the client verify the CNAME record in their DNS panel — check both the subdomain name and the target value match exactly what the API returned in cname_target
ssl_status shows failed after domain was activeClient removed or changed the CNAME record after initial setupAsk the client to restore the CNAME record; SSL re-provisioning triggers automatically once DNS is valid again
POST returns 422 with "domain already connected"The domain is already linked to a different page on your accountCall GET /domains to find the existing domain record, then either use that page ID or DELETE the existing record before re-adding
DELETE returns 403API key scope is write, not adminGenerate a new admin-scope key for domain deletion, or remove the domain through the dashboard
  • Verification polling endpoint makes it easy to build a status-aware onboarding flow without manual dashboard checking
  • SSL is provisioned automatically after DNS verification — no separate certificate management step needed
  • Domain status and SSL status are exposed separately, giving precise visibility into each part of the setup
  • Fits naturally into agency automation workflows — one API call per client to provision a branded domain
  • DNS propagation is outside UniLink's control — provisioning workflows must handle long verification windows gracefully
  • DELETE requires admin scope — builds that only need to add domains must still request admin keys for full lifecycle management
  • No cross-account domain management — agency clients with separate accounts each need their own API key
Can I connect a root domain (e.g., example.com) instead of a subdomain?

Root domain support depends on your domain registrar's CNAME capabilities. Most registrars do not support CNAME on the root (apex) domain. Use a subdomain like links.example.com or bio.example.com for reliable compatibility. Some registrars support ALIAS or ANAME records at the root — check with your registrar for specifics.

Can one custom domain serve multiple UniLink pages?

No — each custom domain maps to exactly one UniLink page via the page_id field. For multiple pages, use multiple subdomains (e.g., shop.example.com and links.example.com) each connected to a separate page.

Does UniLink charge extra for custom domains?

Custom domain support is available on Pro and Business plans at no additional per-domain charge. The number of domains you can connect depends on your plan tier. Check the pricing page at unilink.us/pricing for current limits.

What happens to the custom domain if the linked page is deleted?

If the linked page is deleted, the domain record remains but serves no content — visitors will see a 404 or error page. To clean up, call DELETE /domains/{id} after deleting the page, or reassign the domain to a different page with a PUT update to the page_id field.

How long does SSL provisioning take after DNS verification?

SSL certificates are typically issued within 5–10 minutes of DNS verification completing. In rare cases it can take up to an hour. If ssl_status remains pending for more than two hours after the domain status shows active, contact UniLink support.

  • The domains endpoint base URL is https://unilink.us/api/v1/domains — POST to add, GET to monitor, DELETE to remove.
  • After adding a domain, surface the cname_target value to clients — it is the only DNS record they need to configure.
  • Poll GET /domains/{id}/verify with exponential backoff to track verification progress without hammering the API.
  • Monitor all domains daily for status: "error" — proactive alerting catches broken domains before clients notice.
  • Store the UniLink domain ID in your client database at provisioning time for clean lifecycle management later.

Start automating custom domain provisioning for your clients — generate an API key at app.unilink.us under Settings → API and make your first GET /domains call today.

Create Your Free Link-in-Bio Page

Join thousands of creators using UniLink. 40+ blocks, analytics, e-commerce, and AI tools — all free.

Get Started Free