Amarsia
Concepts

Data Model

How Amarsia structures your data and the relationships between core resources.

Overview

Amarsia uses a hierarchical data model. Everything lives inside a Workspace, and resources within a workspace can reference each other through typed relationships.

Resource hierarchy

Workspace
├── Users
├── Resources
│   ├── Records
│   └── Events
└── Integrations
    └── Integration Configs

Core resources

Workspace

The workspace is the root namespace. API keys, settings, and all data are scoped to a workspace. A single account can own multiple workspaces.

{
  "id": "ws_01j...",
  "name": "Acme Inc.",
  "created_at": "2025-01-01T00:00:00Z"
}

Resource

A resource represents any entity you manage through Amarsia. Resources have a type, a set of fields, and belong to a workspace.

{
  "id": "res_01j...",
  "type": "contact",
  "fields": {
    "email": "jane@example.com",
    "name": "Jane Doe"
  },
  "workspace_id": "ws_01j...",
  "created_at": "2025-01-01T00:00:00Z"
}

Event

Events are immutable records of something that happened to a resource. They are append-only — you cannot update or delete an event.

{
  "id": "evt_01j...",
  "type": "contact.created",
  "resource_id": "res_01j...",
  "payload": { ... },
  "occurred_at": "2025-01-01T00:00:00Z"
}

IDs

All resource IDs are prefixed with a short type indicator (e.g. ws_, res_, evt_) followed by a ULID. This makes IDs globally unique and sortable by creation time.

You can sort a list of resources by creation time using their IDs directly — no created_at field required.