Domains

Domains

List all domains available for creating short links. This includes automatic placement, trust-based, standard, subdomain, and custom domains.

Domain Types

TypeExampleAccess
defaultautoAll plans; chooses by destination trust
trust-basedu2l.aiTrusted destinations; otherwise falls back to u.gy
standardu.gyAll plans
subdomainmyname.u2l.aiOwner only
customlinks.mysite.comOwner only (must be verified)

Subdomains and custom domains must be set up via the dashboard first. The API does not support adding or verifying new domains - only using existing ones when creating links.

GET /api/v1/domains

List all domain selections available for creating short links, including automatic placement and trust-based u2l.ai placement.

curl "https://u2l.ai/api/v1/domains" \
  -H "Authorization: Bearer u2l_live_your_api_key"
const response = await fetch("https://u2l.ai/api/v1/domains", {
  headers: {
    "Authorization": "Bearer u2l_live_your_api_key",
  },
});

const { domains } = await response.json();

// Use a domain when creating links
const linkResponse = await fetch("https://u2l.ai/api/v1/links", {
  method: "POST",
  headers: {
    "Authorization": "Bearer u2l_live_your_api_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com",
    domain: domains[0].domain,
  }),
});
import requests

response = requests.get(
    "https://u2l.ai/api/v1/domains",
    headers={"Authorization": "Bearer u2l_live_your_api_key"},
)

domains = response.json()["domains"]

# Use a domain when creating links
for domain in domains:
    print(f"{domain['domain']} ({domain['type']})")
{
  "domains": [
    {
      "domain": "auto",
      "type": "default",
      "verified": true,
      "placement": "automatic"
    },
    {
      "domain": "u2l.ai",
      "type": "trust-based",
      "verified": true,
      "placement": "trusted-only"
    },
    {
      "domain": "u.gy",
      "type": "standard",
      "verified": true
    },
    {
      "domain": "myname.u2l.ai",
      "type": "subdomain",
      "verified": true
    },
    {
      "domain": "links.mysite.com",
      "type": "custom",
      "verified": true
    }
  ]
}