Workspace API
The Workspace API provides information about your workspace's plan, usage, and session context. It also includes owner-only management operations like ownership transfer and workspace deletion.
For a user guide on workspace settings in the dashboard, see Workspace Settings.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/workspace | Get workspace info, limits, and live usage |
GET | /v1/workspace/me | Get current session info (role, permissions) |
POST | /v1/workspace/transfer-ownership | Transfer ownership to another admin |
POST | /v1/workspace/delete | Schedule workspace deletion |
Get Workspace Info
Returns the current workspace's plan, limits (from the plans table), and live usage counters computed from source tables.
Auth: JWT (dashboard). Any authenticated member.
Response
| Field | Description |
|---|---|
monthly_email_limit | Max emails per month for the current plan |
contacts_limit | Max contacts allowed |
monthly_events_limit | Max events per month |
flows_limit | Max flows allowed (-1 = unlimited) |
data_retention_days | How long event data is retained |
monthly_emails_sent | Emails queued this calendar month (live count) |
contacts_count | Total contacts in the workspace (live count) |
monthly_events_used | Events ingested this calendar month (live count) |
events_today | Events ingested today (live count) |
active_flows_count | Number of flows with active status (live count) |
Get Session Info
Returns the current user's workspace context, role, and permissions. Useful for the dashboard to determine what UI elements to show based on the user's role.
Auth: JWT (dashboard). Any authenticated member.
Response
| Field | Description |
|---|---|
role | One of owner, admin, developer, marketing, operations, viewer |
permissions | Full list of granted permissions for this role |
default_from_email | Workspace's default sender email address |
default_sender_name | Workspace's default sender display name |
email_verified | Whether the user's email is verified (fetched from pyrx.auth) |
Transfer Ownership
Transfers workspace ownership from the current owner to another member. The target member must already be an admin in the workspace. After transfer, the previous owner is demoted to admin and the new owner receives the owner role.
Auth: JWT (dashboard). Requires ownership:transfer permission (owner only).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
new_owner_member_id | UUID | Yes | The member ID of the new owner (must be an active admin) |
Response (200)
Error Responses
400 -- Invalid transfer target:
403 -- Not the owner:
Ownership transfer is immediate and cannot be undone without the new owner transferring it back. Each workspace has exactly one owner, enforced by a database unique constraint.
Delete Workspace
Schedules the workspace for deletion with a 30-day grace period. During the grace period, the workspace can be recovered by contacting support.
Auth: JWT (dashboard). Requires workspace:delete permission (owner only).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
confirm_workspace_id | string | Yes | Must match the current workspace ID (safety confirmation) |
Response (200)
Error Responses
400 -- Confirmation mismatch:
403 -- Not the owner:
Workspace deletion is irreversible after the 30-day grace period. All contacts, events, flows, templates, and email logs will be permanently deleted. Cancel any active subscriptions before deleting the workspace.
RBAC Reference
| Role | Workspace Info | Session Info | Transfer Ownership | Delete Workspace |
|---|---|---|---|---|
| Owner | Yes | Yes | Yes | Yes |
| Admin | Yes | Yes | No | No |
| Developer | Yes | Yes | No | No |
| Marketing | Yes | Yes | No | No |
| Operations | Yes | Yes | No | No |
| Viewer | Yes | Yes | No | No |