Skip to content

Multi-tenancy

Hypemarket is multi-tenant. Each brand is an Organization. Users join brands via memberships, which carry a role (member or admin).

Most endpoints are scoped to an organization (brand) via the URL:

/organizations/:organization_id/...

The token authenticates the user; the URL identifies the organization. The user must be a member of that organization or the request returns:

  • 404 Not Found — the org doesn’t exist for you
  • 403 Forbidden — membership found but the action isn’t permitted by your role

A separate /me/... namespace covers resources that belong to a user directly, not a brand:

Each membership has a role:

RoleCan readCan mutate brand resources
member✗ (read-only on most resources)
admin

The brand owner is an admin who additionally cannot be removed or demoted.

Most agents should:

  1. GET /organizations.json to list the brands the user belongs to
  2. Let the user pick (or, for single-org users, auto-select)
  3. Cache the selected organization_id for the session
  4. Prepend it to every brand-scoped URL

For the structure of an Organization object, see the Organizations reference.