> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upcorda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Doohick Data Model: Core Objects and Relationships

> Learn about the core objects in Doohick — User, Workspace, Resource, Integration, and Webhook — and how they connect to each other.

Every action you take in Doohick creates, updates, or reads one of a small set of well-defined objects. Understanding these objects — and the relationships between them — makes it much easier to navigate the dashboard, write API queries, and design automation workflows. This page walks you through each object, its fields, and how it fits into the broader picture.

## Core objects

<AccordionGroup>
  <Accordion title="User">
    A **User** represents a person with a Doohick account. Users can belong to multiple workspaces and carry a role inside each one. Doohick creates a User record the moment someone completes sign-up.

    | Field        | Type       | Description                                           |
    | ------------ | ---------- | ----------------------------------------------------- |
    | `id`         | `string`   | Unique identifier for the user.                       |
    | `email`      | `string`   | The user's verified email address.                    |
    | `name`       | `string`   | The user's display name.                              |
    | `role`       | `enum`     | Workspace-scoped role: `owner`, `admin`, or `member`. |
    | `created_at` | `datetime` | ISO 8601 timestamp of account creation.               |

    ```json theme={null}
    {
      "id": "usr_01hx9v3k2n5qrwz8",
      "email": "alex@example.com",
      "name": "Alex Rivera",
      "role": "admin",
      "created_at": "2024-01-15T09:00:00Z"
    }
    ```
  </Accordion>

  <Accordion title="Workspace">
    A **Workspace** is the top-level container for your team's data. Resources, integrations, webhooks, and team members all belong to a workspace. Every workspace is tied to exactly one subscription plan, which controls usage limits and feature access.

    | Field        | Type       | Description                                                          |
    | ------------ | ---------- | -------------------------------------------------------------------- |
    | `id`         | `string`   | Unique identifier for the workspace.                                 |
    | `name`       | `string`   | Human-readable name chosen during setup.                             |
    | `owner_id`   | `string`   | The `id` of the User who created the workspace.                      |
    | `plan`       | `enum`     | Active subscription tier: `free`, `starter`, `pro`, or `enterprise`. |
    | `created_at` | `datetime` | ISO 8601 timestamp of workspace creation.                            |

    ```json theme={null}
    {
      "id": "ws_01hx9t7m4p2lqyb6",
      "name": "Acme Corp",
      "owner_id": "usr_01hx9v3k2n5qrwz8",
      "plan": "pro",
      "created_at": "2024-01-15T09:05:00Z"
    }
    ```
  </Accordion>

  <Accordion title="Resource">
    A **Resource** is the primary entity you create and manage inside Doohick. Resources have a flexible `metadata` object so you can attach any domain-specific fields without schema changes. Doohick tracks status transitions and records the last update time automatically.

    | Field          | Type       | Description                                              |
    | -------------- | ---------- | -------------------------------------------------------- |
    | `id`           | `string`   | Unique identifier for the resource.                      |
    | `name`         | `string`   | Human-readable label for the resource.                   |
    | `type`         | `string`   | Category or kind of resource, defined by your workspace. |
    | `status`       | `enum`     | Current state: `active`, `paused`, or `archived`.        |
    | `metadata`     | `object`   | Arbitrary key-value pairs for custom data.               |
    | `workspace_id` | `string`   | The `id` of the workspace this resource belongs to.      |
    | `created_at`   | `datetime` | ISO 8601 timestamp of creation.                          |
    | `updated_at`   | `datetime` | ISO 8601 timestamp of the last modification.             |

    ```json theme={null}
    {
      "id": "res_01hx9t7m4p2lqyb6",
      "name": "Primary Pipeline",
      "type": "pipeline",
      "status": "active",
      "metadata": {
        "region": "us-east-1",
        "priority": "high"
      },
      "workspace_id": "ws_01hx9t7m4p2lqyb6",
      "created_at": "2024-02-10T11:00:00Z",
      "updated_at": "2024-04-22T08:30:00Z"
    }
    ```
  </Accordion>

  <Accordion title="Integration">
    An **Integration** represents a live connection between your workspace and a third-party service. The `config` object stores provider-specific settings such as endpoint URLs or selected scopes — Doohick never exposes raw OAuth tokens through the API.

    | Field          | Type     | Description                                             |
    | -------------- | -------- | ------------------------------------------------------- |
    | `id`           | `string` | Unique identifier for the integration.                  |
    | `provider`     | `string` | Slug of the connected service, e.g. `github`, `stripe`. |
    | `status`       | `enum`   | Current state: `connected`, `disconnected`, or `error`. |
    | `config`       | `object` | Provider-specific settings chosen at setup time.        |
    | `workspace_id` | `string` | The `id` of the workspace that owns this integration.   |

    ```json theme={null}
    {
      "id": "int_01hx9u8n3q6mrxc4",
      "provider": "stripe",
      "status": "connected",
      "config": {
        "mode": "live",
        "sync_customers": true
      },
      "workspace_id": "ws_01hx9t7m4p2lqyb6"
    }
    ```
  </Accordion>

  <Accordion title="Webhook">
    A **Webhook** defines an outbound HTTP callback that Doohick fires when one of its subscribed events occurs. Each webhook carries a `secret` that Doohick uses to sign payloads — always verify this signature in your handler before trusting the payload content.

    | Field    | Type     | Description                                            |
    | -------- | -------- | ------------------------------------------------------ |
    | `id`     | `string` | Unique identifier for the webhook.                     |
    | `url`    | `string` | The HTTPS endpoint that receives event payloads.       |
    | `events` | `array`  | List of event names this webhook subscribes to.        |
    | `secret` | `string` | Signing secret used to generate `X-Doohick-Signature`. |
    | `status` | `enum`   | Current state: `enabled` or `disabled`.                |

    ```json theme={null}
    {
      "id": "wh_01hx9w2p5r8ntzd7",
      "url": "https://hooks.example.com/doohick",
      "events": [
        "resource.status_changed",
        "integration.disconnected"
      ],
      "secret": "whsec_••••••••••••••••",
      "status": "enabled"
    }
    ```
  </Accordion>
</AccordionGroup>

## Object relationships

The diagram below shows how the five core objects relate to each other. A **Workspace** is the root — everything else hangs off it, and Resources can independently trigger Webhooks when their state changes.

```mermaid theme={null}
erDiagram
  Workspace ||--o{ User : "has members"
  Workspace ||--o{ Resource : "contains"
  Workspace ||--o{ Integration : "connects"
  Workspace ||--o{ Webhook : "sends"
  Resource ||--o{ Webhook : "triggers"
```

<Note>
  The Doohick REST API returns all of these objects as JSON. Field names use `snake_case`, and all timestamps are formatted as ISO 8601 strings in UTC.
</Note>

<CardGroup cols={2}>
  <Card title="REST API Reference" icon="code" href="/api/introduction">
    See the full field-level documentation for every object, including optional fields and enumerations.
  </Card>

  <Card title="Platform Overview" icon="map" href="/concepts/overview">
    Go back to the high-level walkthrough to see how these objects fit into the Doohick workflow.
  </Card>
</CardGroup>
