# Organization

The resource hierarchy is Tenant, Workspace, Environment, and Deployment. These endpoints manage the first three levels through `https://api.laserdata.cloud`.

## Tenant

### List Tenants

`GET /tenants`

List the organizations the caller can reach.

```bash
curl https://api.laserdata.cloud/tenants \
-H "ld-api-key: YOUR_API_KEY"
```

```json
[
  {
    "id": 1,
    "name": "Acme Corp",
    "protected": false,
    "created_at": "2025-01-10T08:00:00Z",
    "updated_at": "2025-06-15T12:30:00Z"
  }
]
```

An API key belongs to one organization, so with a key the list holds exactly that organization, even when the user who created the key belongs to several. Use it to read the `tenant_id` that every other route takes in its path. A Console session lists every organization the user belongs to.

### Get Tenant

`GET /tenants/{tenant_id}`

Retrieve tenant details including plan, features, and resource limits.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id} \
-H "ld-api-key: YOUR_API_KEY"
```

```json
{
  "id": 1,
  "name": "Acme Corp",
  "description": "Main production tenant",
  "email": "admin@acme.com",
  "protected": false,
  "created_at": "2025-01-10T08:00:00Z",
  "updated_at": "2025-06-15T12:30:00Z",
  "features": {
    "invitations_limit": 100,
    "members_limit": 100,
    "roles_limit": 20,
    "workspaces_limit": 10,
    "environments_limit": 100,
    "deployment_tiers": [
      { "tier": "free", "limit": 1 },
      { "tier": "small", "limit": 3 },
      { "tier": "medium", "limit": 3 },
      { "tier": "large", "limit": 2 },
      { "tier": "xlarge", "limit": 1 },
      { "tier": "2xlarge", "limit": 1 }
    ],
    "deployment_access_rules_limit": 10,
    "deployment_configs_limit": 5,
    "deployment_backups_limit": 3,
    "deployment_snapshots_limit": 5,
    "private_connections_limit": 3,
    "private_endpoints_limit": 1,
    "byoc_enabled": true,
    "cluster_enabled": true,
    "on_premise_enabled": false,
    "private_networking_enabled": true,
    "multi_az_enabled": true,
    "dedicated_enabled": false,
    "backup_enabled": true,
    "cross_region_dr_enabled": false,
    "audit_retention_days": 30,
    "api_keys_limit": 10,
    "cloud_accounts_limit": 5,
    "notification_channels_limit": 5,
    "notification_subscriptions_limit": 10,
    "custom_domains_limit": 1,
    "backup_regions_limit": 3,
    "nodes_per_deployment_limit": 5,
    "backup_retention_days": 30,
    "snapshot_retention_days": 14,
    "pending_invitations_limit": 100,
    "api_key_allowed_ips_limit": 20,
    "workspaces_per_role_limit": 3,
    "environments_per_workspace_limit": 3,
    "concurrent_deployments_limit": 2,
    "audit_export_enabled": true,
    "advanced_connectors_enabled": true,
    "customer_managed_keys_enabled": false,
    "advanced_notification_channels_enabled": true
  },
  "subscription": {
    "id": 1,
    "plan": "performance",
    "active": true,
    "created_at": "2025-01-10T08:00:00Z",
    "valid_from": "2025-01-10T08:00:00Z",
    "valid_to": "2026-01-10T08:00:00Z",
    "terms": {
      "currency": "USD",
      "monthly_amount": "0",
      "add_ons": []
    }
  },
  "starter_available": true,
  "has_payment_method": true,
  "has_custom_email_domain": true
}
```

`features` reports plan limits and capabilities. `deployment_tiers` reports allowed tiers and deployment counts. `subscription.terms` reports the price the active plan was taken at: the plan's `monthly_amount` and each attached add-on with its `code`, `label`, and `monthly_amount`. It is absent for a plan taken before account plan pricing. `starter_available` reports whether another Free deployment can be created. `has_payment_method` is `true` for a valid card or invoice agreement.

`has_custom_email_domain` is `true` for tenants that claimed a corporate domain during sign-up. It is `false` for public email providers such as Gmail and Outlook. This field controls access to domain-based join policy and invitation restrictions in [Tenant Config](#get-tenant-config).

This request requires `info:read`.

### Update Tenant

`PUT /tenants/{tenant_id}`

Update the tenant display name.

```bash
curl -X PUT https://api.laserdata.cloud/tenants/{tenant_id} \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "name": "Acme Corporation",
  "description": "Updated description",
  "email": "admin@acme.com",
  "protected": true
}'
```

Include only fields that you want to change. `protected: true` enables protection, which requires a one-time code for deletion. A successful request returns `204 No Content`.

### Change Plan

`POST /tenants/{tenant_id}/subscriptions`

Switch the organization between the Standard and Performance plans.

```bash
curl -X POST https://api.laserdata.cloud/tenants/{tenant_id}/subscriptions \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "plan": "performance"
}'
```

`plan` is `standard` or `performance`. The caller needs the `subscription:manage` tenant permission. The organization limits switch to the defaults of the new plan. A successful request returns `204 No Content`.

The request returns `400 Bad Request` for `enterprise` and for an organization already on Enterprise, because Enterprise changes need approval from LaserData. A downgrade returns `409 Conflict` while a deployment exceeds the target plan, either through more deployments of a size than the plan allows or through a managed tier above the plan. Any change returns `409 Conflict` with code `plan_limits_set_by_admin` when LaserData set the organization's limits by agreement. Contact LaserData to change that plan.

A target plan with a monthly price returns `402 Payment Required` until the organization has a valid payment method. See [Account Plans](/organization/billing#account-plans).

### Get Organization Structure

`GET /tenants/{tenant_id}/structure`

Organization tree that the caller can see: workspaces, environments, and deployments. Items outside the caller's permissions are left out.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id}/structure \
-H "ld-api-key: YOUR_API_KEY"
```

