# API reference

Everything in the dcupl SDK, organized by the thing you're working with: the `Dcupl` and `DcuplList` classes from `@dcupl/core`, and the types from `@dcupl/common`. If you're new to dcupl, start with the [Quick start](/sdk/quick-start) and [Core concepts](/sdk/core-concepts) first — the reference assumes you already know what models, data, and lists are.

## At a glance

```typescript filename="dcupl.ts"
import { Dcupl } from '@dcupl/core';

const dcupl = new Dcupl(); // → Dcupl API
dcupl.models.set(/* ... */); // → Models API
dcupl.data.set(/* ... */); // → Data API
await dcupl.init();

const list = dcupl.lists.create(/* ... */); // → Lists API
list.catalog.query.addCondition(/* ... */); // → Catalog API
list.catalog.fn.facets(/* ... */); // → Functions API
```

Each block below links to the reference page for that API surface.

## Setup & lifecycle

The entry point and the building blocks you configure before calling `init()`.

| Reference                     | What lives here                                                                                                                                                                |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Dcupl class](/sdk/api/dcupl) | Constructor, `init()`, `update()`, `destroy()`, `on()`, global options, and the `views`, `scripts`, `loaders` and `quality` namespaces, which are documented only on this page |
| [Models API](/sdk/api/models) | Define models, properties, references, and validation rules                                                                                                                    |
| [Loader](/sdk/api/loader)     | `DcuplAppLoader` (`@dcupl/loader`): load models, data and scripts from the dcupl Console or your own sources                                                                   |
| [Events](/sdk/api/events)     | `dcupl.on()`, `list.on()`, `list.onResultChange()` and the event types they deliver                                                                                            |

## Data

Getting records in, out, and up to date.

| Reference                 | What lives here                                                                 |
| ------------------------- | ------------------------------------------------------------------------------- |
| [Data API](/sdk/api/data) | `set`, `update`, `upsert`, `remove`, `reset`, `apply` — staged until `update()` |

## Querying

The runtime query interface attached to every list, and the global one on the instance.

| Reference                                   | What lives here                                                                        |
| ------------------------------------------- | -------------------------------------------------------------------------------------- |
| [Lists API](/sdk/api/lists)                 | Create, get, and destroy lists; scoped lists, `update()`, `invalidate()`               |
| [Catalog API](/sdk/api/catalog)             | `query`, `fn`, result access, sorting, pagination                                      |
| [Global queries](/sdk/api/dcupl#query)      | `dcupl.query.one/many/execute` and `dcupl.fn.*`: query a model without creating a list |
| [Query operators](/sdk/api/query-operators) | All 10 operators — `eq`, `in`, `find`, ranges, logic groups                            |

## Analysis functions

Everything hanging off `catalog.fn` for building dashboards and filter UIs.

| Reference                           | What lives here                                                                                                              |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [Functions API](/sdk/api/functions) | The global `dcupl.fn.*` form, its `query` rule and errors; options and examples per function on [`/sdk/fn/`](/sdk/fn/facets) |

## Types

| Reference                          | What lives here                                                                   |
| ---------------------------------- | --------------------------------------------------------------------------------- |
| [Type definitions](/sdk/api/types) | The SDK's TypeScript types, exported from `@dcupl/common` (exceptions are marked) |

## Looking for something specific?

- **"How do I filter by..."** → [Query operators](/sdk/api/query-operators) or the [Basic filtering](/sdk/queries/query-filter) guide
- **"How do I count items per category?"** → [`facets()`](/sdk/fn/facets) and [`groupBy()`](/sdk/fn/group-by)
- **"Why is my init slow?"** → [Performance](/sdk/advanced/performance) and [Caching](/sdk/advanced/caching)
- **"How do I compute a value from other properties?"** → [Derived](/sdk/advanced/derived-properties) and [Expression properties](/sdk/advanced/expression-properties)
- **"What's the one-page cheatsheet?"** → [Quick reference](/sdk/reference)
