# Multi-Tenancy (/reference/concepts/multi-tenancy)



Tenant Context [#tenant-context]

Every entity in headless.ly is scoped to a tenant via the `$context` meta-field. This field is a namespace URL in the format `https://headless.ly/~{tenant}`:

```typescript
import { Contact } from '@headlessly/crm'

const contact = await Contact.create({ name: 'Alice', stage: 'Lead' })
console.log(contact.$context) // 'https://headless.ly/~acme'
```

The tenant is set once when the SDK is initialized. All subsequent operations are automatically scoped. There is no way to accidentally read or write data belonging to another tenant.

URL Pattern [#url-pattern]

Tenants are addressed via the `~` path prefix across all interfaces:

```
https://{subdomain}.headless.ly/~{tenant}/{Entity}
https://{subdomain}.headless.ly/~{tenant}/{Entity}/{id}
https://{subdomain}.headless.ly/~{tenant}/{Entity}/{id}/{verb}
```

```bash
