Skip to main content

Delete a Knowledge Base using the API

How to Delete a Knowledge Base

If you need to delete a Knowledge Base, you can do so by using the Snack Prompt API through the appropriate endpoint for deleting elementals. To perform this action, you must be authenticated with your API Key.


Authenticating with Your API Key

To authenticate your API requests, include your API Key in the header:

x-api-key: YOUR_API_KEY
How to Generate an API Key

To generate an API Key, follow these steps:

  1. Log in to your Snack Prompt account.
  2. Navigate to the API Keys page: https://snackprompt.com/api-keys.
  3. Click the Create New API Key button.
  4. Provide a name for your Key to easily identify it later.
  5. Once created, you can:
    • Copy the Key for immediate use.
    • Delete the Key when it's no longer needed.
Note: API Keys do not have an expiration date and will remain valid until deleted.
How to generate an API Key

How to Delete a Knowledge Base Using the API

To delete a Knowledge Base, make a DELETE request to the /v1/elemental/{id} endpoint.

1. Get Your Knowledge Base ID

If you don't know your Knowledge Base ID, you can get it by:

  • Open your Knowledge Base in Snack Prompt

  • Click the three-dot menu at the top of the Knowledge Base

  • Select "Copy the ID"

Example of a valid Knowledge Base ID: hoewEL19T. The ID is always a string of characters (nanoId).

How to get your Knowledge Base ID

2. Make the DELETE API Request

Here's how to delete the Knowledge Base:

curl -X DELETE "https://api-integrations.snackprompt.com/v1/elemental/{id}"\
-H "x-api-key: YOUR_API_KEY"

How to delete a Knowledge Base

Example Response

{
"code": 201,
"meta": {
"version": "v1.0.2",
"is_authenticaded": true
}
}

Code Examples

You can also use the Snack Prompt API in different programming languages:

const response = await fetch(
"https://api-integrations.snackprompt.com/v1/elemental/{id}",
{
method: "DELETE",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
);

if (response.ok) {
console.log("Knowledge Base deleted successfully");
} else {
console.error("Failed to delete Knowledge Base");
}

For more information, refer to the API Reference here.