Get Workspace

Retrieve workspace details including RBAC status and configuration.

Endpoint

GET /v1/workspaces/{workspaceId}

Authentication

Requires API key authentication with a valid access token.

Request

curl -X GET \
  'https://api.sharely.ai/v1/workspaces/{workspaceId}' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'organizationid: your-organization-id'

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstring (UUID)YesThe unique identifier of the workspace

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token with access token
organizationidstring (UUID)YesYour organization ID
Content-TypestringYesMust be application/json

Response

Success Response (200 OK)

{
  "id": "264393d7-6379-453a-9535-e2452e972fdc",
  "name": "My Workspace",
  "organizationId": "org-uuid",
  "rbacStatus": "ACTIVE",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-11-14T15:45:00Z",
  "settings": {
    "defaultLanguage": "en",
    "features": ["rbac", "multilingual"]
  }
}

Response Fields

FieldTypeDescription
idstring (UUID)Workspace unique identifier
namestringWorkspace name
organizationIdstring (UUID)Parent organization ID
rbacStatusstringRBAC mode: ACTIVE or INACTIVE
createdAtstring (ISO 8601)Workspace creation timestamp
updatedAtstring (ISO 8601)Last update timestamp
settingsobjectWorkspace configuration settings

Error Responses

401 Unauthorized

{
  "error": "Unauthorized",
  "message": "Invalid or missing access token"
}

403 Forbidden

{
  "error": "Forbidden",
  "message": "Insufficient permissions for this workspace"
}

404 Not Found

{
  "error": "Not Found",
  "message": "Workspace not found"
}

Example Usage

Node.js

const fetch = require('node-fetch');
 
async function getWorkspace(workspaceId, accessToken, organizationId) {
  const response = await fetch(
    `https://api.sharely.ai/v1/workspaces/${workspaceId}`,
    {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json',
        'organizationid': organizationId
      }
    }
  );
 
  if (!response.ok) {
    throw new Error(`Failed to get workspace: ${response.status}`);
  }
 
  return await response.json();
}

Python

import requests
 
def get_workspace(workspace_id, access_token, organization_id):
    response = requests.get(
        f'https://api.sharely.ai/v1/workspaces/{workspace_id}',
        headers={
            'Authorization': f'Bearer {access_token}',
            'Content-Type': 'application/json',
            'organizationid': organization_id
        }
    )
 
    response.raise_for_status()
    return response.json()

Related Endpoints