Overview

The Workspaces API provides local SQLite persistence for organizing people, agents, and resources on the Allternit platform. A workspace is owned by a user and can include both human members and agent members. Owners can invite additional users via email, and workspace administrators can help manage membership and invitations. All workspace routes are mounted under /api and require a valid bearer token via the platform auth middleware.

Base URL

For local development:

Authentication

All requests must include a valid bearer token in the Authorization header. The authenticated user is resolved through the platform auth middleware and exposed to the routes as the caller’s user_id. See Authentication for details.

Workspace object

Member object

Invitation object

Endpoints

List workspaces

Returns all workspaces owned by the authenticated user or where the user is a member, ordered newest first.

Example request

Example response

Create a workspace

Creates a new workspace owned by the authenticated user. If slug is omitted, it is generated from name by lowercasing and replacing spaces with hyphens.

Request body

Example request

Example response

Get a workspace

Returns the full workspace record. The caller must be the owner or a member of the workspace.

Example request

Example response

Update a workspace

Updates the workspace name or description. The caller must be the workspace owner or have an owner or admin role in the workspace. Omitted fields keep their current values.

Request body

Example request

Example response

Delete a workspace

Deletes the workspace and all of its member and invitation rows. Only the workspace owner can delete a workspace.

Example request

Example response

List members

Returns all members of the workspace. Only the workspace owner can list members.

Example request

Example response

Add a member

Adds a user or agent member to the workspace. Only the workspace owner can add members. Either user_id or agent_id should be provided. If role is omitted, it defaults to member.

Request body

Example request

Example response

Remove a member

Removes a member from the workspace by membership ID. Only the workspace owner can remove members.

Example request

Example response

List invitations

Returns all pending email invitations for the workspace. The caller must be the owner or a member of the workspace.

Example request

Example response

Create an invitation

Creates an email invitation that expires in seven days. The caller must be the workspace owner or have an owner or admin role in the workspace. If role is omitted, it defaults to member.

Request body

Example request

Example response

Delete an invitation

Cancels a pending invitation. The caller must be the workspace owner or have an owner or admin role in the workspace.

Example request

Example response

Error codes