# Entity & data model

Path: `/guide/data-model`
Summary: Tenant, Merchant, Channel, Warehouse and how they relate

The main entity is the **Tenant** — the customer of Pulpo WMS. Typically there is one
`tenant_id` per instance. (3PL fulfillers: A Tenant acting as a fulfiller serves multiple **Merchants** (its customers); each Merchant sells through one or more **Channels**. / single merchants: Your Tenant has a single default **Merchant** with one default **Channel** — so the merchant/channel layer stays out of your way.)

Here is how the core entities relate:

*Diagram — how the core entities relate. Master data hangs off the Tenant; orders are tied to a Warehouse. Tenant 1:n Users, Products, Third Parties, Warehouses. Warehouse 1:n Purchase Orders, Sales Orders, Fulfillment Orders. Orders reference a merchant and a channel.*

Select an entity to see its role and the endpoints that touch it:

*Diagram — entity model: Tenant → Merchant → Channel; Tenant → Warehouse; Tenant holds Products and Third Parties (master data); Purchase Orders, Sales Orders and Fulfillment Orders are tied to a Warehouse and carry merchant/channel.*

## How they relate

- A **Tenant** has multiple **Users**. When you log in, the user implicitly indicates the
  Tenant it belongs to, and which Merchants it may manage.
- A **Tenant** has **Products** and **Third Parties** — master data available across all
  warehouses. Products belong to a Merchant and can carry one or multiple **SKUs** (bounded
  by that Merchant's Channels). A SKU always points to the same physical product.
- **Third Parties** come in two types: **suppliers** (`type = S`, who deliver goods to
  increase stock) and **customers** (`type = C`, the recipients of sales orders). If you
  manage them yourself, account for the `third_party_id` Pulpo generates on each new entry.
- A **Tenant** has one or multiple **Warehouses**. Purchase Orders and Sales Orders are
  always tied to a specific Warehouse; Products and Third Parties are available for all of
  them.

> **Only for 3PL fulfillers:**
>
> > **WARNING: Merchant & Channel must match (3PL)**
> >
> > On a **Purchase Order**, the Merchant of the product and the Merchant of the supplier must
> > match the Merchant on the PO. On a **Sales Order**, the Merchant + Channel of the product,
> > the customer, and the order must all agree. Mismatches are the most common source of
> > rejected records.

> **Only for single merchants:**
>
> > **SUCCESS: One merchant, one channel**
> >
> > As a single merchant you have one default Merchant and Channel, so there is nothing to match —
> > every product, third party and order resolves to the same pair. You can usually omit
> > `merchant_id` and `merchant_channel_id` entirely.

## Sales Orders and Fulfillment Orders

A **Sales Order** can be split internally into multiple **Fulfillment Orders** based on
Tenant settings. In any case, one Sales Order always has **at least one** Fulfillment
Order — and the picking / packing / shipping workflow state lives on the Fulfillment
Order, not the Sales Order header.

> **TIP**
>
> Need the raw shapes? Every entity here links into the full
> [API Reference](/reference). Continue to the
> [process overview](/guide/process) to see how these entities move through the warehouse.

---

Website version: https://connect.pulpo.co/guide/data-model
Whole guide in one file: https://connect.pulpo.co/llms-full.txt
Index of all pages: https://connect.pulpo.co/llms.txt
