> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Tenant Domain Management — Integration

> Feature ID: PF-77 Status: \U0001F4DD Specification -tenant-domain-management.md Last Updated: 2026-03-13

**Feature ID:** PF-77\
**Status:** 📝 Specification\
**Spec:** [PF-77-tenant-domain-management.md](../../../specs/pf/specs/PF-77-tenant-domain-management.md)\
**Last Updated:** 2026-03-13

***

## Overview

PF-77 adds tenant-scoped custom domain lifecycle (add, verify, SSL, activate, remove) with persistence in `pf_tenant_domains` and backend/edge calls to Vercel project-domain APIs. It defines canonical host policy (apex vs www; subdomain vs custom domain) and integrates with PF-01 (organizations) and PF-74 (path-based routing).

***

## Integration Points (from Spec)

| Dependency                       | Pattern        | Purpose                                                                                                                                                  |
| -------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PF-01 (Organizations)            | Data           | `organization_id` on `pf_tenant_domains`; org context for domain list and mutations.                                                                     |
| PF-74 (Organization URL Routing) | Platform / Doc | Path-based routing unchanged; PF-77 adds optional custom-domain host and canonical policy.                                                               |
| Vercel                           | API (external) | [Domain management for multi-tenant](https://vercel.com/docs/multi-tenant/domain-management) — add domain, verify, SSL, remove; 63-char DNS label limit. |

***

## Platform Layer Usage

* **Organizations:** Domain list and add/remove are scoped by `organization_id`; RLS uses `pf_has_org_access` and `pf_is_org_admin`.
* **Edge/backend:** `tenant-domain-manage` (or equivalent) calls Vercel SDK/API when `VERCEL_TOKEN` is set; persists status and errors in `pf_tenant_domains`.

***

## Event / API Contracts

No new platform event contracts. External API: Vercel project-domain APIs (add, verify, get, remove). Internal: Edge function invoked by org settings UI for add, verify, status refresh, remove.

***

## Related Docs

* [CROSS\_CORE\_INTEGRATIONS.md](./CROSS_CORE_INTEGRATIONS.md)
* [canonical-host-policy.md](../../development/canonical-host-policy.md) — apex vs www; subdomain vs custom domain.
