# The @sypnia/domains package

> One npm package for servers and scripts.

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

For agents: @sypnia/domains subpaths: /server (search, quotes, purchases, domains, records, connections, renewals, transfers), /zone (zone files, diff), CLI; createDomains({apiKey} or {baseUrl}); search, quote, buy({quoteId, connect}), operations.wait; purchases need purchase scope held by owner/billing; ESM + types; Node 20+, Bun, Deno.

| Import                   | For                                                                           |
| ------------------------ | ----------------------------------------------------------------------------- |
| `@sypnia/domains/server` | search, quotes, purchases, domains, records, connections, renewals, transfers |
| `@sypnia/domains/zone`   | reading and writing zone files, comparing two zones                           |
| `npx @sypnia/domains`    | [the CLI](https://domains.docs.sypnia.com/tools/cli)                          |

```ts
import { createDomains } from '@sypnia/domains/server';
const domains = createDomains({ apiKey: process.env.SYPNIA_DOMAINS_KEY! });   // or { baseUrl } for your engine

const results = await domains.search('laespiga', { tlds: ['co', 'com'] });
const quote = await domains.quote({ name: 'laespiga.co', years: 1 });
const op = await domains.buy({ quoteId: quote.id, connect: [{ to: 'run:laespiga' }] });
await domains.operations.wait(op.id);
```

Purchases need a key with the `purchase` scope, held by an owner or billing member. ESM with types, Node 20+, Bun and Deno.
