# Connections

> What a connection is, what it writes, and how it is undone.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://domains.docs.sypnia.com/connect/connections/

For agents: Domains connections: connect <domain|subdomain> run:<app> | mail | files:<bucket> | data:<project>; asks product what it needs, writes owned records labeled with the connection, waits for product confirmation (certificate, verification) → connected; manual edit of owned records asks confirmation and marks drifted, connections repair; disconnect removes exactly those records; deleted resource → records removed the same minute (prevents subdomain takeover).

A **connection** links a domain or subdomain to a Sypnia resource and owns the records that make it work:

```bash
npx @sypnia/domains connect laespiga.co run:laespiga
npx @sypnia/domains connect laespiga.co mail
npx @sypnia/domains connect cdn.laespiga.co files:public
npx @sypnia/domains connect api.laespiga.co data:laespiga
npx @sypnia/domains connections ls laespiga.co
```

## What it does

1. It asks the product what it needs (addresses, verification tokens, certificate validation).
2. It writes those records in the zone, marked as owned by the connection.
3. It waits for the product to confirm (the certificate is issued, the domain is verified) and reports `connected`.

## Owned records

Records written by a connection are labeled with it. Editing one by hand asks for confirmation and marks the connection `drifted`, which the console shows; `connections repair` writes them again. `disconnect` removes exactly those records and nothing else.

## When the resource goes away

If the Run app, the Mail domain or the Files bucket is deleted, the connection removes its records the same minute, so no name is left pointing at something that no longer exists, which is how subdomain takeovers happen.
