kna.sh

Guides

Documentation

How kna.sh short links work, and how to brand them with path prefixes, *.g.kna.sh hosts, and your own domain via CNAME.

Path prefixes on kna.sh

Organization admins can claim a unique path prefix so automatic short links look like:

https://kna.sh/{prefix}/{link_id}
  • 1–12 characters: letters, digits, . _ ~ -
  • Profanity filtered; cannot match reserved paths (login, about, links, …)
  • Unique across all organizations (case-insensitive)

Configure under Account in the console, or PATCH /api/v1/customer with path_prefix.

Bare IDs (https://kna.sh/{id}) still work after you claim a prefix.

Branded hosts (*.g.kna.sh)

Optionally claim a label under g.kna.sh (min 3 characters, not purely numeric):

https://acme.g.kna.sh/{id}
https://acme.g.kna.sh/{prefix}/{id}   # if path prefix is set

Labels are unique platform-wide. Platform DNS maps *.g.kna.sh to the kna.sh service. Set the label in Account or via hostname on PATCH /api/v1/customer.

Custom domains (CNAME)

Use your own hostname (for example go.mydomain.com) so short links look fully on-brand. Traffic reaches kna.sh through a DNS CNAME to the shared target cd.kna.sh.

Requirements

  • You control DNS for the domain (or subdomain) you want to use
  • A subdomain is recommended (apex domains often cannot use CNAME)
  • Admin role on your kna.sh organization

Setup steps

  1. Choose a hostname
    Example: go.mydomain.com or links.brand.com. You cannot use *.kna.sh or other platform hosts.
  2. Create the CNAME in DNS
    At your DNS provider, add a record:
    go.mydomain.com.   CNAME   cd.kna.sh.
    TTL can be low (e.g. 300s) while testing. Propagation may take a few minutes to hours.
  3. Claim the domain in kna.sh
    Open console.kna.sh/accountCustom domain, enter the hostname (e.g. go.mydomain.com), and Save branding. The domain is reserved for your organization but remains unverified until DNS checks succeed.
  4. Verify DNS
    Click Verify DNS (or call POST /api/v1/customer/custom-domain/verify). kna.sh looks up the CNAME chain and expects it to resolve to cd.kna.sh.
  5. Use verified short links
    After verification, new and existing automatic short URLs for your org prefer:
    https://go.mydomain.com/{id}
    https://go.mydomain.com/{prefix}/{id}   # if you also set a path prefix
    Only links that belong to your organization resolve on that host.

DNS checklist

Item Value
Record type CNAME
Name / host Your subdomain (e.g. go or go.mydomain.com)
Target / value cd.kna.sh
Proxy mode Prefer DNS-only / grey-cloud if your provider offers a proxy (Cloudflare, etc.)

Verify from the command line

dig +short CNAME go.mydomain.com
# expect: cd.kna.sh.

# or
host -t CNAME go.mydomain.com

API

# Claim domain (session or admin Bearer not required — use session / cookie from console)
curl -X PATCH https://api.kna.sh/api/v1/customer \
  -H "Content-Type: application/json" \
  -H "Cookie: knash_session=…" \
  -d '{"custom_domain":"go.mydomain.com"}'

# Re-check CNAME
curl -X POST https://api.kna.sh/api/v1/customer/custom-domain/verify \
  -H "Cookie: knash_session=…"

Response fields include custom_domain, custom_domain_verified, and custom_domain_cname_target (default cd.kna.sh).

Troubleshooting

  • Verification fails — confirm the CNAME is published, not a flat A record, and that the name matches exactly what you entered (no extra path or https://).
  • Domain already taken — another organization claimed that hostname.
  • Links still show kna.sh — domain is saved but not verified yet; run Verify DNS.
  • HTTPS / certificate errors — TLS for customer hostnames is handled on the kna.sh edge (load balancer). After DNS is correct, allow time for certificate provisioning if a new hostname was just added. Contact support if the CNAME is verified but HTTPS fails.
  • Clearing a domain — set custom domain to empty in Account and save; the claim is released for others.

Security: Unverified custom domains do not serve your short links. Only a verified domain on your organization will redirect your link IDs.

Vanity (custom) paths

Optional custom slugs keep letter casing when created; lookup is case-insensitive. Reserved names (e.g. login, about) cannot be used.

Where a vanity path is served (same link, several hosts):

  • Always: https://go.kna.sh/{slug}
  • If your org has a path prefix: https://kna.sh/{prefix}/{slug}
  • If you have a verified custom domain: https://go.mydomain.com/{slug}

The short URL shown in the console prefers a verified custom domain, then a kna.sh path prefix, then go.kna.sh.

Which host is used?

For automatic (non-vanity) short URLs, kna.sh picks the first applicable option:

  1. Verified custom domain
  2. Branded *.g.kna.sh hostname
  3. kna.sh (with path prefix when claimed)

Vanity slugs always use go.kna.sh, independent of branding.

Console & API