This request requires `info:read` on the organization and answers `403` without it.

### Get Tenant Summary

`GET /tenants/{tenant_id}/summary`

Counts of the workspaces, environments, and deployments that the caller can see.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id}/summary \
-H "ld-api-key: YOUR_API_KEY"
```

### Get Tenant Config

`GET /tenants/{tenant_id}/config`

Read the organization's join policy, invitation controls, and claimed email domain.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id}/config \
-H "ld-api-key: YOUR_API_KEY"
```

```json
{
  "join_policy": "invite_only",
  "block_external_invitations": false,
  "enforce_domain_only_invitations": false,
  "email_domain": "acme.com",
  "email_domain_verified_at": "2026-05-05T12:00:00Z"
}
```

| Field | Description |
| --- | --- |
| `join_policy` | What happens when a new user signs up with an email matching `email_domain`. One of `invite_only` (default), `open`, `request_to_join`. |
| `block_external_invitations` | When `true`, other tenants cannot invite users on this domain. Requires `email_domain` to be set. Defaults to `false`. |
| `enforce_domain_only_invitations` | When `true`, this tenant can only invite users whose email matches `email_domain` (or one of its claimed workspace subdomains). Requires `email_domain` to be set. Defaults to `false`. |
| `email_domain` | The registrable domain the tenant claimed at signup. Omitted when the tenant was created with a public-email provider (Gmail, Outlook, etc.). Immutable. |
| `email_domain_verified_at` | When the claim was verified. For now, set to the signup timestamp (OAuth proves ownership). Omitted when no claim exists. |

This request requires `settings:read`.

### Update Tenant Config

`PUT /tenants/{tenant_id}/config`

Update the organization's settings. All three TenantConfig fields are required.

```bash
curl -X PUT https://api.laserdata.cloud/tenants/{tenant_id}/config \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "join_policy": "open",
  "block_external_invitations": true,
  "enforce_domain_only_invitations": true
}'
```

A successful request returns `204 No Content`. Repeating unchanged configuration publishes no event. A lock flag set to `true` without `email_domain` returns `400 tenant_has_no_email_domain`.

Join policies: `invite_only`, `open`, `request_to_join`

* `open` joins matching-domain users with the system `viewer` role and notifies the owner.
* `request_to_join` creates a pending request and notifies the owner, who must approve it.
* `invite_only`, the default, leaves matching-domain users waiting for an invitation without notifying the owner.

A change publishes the `tenant_config_updated` audit event.

This request requires `settings:manage`.

### Request Resource Code

`PUT /tenants/{tenant_id}/request_code`

Request a one-time protection code for deleting a protected resource. The code is sent to the organization email.

```bash
curl -X PUT https://api.laserdata.cloud/tenants/{tenant_id}/request_code \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "action": {
    "action_type": "delete_deployment",
    "payload": {
      "tenant_id": 615380456123456789,
      "workspace_id": 615380456123456790,
      "environment_id": 615380456123456791,
      "deployment_id": 611298765432109056
    }
  }
}'
```

In `action`, `action_type` selects the operation and `payload` supplies its resource IDs:

