---
title: "Connect a purchased domain to an origin."
method: POST
path: "/v1/domain-purchases/{id}/connect"
tags: ["Domain purchases"]
---

# Connect a purchased domain to an origin.

`POST /v1/domain-purchases/{id}/connect`

## Request

- Base URL: `https://api.domainee.dev`
- URL: `https://api.domainee.dev/v1/domain-purchases/{id}/connect`
- Auth: HTTP bearer

Provisions the domain on Domainee's edge and writes the DNS records at the registrar in one call. No manual DNS step, because Domainee controls both sides. The DNS write is a merge: it replaces only the routing records at the apex and www, and leaves MX, TXT, SPF, DKIM, DMARC, CAA and subdomain records in place.

## Request body

- object
  - `originUrl` string, uri, required
  - `keepHost` boolean

## Response `200`

The purchase.

- object
  - `purchase` DomainPurchase, required: A domain registered through Domainee on the customer's behalf.
    - `id` string, required
    - `workspaceId` string, required
    - `hostname` string, required
    - `years` integer, required
    - `wholesaleCents` integer: Registrar cost at purchase time.
    - `feeCents` integer: Domainee's per-purchase fee.
    - `totalCents` integer: What the workspace was charged.
    - `currency` 'USD'
    - `registrar` 'namecheap'
    - `registrarDomainId` string, nullable
    - `status` 'pending' | 'completed' | 'failed' | 'refunded', required: `pending` means the charge cleared but the registration is not confirmed yet; a failed registration is refunded automatically.
    - `errorMessage` string, nullable
    - `registrant` object: Minimal owner snapshot. The registrar remains the source of truth.
      - `firstName` string
      - `lastName` string
      - `email` string, email
      - `country` string: ISO 3166-1 alpha-2.
    - `whoisPrivacyEnabled` boolean
    - `autoRenew` boolean
    - `expiresAt` string, date-time, nullable
    - `connectedDomainId` string, nullable: Set when the purchase was auto-connected to a /v1/domains entry.
    - `customerReference` string, nullable: Opaque caller-supplied reference, echoed on reads and webhooks.
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time

## Other responses

- `400`: The request body or query failed validation.
- `401`: Missing, malformed, revoked, or expired Bearer token.
- `404`: No such object in this workspace.
- `409`: The purchase is not in a connectable state.

---

[API](https://skmtc.dev/domainee/apis/domainee-api.md) · [All operations](https://skmtc.dev/domainee/apis/domainee-api/llms.txt) · [OpenAPI document](https://skmtc.dev/domainee/apis/domainee-api/revisions/756d54434372?raw)
