Spaces API

The Spaces API allows you to provision and manage user spaces within your workspace. Use this API to ensure users have properly configured spaces for their interactions with Sharely.ai.

What are Spaces?

Spaces in Sharely.ai represent individual user environments where conversations and interactions occur. Each user can have their own space within a workspace, providing:

  • Personalized conversation history
  • User-specific context and preferences
  • Isolated interaction environments
  • Role-based access control (when RBAC is enabled)

Available Endpoints

Generate Access Key Token

POST /workspaces/{workspaceId}/generate-access-key-token

Generate an access token for API authentication, optionally with role-based scoping.

Activate or Retrieve User Space

PUT /workspaces/{workspaceId}/activate-or-retrieve-user-space

Provision or retrieve a user space with optional role-based access control.

Get Space Information

GET /v1/workspaces/{workspaceId}/spaces/{spaceId}

Retrieve detailed information about a specific space.

RAG (Retrieval-Augmented Generation)

POST /v1/workspaces/{workspaceId}/spaces/{spaceId}/rag

Perform semantic search across workspace and space knowledge for AI augmentation.

Authentication Overview

The Spaces API uses a two-step authentication process for user space operations:

  1. Generate an Access Key Token - Use your workspace API key to generate a short-lived access token
  2. Use the Token - Include the token in subsequent API calls
Your Backend → Generate API Token → Create/Retrieve User Space → User Gets Space Token

For role-based access control (RBAC), you can include a role identifier when generating the access token. This role automatically propagates to all downstream operations.

See Generate Access Key Token and Activate or Retrieve User Space for complete details.

Common Use Cases

User Onboarding

Provision spaces for new users during your application's login or signup flow. See Activate or Retrieve User Space.

Role-Based Content Access

Create role-bound tokens to automatically scope all knowledge searches to user permissions. See Creating Role-Bound Tokens.

AI-Powered Search

Use the RAG endpoint to retrieve relevant content for AI-augmented responses. See RAG Endpoint.

Related Endpoints