| Action Type | Payload Fields |
| --- | --- |
| `delete_tenant` | `tenant_id` |
| `delete_workspace` | `tenant_id`, `workspace_id` |
| `delete_environment` | `tenant_id`, `workspace_id`, `environment_id` |
| `delete_deployment` | `tenant_id`, `workspace_id`, `environment_id`, `deployment_id` |

The endpoint returns `204 No Content` and emails the code. Supply it as `code` on the matching delete request. Requests are rate limited per resource.

### Delete Tenant

`DELETE /tenants/{tenant_id}`

Permanently delete the tenant and all resources. Requires a protection code.

```bash
curl -X DELETE "https://api.laserdata.cloud/tenants/{tenant_id}?code={protection_code}" \
-H "ld-api-key: YOUR_API_KEY"
```

Only the tenant owner can delete it. Deletion is irreversible.

***

## Workspaces

### Create Workspace

`POST /tenants/{tenant_id}/workspaces`

Create a new workspace within the tenant.

```bash
curl -X POST https://api.laserdata.cloud/tenants/{tenant_id}/workspaces \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "name": "platform",
  "description": "Core platform team",
  "email": "platform@acme.com"
}'
```

| Field | Required | Description |
| --- | --- | --- |
| `name` | Yes | Workspace name |
| `description` | No | Optional description |
| `email` | No | Optional contact email for this workspace |

### List Workspaces

`GET /tenants/{tenant_id}/workspaces`

List the workspaces that the caller can see.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id}/workspaces \
-H "ld-api-key: YOUR_API_KEY"
```

### Update Workspace

`PUT /tenants/{tenant_id}/workspaces/{workspace_id}`

Rename a workspace.

```bash
curl -X PUT https://api.laserdata.cloud/tenants/{tenant_id}/workspaces/{workspace_id} \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "name": "platform-team"
}'
```

### Delete Workspace

`DELETE /tenants/{tenant_id}/workspaces/{workspace_id}`

Delete a workspace. All environments inside must be empty. API keys limited to the workspace are deleted with it. Requires a protection code if the workspace is protected.

```bash
curl -X DELETE "https://api.laserdata.cloud/tenants/{tenant_id}/workspaces/{workspace_id}?code={protection_code}" \
-H "ld-api-key: YOUR_API_KEY"
```

***

## Environments

### Create Environment

`POST /tenants/{tenant_id}/workspaces/{workspace_id}/environments`

Create a new environment inside a workspace.

```bash
curl -X POST https://api.laserdata.cloud/tenants/{tenant_id}/workspaces/{workspace_id}/environments \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "name": "production"
}'
```

### List Environments

`GET /tenants/{tenant_id}/workspaces/{workspace_id}/environments`

List the environments of a workspace that the caller can see.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id}/workspaces/{workspace_id}/environments \
-H "ld-api-key: YOUR_API_KEY"
```

### Update Environment

`PUT /tenants/{tenant_id}/workspaces/{workspace_id}/environments/{environment_id}`

Rename an environment.

```bash
curl -X PUT https://api.laserdata.cloud/tenants/{tenant_id}/workspaces/{workspace_id}/environments/{environment_id} \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "name": "production-v2"
}'
```

### Delete Environment

`DELETE /tenants/{tenant_id}/workspaces/{workspace_id}/environments/{environment_id}`

Delete an environment. Must have no active deployments.

```bash
curl -X DELETE "https://api.laserdata.cloud/tenants/{tenant_id}/workspaces/{workspace_id}/environments/{environment_id}?code={protection_code}" \
-H "ld-api-key: YOUR_API_KEY"
```

***

## Supervisor: Org Summaries

These Supervisor endpoints summarize runtime data within one region.

### Tenant Summary (Supervisor)

`GET {supervisor_url}/tenants/{tenant_id}/summary`

Aggregated deployment health and resource stats from this supervisor region. Requires `deployment:read` in every environment of the organization.

```bash
curl {supervisor_url}/tenants/{tenant_id}/summary \
-H "ld-api-key: YOUR_API_KEY"
```

### Workspace Summary (Supervisor)

`GET {supervisor_url}/tenants/{tenant_id}/workspaces/{workspace_id}/summary`

Per-workspace deployment health summary from this supervisor region. Requires `deployment:read` in every environment of the workspace.

```bash
curl {supervisor_url}/tenants/{tenant_id}/workspaces/{workspace_id}/summary \
-H "ld-api-key: YOUR_API_KEY"
```

- [Members & Roles](/api/members): Manage users, roles, and invitations
- [Deployments](/api/deployments): Create and manage deployments
- [Organization Guide](/organization): Console walkthrough for the org hierarchy

Source: https://docs.laserdata.com/api/organization
