AIN. - AnythingLLM API Integration

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM API Integration

AIN.DeleteWorkspace

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.DeleteWorkspace
Delete an AnythingLLM Workspace

 

Intention

 

DeleteWorkspace Command: Removing an AnythingLLM Workspace
 
The DeleteWorkspace command allows you to remove a specified workspace from the AnythingLLM system by its unique slug.

This is useful for cleaning up unused workspaces or managing resources efficiently.

It’s part of the AIN - AnythingLLM API suite.

 

What is the DeleteWorkspace Command?

 

The DeleteWorkspace command sends a DELETE request to the AnythingLLM API to remove a workspace identified by its slug.

You can optionally specify a variable to store the raw response, which confirms the deletion or provides error details if the operation fails.

 

Why Do You Need It?

 

Deleting a workspace is essential when:

You need to free up resources by removing obsolete workspaces.

Managing multiple workspaces and wanting to streamline your environment.

Testing or debugging requires resetting workspace states.

 

How to Use the DeleteWorkspace Command?

 

Call the command with the workspace slug and an optional variable for the response.

The workspace slug must match an existing workspace, which you can verify using AIN.ListWorkspaces or AIN.GetWorkspaceBySlug.

 

Example Usage

 

AIN.DeleteWorkspace|my-workspace|$$RES

DBP.Deletion Response: $$RES

 

This deletes the workspace "my-workspace" and stores the API response in $$RES.

 

Illustration

 

┌───────────────┐

│ Workspace     │

├───────────────┤

│ my-workspace  │

└───────────────┘

Before: Workspace exists; After AIN.DeleteWorkspace: Workspace is removed.

 

Syntax

 

AIN.DeleteWorkspace|P1[|P2]

AIN.DeleteWorkspace|P1[|P2]

 

Parameter Explanation

 

P1 - The workspace slug identifying the workspace to delete (required).

P2 - (Optional) Variable to store the raw API response (e.g., success message or error).

 

Example

 

AIN.CreateWorkspace|test-workspace

AIN.DeleteWorkspace|test-workspace|$$OUT

DBP.Deletion Result: $$OUT

ENR.

 

Remarks

 

- Requires a valid API key set via AIN.SetKey.

- The response is typically a JSON message confirming deletion or an error if the workspace doesn’t exist.

 

Limitations

 

- Cannot delete a workspace if the slug is invalid or the workspace doesn’t exist.

- Limited to 2 or 3 parameters as per the code; additional parameters trigger an error.

 

See also:

 

AIN.CreateWorkspace

AIN.ListWorkspaces

AIN.GetWorkspaceBySlug

Workspace Management