Documentation Index
Fetch the complete documentation index at: https://docs.gateways.app/llms.txt
Use this file to discover all available pages before exploring further.
Workspaces API
Workspaces are organizational units that allow multiple users to collaborate on projects. Each workspace has a pricing plan, and billing is managed at the workspace level. Users can be members of multiple workspaces with different roles (owner, admin, member).Base Endpoint
Authentication
All workspace endpoints require authentication. Include your JWT token in the Authorization header:Workspace Roles
- owner: Full control over the workspace, including deletion and member management
- admin: Can manage members and update workspace settings (except deletion)
- member: Can view and access workspace resources
Endpoints
List Workspaces
Get all workspaces the current user is a member of. Endpoint:GET /api/workspaces
Headers:
Get Workspace Details
Get detailed information about a specific workspace, including pricing plan details and the user’s role. Endpoint:GET /api/workspaces/:workspaceSlug
Parameters:
workspaceSlug(path) - The slug of the workspace
400 Bad Request: Missing required fields (e.g.,name), invalid name length (must be 1-100 characters), or invalid description length (must be at most 350 characters)401 Unauthorized: Missing or invalid authentication token500 Internal Server Error: Failed to create workspace
Check Workspace Name Availability
Check if a workspace name (slug) is available globally before creating a workspace. Endpoint:GET /api/workspaces/check-name
Authentication: Required
Query Parameters:
name(required): The workspace name to check
name: The trimmed name that was checkedslug: The generated slug from the nameavailable:trueif the slug is available (not taken),falseif it’s already in use
400 Bad Request: Missing or invalidnamequery parameter401 Unauthorized: Missing or invalid authentication token500 Internal Server Error: Failed to check name availability
Create Workspace
Create a new workspace (JSON only). The user who creates the workspace automatically becomes the owner. For workspace profile image, use Upload Workspace Profile Image after creation. Endpoint:POST /api/workspaces
Headers:
- Slug is automatically generated from name - it cannot be provided in the request body
- Name must be between 1 and 100 characters
- Description must be at most 350 characters (optional)
- Profile image is not set on create; use
POST /api/workspaces/:workspaceSlug/profile/imageafter creation - Use the JavaScript function in the “Slug Generation” section below to preview the slug that will be generated
- New workspaces are automatically assigned the “Free” pricing plan
- The creator is automatically added as an owner
- Workspace slug is automatically generated from the name
Slug Generation
Slugs are automatically generated from names using the following JavaScript function. You can use this function in your frontend to preview the slug that will be generated:"My Awesome Workspace"→"my-awesome-workspace""Team Workspace"→"team-workspace""Dev_Workspace"→"dev-workspace""API-Workspace@2024"→"api-workspace2024""---Special---"→"special"" Spaces "→"spaces"
- Name must be between 1 and 100 characters
- Any characters are allowed in the name - the slug will be generated automatically
Get Workspace Usage
Get usage statistics for a workspace, including current usage and plan limits for projects, environments, resources, and cloud connections. Endpoint:GET /api/workspaces/:workspaceSlug/usage
Parameters:
workspaceSlug(path) - The slug of the workspace
workspace- Workspace details (id, slug, name)plan- Current pricing plan (id, slug, name)usage.projects- Project usage (current count, limit, percentage used, unlimited flag)usage.environments- Total environment count across all projects (no global limit)usage.resources- Total resource count across all projects (current, limit, percentage, unlimited)usage.cloudConnections- Cloud connection usage (current, limit, percentage, unlimited). Only connections that are active and inconnectedstatus are counted; pending, failed, or disconnected connections do not count toward the limit.
- If
limitisnull, the plan has unlimited resources for that category - If
unlimitedistrue, there is no limit enforced percentageis calculated as(current / limit) * 100and capped at 100
401 Unauthorized- User ID not found400 Bad Request- Invalid workspace slug404 Not Found- Workspace does not exist403 Forbidden- User does not have access to this workspace500 Internal Server Error- Failed to retrieve workspace usage
List Workspace Projects
Get all projects for a specific workspace. Only members of the workspace can access this endpoint. Endpoint:GET /api/workspaces/:workspaceSlug/projects
Parameters:
workspaceSlug(path) - The slug of the workspace
include_inactive(optional) - Include inactive projects (true/false, default:false)
401 Unauthorized- User ID not found400 Bad Request- Invalid workspace slug404 Not Found- Workspace does not exist403 Forbidden- User does not have access to this workspace500 Internal Server Error- Failed to retrieve projects
Update Workspace
Update workspace settings (JSON only). Only owners and admins can update. For profile image, use Upload Workspace Profile Image instead. Endpoint:PATCH /api/workspaces/:workspaceSlug
Parameters:
workspaceSlug(path) - The slug of the workspace
planIdcannot be changed via this endpoint. To change workspace plans, use the Payment APIs- Description must be at most 350 characters
- Profile image cannot be set here; use
POST /api/workspaces/:workspaceSlug/profile/image POST /api/payments/workspace/:workspaceSlug/upgrade-plan- Upgrade plan (requires payment)POST /api/payments/workspace/:workspaceSlug/downgrade-plan- Downgrade plan (immediate, no charge)
400 Bad Request: Invalid name length (must be 1-100 characters) or invalid description length (must be at most 350 characters)401 Unauthorized: Missing or invalid authentication token403 Forbidden: User is not an owner or admin404 Not Found: Workspace does not exist500 Internal Server Error: Failed to update workspace400 Bad Request- Attempted to change planId (use Payment APIs instead)
POST /api/payments/workspace/:workspaceSlug/upgrade-plan- Upgrade plan (requires payment)POST /api/payments/workspace/:workspaceSlug/downgrade-plan- Downgrade plan (immediate)
Upload Workspace Profile Image
Upload a workspace profile image file (same behavior as user profile image). The image is optimized (resized to max 512px, compressed as JPEG) and stored in S3; the workspace’sprofileImage is updated with the returned URL. Only workspace owners and admins can upload.
Endpoint: POST /api/workspaces/:workspaceSlug/profile/image
Parameters:
workspaceSlug(path) - The slug of the workspace
multipart/form-data with a single file field:
- profileImage (required): Image file (JPEG, PNG, GIF, or WebP). Max size is configurable (default 2MB; set
PROFILE_IMAGE_MAX_SIZE_MBin env, 0.5–10).
400 Bad Request: Missing file, file too large (seePROFILE_IMAGE_MAX_SIZE_MB), or invalid content type (must be image/jpeg, image/png, image/gif, or image/webp)401 Unauthorized: Missing or invalid authentication token403 Forbidden: User is not an owner or admin of the workspace404 Not Found: Workspace does not exist503 Service Unavailable: Profile storage not configured (PROFILE_STORAGE_BUCKET)500 Internal Server Error: Upload or update failed
Set Default Workspace
Set a workspace as the user’s default workspace. The user must be a member of the workspace. Endpoint:PATCH /api/workspaces/:workspaceSlug/set-default
Parameters:
workspaceSlug(path) - The slug of the workspace to set as default
401 Unauthorized- User ID not found400 Bad Request- Invalid workspace slug404 Not Found- Workspace does not exist403 Forbidden- User does not have access to this workspace500 Internal Server Error- Failed to set default workspace
Delete Workspace
Delete a workspace (soft delete). Only owners can delete workspaces. Password confirmation is required and you must have at least one other workspace remaining. Endpoint:DELETE /api/workspaces/:workspaceSlug
Parameters:
workspaceSlug(path) - The slug of the workspace
defaultWorkspaceUpdated: true and newDefaultWorkspaceId indicating the new default workspace.
Example:
400 Bad Request- Missing password, password authentication not available, or user has only one workspace401 Unauthorized- Invalid password or missing authentication token403 Forbidden- User is not an owner of the workspace404 Not Found- Workspace does not exist
- Password confirmation is required for this sensitive operation
- You cannot delete your last workspace - you must have at least one workspace remaining
- Only workspace owners can delete workspaces
- This is a soft delete operation (workspace is marked as inactive)
- This is a soft delete operation
- All projects and resources in the workspace will be affected
- If you delete your default workspace, the system will automatically set your oldest remaining workspace (by creation date) as the new default
- The response will include
defaultWorkspaceUpdatedandnewDefaultWorkspaceIdif the default workspace was changed
Transfer Workspace Ownership
Transfer workspace ownership to another account. Only the current owner can initiate a transfer. The current owner becomes an admin after the transfer; the target user becomes the owner. The target user is specified by email. If the target user is not already a member, they are added as owner. Endpoint:POST /api/workspaces/:workspaceSlug/transfer
Parameters:
workspaceSlug(path) - The slug of the workspace
email(string, required) - Email of the account to transfer ownership to
400- Missing or invalidemail, transferring to yourself, or you own only this workspace. You must own at least one other workspace before transferring this one. Create or get ownership of another workspace first.403- Only the workspace owner can transfer ownership404- Workspace not found, or no user found for the given email
- Only the current owner can transfer ownership
- You must own at least one other workspace before transferring this one. Create or get ownership of another workspace first; otherwise the transfer is rejected.
- You cannot transfer the workspace to yourself
- The previous owner retains access as an admin
- If the target user is already a member, their role is updated to
owner; otherwise they are added as a member with roleowner
Workspace Members
List Workspace Members
Get all members of a workspace. Optionally filter by project and/or environment to return only members who have access to that project/environment. Endpoint:GET /api/workspaces/:workspaceSlug/members
Parameters:
workspaceSlug(path) - The slug of the workspaceprojectSlug(query, optional) - Filter members by project slug. Returns only members who have access to this projectenvironmentSlug(query, optional) - Filter members by environment slug. RequiresprojectSlugto be provided. Returns only members who have access to this specific environment
404 Not Found- Workspace, project, or environment does not exist403 Forbidden- User does not have access to this workspace
- If
projectSlugis provided, only members who have access to that project (based on theirprojectPermissions) will be returned - If both
projectSlugandenvironmentSlugare provided, only members who have access to that specific environment will be returned - Members with
projectPermissionsset to"*"ornullhave access to all projects and will always be included - The
filterobject in the response is only included when filter parameters are provided
Add Workspace Member (Send Invitation)
Send an invitation to a user to join a workspace by email. The invitation must be accepted by the user before they are added to the workspace. Only owners and admins can send invitations. Endpoint:POST /api/workspaces/:workspaceSlug/members
Parameters:
workspaceSlug(path) - The slug of the workspace
"*"(string) - Grants access to all projects and all environments in the workspace- Array of strings - Grants access to specific project/environment combinations:
"projectSlug/environmentSlug"- Specific project and environment (e.g.,"my-project/master")"projectSlug/*"- All environments in a specific project (e.g.,"my-project/*")- Example:
["project/master", "project/dev", "project1/master", "project3/*"]
projectPermissions must exist in the workspace. Invalid project/environment combinations will return a validation error.
Response:
- An invitation is created whether the user exists or not
- Existing users will receive an invitation that they must accept
- New users will receive an invitation that they can accept after signing up
- The invitation expires after 7 days by default
400 Bad Request- Missing email, invalid role, invalid permissions, or invalid projectPermissions (e.g., non-existent project/environment, invalid format)404 Not Found- Workspace not found403 Forbidden- User is not an owner or admin409 Conflict- A pending invitation already exists for this email, or user is already a member of the workspace
- If
projectPermissionsis an array but contains invalid format:"Invalid format: "entry". Expected format: "projectSlug/environmentSlug" or "projectSlug/*"" - If a project doesn’t exist:
"Project "projectSlug" does not exist in this workspace" - If an environment doesn’t exist:
"Environment "environmentSlug" does not exist in project "projectSlug"" - If mixing ”*” with array:
"Cannot mix "*" with specific project/environment entries"
Update Member Role and Project Permissions
Update a member’s role and/or project permissions in the workspace. Only owners and admins can update member roles and permissions. Custom permissions are not allowed - all permissions are defined by the role. Endpoint:PATCH /api/workspaces/:workspaceSlug/members/:userId
Parameters:
workspaceSlug(path) - The slug of the workspaceuserId(path) - The ID of the user whose role/permissions to update
"*"(string) - Grants access to all projects and all environments in the workspace- Array of strings - Grants access to specific project/environment combinations:
"projectSlug/environmentSlug"- Specific project and environment (e.g.,"my-project/master")"projectSlug/*"- All environments in a specific project (e.g.,"my-project/*")- Example:
["project/master", "project/dev", "project1/master", "project3/*"]
projectPermissions must exist in the workspace. Invalid project/environment combinations will return a validation error.
Response:
400 Bad Request- Missing role, invalid role value, or invalid projectPermissions (e.g., non-existent project/environment, invalid format)404 Not Found- Workspace or member not found403 Forbidden- User is not an owner or admin
- If
projectPermissionsis an array but contains invalid format:"Invalid format: "entry". Expected format: "projectSlug/environmentSlug" or "projectSlug/*"" - If a project doesn’t exist:
"Project "projectSlug" does not exist in this workspace" - If an environment doesn’t exist:
"Environment "environmentSlug" does not exist in project "projectSlug"" - If mixing ”*” with array:
"Cannot mix "*" with specific project/environment entries"
Workspace Roles and Permissions
Available Roles
| Role | Description | Key Permissions |
|---|---|---|
owner | Workspace owner with full access | All permissions, can delete workspace |
admin | Administrative access | All permissions except deleting workspace |
billing | Billing and financial access | Manage billing, payment methods, invoices, view resources (read-only for costs) |
dev | Developer access | Manage projects, environments, resources (full CRUD) |
viewer | Read-only access | View resources and activities only |
member | Default member role | Same as viewer (legacy support) |
Permission Types
All permissions are boolean flags that control access to specific workspace features:| Permission | Description |
|---|---|
canManageWorkspace | Update workspace settings, delete workspace |
canManageMembers | Add/remove members, change roles and permissions |
canManageBilling | Manage payment methods, view invoices, upgrade/downgrade plans |
canManageProjects | Create/update/delete projects |
canManageEnvironments | Create/update/delete environments |
canViewResources | View all resources (instances, databases, etc.) |
canCreateResources | Create new resources |
canUpdateResources | Update existing resources |
canDeleteResources | Delete resources |
canViewActivities | View activity logs |
canManageSettings | Manage workspace and project settings |
Default Permissions by Role
Owner:- All permissions enabled
- All permissions enabled except
canManageWorkspace(cannot delete workspace)
canManageBilling: ✅canViewResources: ✅ (to understand costs)canViewActivities: ✅- All other permissions: ❌
canManageProjects: ✅canManageEnvironments: ✅canViewResources: ✅canCreateResources: ✅canUpdateResources: ✅canDeleteResources: ✅canViewActivities: ✅- All other permissions: ❌
canViewResources: ✅canViewActivities: ✅- All other permissions: ❌
- Same as Viewer (legacy support)
Custom Permissions
When adding or updating a member, you can provide custom permissions that override the role defaults:Get Member Permissions
Get the effective permissions and project permissions for a workspace member. Returns role-based permissions and project permissions (if set). Endpoint:GET /api/workspaces/:workspaceSlug/members/:userId/permissions
Parameters:
workspaceSlug(path) - The slug of the workspaceuserId(path) - The ID of the user
400 Bad Request- Invalid user ID404 Not Found- Workspace or member not found403 Forbidden- User does not have access to this workspace
permissions- Contains role-based permissions (defined by the role)projectPermissions- Contains project/environment access restrictions (null if not set, ”*” for all, or array of specific project/environment combinations)
Remove Workspace Member
Remove a member from a workspace. Only owners and admins can remove members. Endpoint:DELETE /api/workspaces/:workspaceSlug/members/:userId
Parameters:
workspaceSlug(path) - The slug of the workspaceuserId(path) - The ID of the user to remove
400 Bad Request- Cannot remove the last owner from a workspace404 Not Found- Workspace or member not found403 Forbidden- User is not an owner or admin
- You cannot remove the last owner from a workspace
- To remove the last owner, you must either transfer ownership to another member first or delete the workspace
Workspace Roles
List Workspace Roles
Get all available workspace roles with their permissions. Roles are managed by administrators and cannot be created, updated, or deleted by users. Endpoint:GET /api/workspaces/roles
Headers:
include_inactive(optional): Include inactive roles. Set to"true"to include inactive roles. Default:false
Note: Roles are managed by system administrators. Users cannot create, update, or delete roles. All permissions are defined by the role - custom permission overrides are not allowed.
Workspace Invitations
Get Pending Invitations
Get all pending workspace invitations for the current user. Endpoint:GET /api/workspaces/invitations/pending
Headers:
Accept Invitation
Accept a workspace invitation. This will add you to the workspace with the specified role. Endpoint:POST /api/workspaces/invitations/:invitationId/accept
Parameters:
invitationId(path) - The ID of the invitation to accept
404 Not Found- Invitation not found403 Forbidden- Invitation is not for your email address400 Bad Request- Invitation has already been accepted/expired/cancelled409 Conflict- You are already a member of this workspace
Decline Invitation
Decline a workspace invitation. This will mark the invitation as cancelled. Endpoint:POST /api/workspaces/invitations/:invitationId/decline
Parameters:
invitationId(path) - The ID of the invitation to decline
404 Not Found- Invitation not found403 Forbidden- Invitation is not for your email address400 Bad Request- Invitation has already been accepted/expired/cancelled
Workspace Integration with Other APIs
Projects
When creating a project viaPOST /api/projects, you can optionally specify a workspaceSlug in the request body:
workspaceSlug is not provided, the project will be created in the user’s first workspace.
All projects returned by GET /api/projects include a workspaceId field:
User Profile
The user profile endpointGET /api/users/profile now includes a workspaces array:
Pricing Plans
Workspaces are associated with pricing plans. When creating a workspace, it’s automatically assigned the “Free” plan. Important: Plan changes must be done through the Payment APIs, not via the workspace update endpoint:- Use
POST /api/payments/workspace/:workspaceSlug/upgrade-planto upgrade to a paid plan (requires payment) - Use
POST /api/payments/workspace/:workspaceSlug/downgrade-planto downgrade to a lower tier (immediate, no refund)
Access Control
All resource operations (creating projects, environments, resources, etc.) now check workspace membership instead of user ownership. Users must be members of a workspace to access projects and resources within that workspace. When accessing resources via project slugs (e.g.,GET /api/:projectSlug/:environmentSlug/resources), the system:
- Finds the project by slug
- Identifies the workspace associated with the project
- Verifies the user is a member of that workspace
- Returns 403 Forbidden if the user is not a workspace member
Error Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request (missing fields, invalid data) |
| 401 | Unauthorized (missing or invalid token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not Found (workspace, user, or member not found) |
| 409 | Conflict (member already exists) |
| 500 | Internal Server Error |
Examples
Complete Workflow: Create Workspace and Add Members
Notes
- Each user automatically gets a default workspace created on signup (named “‘s Workspace”)
- Workspaces can have multiple owners, but at least one owner must always exist
- Billing and plan restrictions are managed at the workspace level
- All projects belong to a workspace, and workspace membership determines access to projects and resources
- Project slugs are globally unique across all workspaces