Your first domain in two calls

Your API key needs the destinations:write and domains:write scopes.

1. Configure the destination

BASH
curl -X POST https://api.subdomain.to/v1/destinations \
  -H "Authorization: Bearer $SUBDOMAIN_TO_API_KEY" \
  -H "Idempotency-Key: main-destination" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://app.example.com"}'

2. Connect the customer domain

Create the domain
curl -X POST https://api.subdomain.to/v1/domains \
  -H "Authorization: Bearer $SUBDOMAIN_TO_API_KEY" \
  -H "Idempotency-Key: customer-42-domain" \
  -H "Content-Type: application/json" \
  -d '{"hostname":"portal.customer.com"}'

Show the returned dns_records to your customer, then poll GET /domains/{id} until status is active, or subscribe to webhooks.