# Data model

> The sypnia_domains schema: domains, contacts, quotes, operations, zones, records, connections and renewals.

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

For agents: sypnia_domains schema: domains (registrar route53/external, expires_at, auto_renew, locked, privacy, state), contacts (email_verified_at), quotes (total_credits, expires_at), operations (kind, registrar_operation_id, state, credit_hold_id, error), zones (hosted_zone_id, name_servers, dnssec), records (desired state, owner user or connection), record_changes (before/after, actor, via), connections (host, target, state pending/connected/drifted/paused), renewal_plans (due_at, price_credits, set_aside_at, reminders_sent); hourly reconciler vs Route 53.

| Table            | Holds                                     | Key columns                                                                                                     |
| ---------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `domains`        | each domain of an organization            | `org_id`, `name`, `registrar` (`route53`, `external`), `expires_at`, `auto_renew`, `locked`, `privacy`, `state` |
| `contacts`       | registrant and other contacts             | `org_id`, `kind`, fields required by the ending, `email_verified_at`                                            |
| `quotes`         | a price held for 15 minutes               | `name`, `years`, `total_credits`, `contact_id`, `expires_at`                                                    |
| `operations`     | registrations, renewals, transfers, moves | `kind`, `domain`, `registrar_operation_id`, `state`, `credit_hold_id`, `error`                                  |
| `zones`          | a hosted zone                             | `domain_id` (or a DNS-only name), `hosted_zone_id`, `name_servers[]`, `dnssec`                                  |
| `records`        | the desired state of each record set      | `zone_id`, `name`, `type`, `ttl`, `values[]`, `owner` (`user` or a connection id)                               |
| `record_changes` | the history                               | `zone_id`, `before`, `after`, `actor`, `via`, `at`                                                              |
| `connections`    | domain ↔ resource                         | `host`, `target` (`run:…`, `mail`, `files:…`, `data:…`), `state` (`pending`, `connected`, `drifted`, `paused`)  |
| `renewal_plans`  | the next renewal                          | `domain_id`, `due_at`, `price_credits`, `set_aside_at`, `reminders_sent[]`                                      |

The desired state in `records` is the truth; a reconciler compares it with Route 53 every hour and reports differences made outside Domains.
