connectDomain
Client function: start connecting a custom domain — requests an ACM cert and returns the DNS records to add.
import { connectDomain } from 'flowstack-sdk'Non-React client function. Kicks off custom-domain setup: requests the ACM certificate (DNS validation) and returns the validation + routing records to add at the registrar. Then poll getDomainStatus, and call activateDomain once the cert is issued. POST /api/v1/apps/{siteId}/domains with { domain }.
Signature
connectDomain(credentials, siteId, domain, config?): Promise<ApiResponse<ConnectDomainResult>>Parameters
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required | The app owner's credentials (owner-scoped JWT). |
siteId | string | required | The site/app id to operate on. |
domain | string | required | The custom domain, e.g. app.example.com. |
config | FlowstackClientConfig | since 0.2.8 | Client config (baseUrl, appScope, tenantId as needed). |
Returns
| Field | Type | Description |
|---|---|---|
| — | Promise<ApiResponse<ConnectDomainResult>> | ConnectDomainResult: { domain, site_id, status, cert_arn, validation_records, routing_record, message }. Add validation_records (and routing_record) at your DNS provider. |
Examples
Connect a domain
const res = await connectDomain(credentials, siteId, 'app.example.com', { appScope });
if (res.ok) {
for (const r of res.data.validation_records) console.log(`${r.type} ${r.name} -> ${r.value}`);
console.log('routing:', res.data.routing_record);
}NoteFlow:
connectDomain → add the returned DNS records → poll getDomainStatus until status: "issued" → activateDomain. CloudFront goes live ~5–15 min after activation.WarningOwner/management operation — call it with the app owner's credentials from a builder/dashboard/server context, not from inside the generated app's end-user runtime.
builtAppSafe is false.See also
getDomainStatus · activateDomain · listDomains · disconnectDomain · CustomDomainRecord
Source: src/api/client.ts (Custom Domains, P0-158) · Also available in llms-full.txt and registry.json.