Skip to main content

/content

Learn how to efficiently add, update, and delete files in Promptitude's Content Storage using various methods for your business needs.

Promptitude Team avatar
Written by Promptitude Team
Updated this week

Promptitude's Content Storage provides a flexible way to manage your files and documents. This article guides you through adding new content, updating existing files, and removing content when needed via API. Whether you're uploading documents, importing from URLs, from GitHub, or managing text content, Promptitude offers multiple methods to suit your workflow.

Understanding Content Storage Basics

Before diving into specific actions, it's helpful to understand how Promptitude's Content Storage works:

  • Content Storage is Promptitude's file management system that stores documents and files for your prompts, assistants and chats.

  • All content is organized into folders for easy management

  • Each piece of content has a unique ID and can also have an optional external ID that you define

  • You can add metadata like descriptions and tags to make content more searchable

🔐 Authentication

To use any of the endpoints described below, you must include your Promptitude API Key in the request header.

  • Header: Authorization

  • Type: Bearer Token

  • Value: YOUR_API_KEY

⚙️ General Configuration

The "Upsert" Logic

The Content API functions as an upsert system. This means the same endpoint is used for both creating and updating files, depending on the URL provided:

  1. Create New Content: Send a POST request to the base URL.

    • POST <https://api.promptitude.io/v1/content>

  2. Update Existing Content: Send a POST request including the ID. You can use the document's original ID or its externalId.

    • POST <https://api.promptitude.io/v1/content/{INTERNAL_OR_EXTERNAL_ID}>

Mandatory Parameter (All Methods)

For every request, regardless of the method used, the following parameter is mandatory:

  • folder (string): The name of the folder you want to associate with the Content Storage. If the folder does not exist, it will be created automatically.


📌 Methods to Add/Update Content

There are 5 ways to send content to your tenant. Choose the method that fits your integration best.

Endpoints:

  • To Add: POST <https://api.promptitude.io/v1/content>

  • To Update: POST <https://api.promptitude.io/v1/content/{INTERNAL_OR_EXTERNAL_ID}>

1️⃣ Via Public URL

Use this method to import a file from a publicly accessible URL. Payload Type: JSON or form-data

Required Parameters:

  • fileUrl: The direct URL of the file.

  • folder: Target folder name.

⚠️ Important Note for Google Drive Users
If you are importing from Google Drive, you must follow these specific rules due to Google's security restrictions:

  1. Public Access: The file must be shared publicly ("Anyone with the link can view").

  2. URL Format: You must use the ID-based URL format: https://drive.google.com/file/d/{file_id}

If the file is not public, the API cannot access the content.

Example from Postman:

2️⃣ Via Multipart/Form-Data (File Attachment)

Use this method to upload a binary file directly from your system.

Payload Type: multipart/form-data

Required Parameters:

  • file: The actual file object.

  • fileExtension: The extension of the file (e.g., pdf, txt).

  • folder: Target folder name.

Example from Postman:

3️⃣ Via Plain Text

Use this to create a file by sending raw text directly in the body.

Payload Type: JSON or form-data

Required Parameters:

  • textContent: The plain text string you want to save.

  • folder: Target folder name.

Example from Postman:

4️⃣ Via Base64 (Text or File)

Use this method to upload either raw text or binary files encoded as Base64 strings.

Payload Type: JSON or form-data

Required Parameters:

  • base64Content: The content encoded in Base64.

  • fileExtension: The file extension (see rules below).

  • folder: Target folder name.

⚠️ File Extension Rules:

  • For Text: If you are encoding plain text, you must set the fileExtension to txt.

  • For Files: If you are encoding a file (like a PDF), you must specify the original file extension (e.g., pdf) to ensure the system detects and processes it correctly.

Example from Postman:

5️⃣ Via GitHub Pull Request

Use this to import content directly from a GitHub repository.

Payload Type: JSON or form-data

Required Parameters:

  • downloadUrl: The raw file URL generated by GitHub (e.g., **<https://raw.git>…R27HN5XNTE2L6CS**).

  • folder: Target folder name.

  • fileExtension: The extension of the file (e.g., pdf, txt). (Optional. Helps the system correctly detect and process the file type.)

Example from Postman:


Optional Metadata Parameters

You can include these optional parameters with any of the methods above to enrich your content metadata.

⚠️ Update Behavior

  • Creation: When creating a new file, these parameters are saved exactly as provided.

  • Update: When updating an existing file, the data sent in the request will overwrite the previously saved values.

Parameter

Type

Description

name

string

A custom name for the file in the storage.

description

string

A brief description of the content.

tags

string array

A list of tags for categorization (e.g., ["finance", "2024"]).

externalId

string

Your own system's ID for this file (useful for updates).

fileExtension

string

Explicitly set the extension (if not already required by the method).

size

number

Explicitly set the file size.

Content API: Response Structure

When you successfully create or update a file using the Content Endpoint, the API returns a JSON object containing the details of the stored file.

Success Response Example

The following JSON illustrates the standard response structure received after a successful operation.

{
"message": "Content Storage created successfully!",
"contentStorageProperties": {
"id": "oN5ppXsp8UQ4...",
"name": "fileName.txt",
"description": "",
"fileName": "fileName.txt",
"fileType": "txt",
"contentType": "text/plain",
"size": 346,
"status": "waiting",
"creationDate": {
"_seconds": 1764167330,
"_nanoseconds": 147000000
},
"creationUser": "Promptitude Content API",
"creationUserId": "promptitude_content_api",
"tagsIds": [],
"foldersIds": "r2cdFnT2GC..."
}
}

🔔 Note on Updates: When performing an Update operation, the response payload is optimized. It will return only the mandatory fields and the specific fields that were actually updated in that request.


📌 Delete Content

To delete a file, send a DELETE request to the specific URL of the content you wish to remove. You do not need to send a body payload with this request.

Endpoint: DELETE <https://api.promptitude.io/v1/content/{ID}>

URL Configuration

You must replace {ID} in the URL with the identifier of the file you want to delete. The API supports both types of identifiers:

ℹ️ ID Types Supported

  • Internal ID: The unique ID generated by Promptitude when the file was created (e.g., j21IUQrYCSqWoF...).

  • External ID: The custom externalId you assigned to the file during creation or update.

Example from Postman:

🔔 Important: Deletion is permanent and cannot be undone. Make sure you have backups of any important files before deleting them.

💡 Troubleshooting Common Issues

If you encounter problems while managing content:

  • File not uploading: Check that your file format is supported and within size limits.

  • URL import failing: Verify that the URL is publicly accessible and doesn't require authentication.

  • Google Drive issues: Ensure your Google Drive sharing settings are set to "Anyone with the link can view".

  • Content not appearing: Refresh your browser or check that you're looking in the correct folder.

Promptitude's Content Storage gives you flexible options for managing your files and documents. Whether you're adding new content, updating existing files, or removing outdated information, the system is designed to be intuitive and powerful. By organizing your content effectively, you'll create a valuable resource library that enhances your prompt management capabilities.

For more advanced operations or bulk management, consider using Promptitude's API, which offers additional functionality for programmatic content management.

Did this answer your question?