Overview
The Prompts API allows you to create, organize, and manage reusable prompts and prompt groups. Prompts can be shared, tagged, and organized into groups for better organization.
All prompt endpoints are prefixed with /api/prompts.
List Prompt Groups
Retrieve prompt groups with pagination:
GET /api/prompts/groups?limit=25&after=cursor_abc
Authorization: Bearer <token>
Query Parameters
Number of results per page (alternative to limit)
Maximum number of groups to return
Pagination cursor (alternative to after)
Response
Current page number (always “1” for cursor pagination)
{
"data": [
{
"_id": "group_abc123",
"name": "Code Review Prompts",
"description": "Prompts for code review and analysis",
"author": "user123",
"authorName": "John Doe",
"category": "development",
"productionId": "prompt_xyz",
"oneliner": "Quick code review prompts",
"isPublic": false,
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-16T14:00:00Z"
}
],
"pageNumber": "1",
"pageSize": "25",
"hasMore": true,
"after": "cursor_next"
}
Get All Prompt Groups
Retrieve all accessible prompt groups (no pagination):
GET /api/prompts/all?name=code&category=development
Authorization: Bearer <token>
Query Parameters
Filter by group name (partial match)
Response
Returns an array of prompt groups:
[
{
"_id": "group_abc123",
"name": "Code Review Prompts",
"description": "Prompts for code review",
"author": "user123",
"isPublic": false,
"prompts": [
{
"_id": "prompt_xyz",
"prompt": "Review this code for security issues...",
"title": "Security Review"
}
]
}
]
Get Prompt Group
Retrieve a specific prompt group:
GET /api/prompts/groups/:groupId
Authorization: Bearer <token>
Path Parameters
Response
ID of the production (main) prompt in this group
Whether the group is publicly accessible
Array of prompts in this group
{
"_id": "group_abc123",
"name": "Code Review Prompts",
"description": "Comprehensive code review prompts",
"author": "user123",
"authorName": "John Doe",
"category": "development",
"productionId": "prompt_xyz",
"oneliner": "Quick code review",
"isPublic": false,
"prompts": [
{
"_id": "prompt_xyz",
"prompt": "Review this code for security, performance, and best practices...",
"title": "Comprehensive Review",
"tags": ["production"]
}
],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-16T14:00:00Z"
}
Create Prompt Group
Create a new prompt group with an initial prompt:
POST /api/prompts
Authorization: Bearer <token>
Content-Type: application/json
{
"group": {
"name": "Writing Prompts",
"description": "Creative writing assistance",
"category": "creative",
"oneliner": "Creative writing helpers"
},
"prompt": {
"prompt": "Help me write a compelling story opening...",
"title": "Story Opener"
}
}
Request Body
Prompt group configuration
Short one-line description
Initial prompt to add to the group
Response
Returns the created prompt group and prompt.
Note: The creator automatically receives OWNER permissions on the prompt group.
Add Prompt to Group
Add a new prompt to an existing group:
POST /api/prompts/groups/:groupId/prompts
Authorization: Bearer <token>
Content-Type: application/json
{
"prompt": {
"prompt": "Analyze this code for performance issues...",
"title": "Performance Analysis"
}
}
Path Parameters
Request Body
Requires EDIT permission on the prompt group.
Update Prompt Group
Update an existing prompt group:
PATCH /api/prompts/groups/:groupId
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Updated Group Name",
"description": "Updated description",
"category": "new-category"
}
Path Parameters
Request Body
All fields are optional:
Requires EDIT permission on the prompt group.
Delete Prompt Group
Delete a prompt group and all its prompts:
DELETE /api/prompts/groups/:groupId
Authorization: Bearer <token>
Path Parameters
Prompt group ID to delete
Response
{
"message": "Prompt group deleted successfully"
}
Requires DELETE permission on the prompt group.
Get Prompts
Retrieve prompts in a specific group:
GET /api/prompts?groupId=group_abc123
Authorization: Bearer <token>
Query Parameters
Filter by group ID (returns all prompts in the group)
If no groupId is provided, returns all prompts authored by the current user (admin users see all prompts).
Response
[
{
"_id": "prompt_xyz",
"groupId": "group_abc123",
"prompt": "Review this code for security issues...",
"title": "Security Review",
"tags": ["production"],
"author": "user123",
"createdAt": "2024-01-15T10:00:00Z"
}
]
Get Single Prompt
Retrieve a specific prompt:
GET /api/prompts/:promptId
Authorization: Bearer <token>
Path Parameters
Requires VIEW permission on the prompt’s group.
Delete Prompt
Delete a specific prompt:
DELETE /api/prompts/:promptId?groupId=group_abc123
Authorization: Bearer <token>
Path Parameters
Query Parameters
Group ID containing the prompt
Requires DELETE permission on the prompt’s group.
Mark Prompt as Production
Set a prompt as the production/main prompt in its group:
PATCH /api/prompts/:promptId/tags/production
Authorization: Bearer <token>
Path Parameters
Prompt ID to mark as production
Requires EDIT permission on the prompt’s group.
Categories
Get all available categories:
GET /api/categories
Authorization: Bearer <token>
Response
[
"development",
"creative",
"business",
"education",
"research"
]
Permissions
Prompt groups support fine-grained access control:
- VIEW: Can view prompts in the group
- EDIT: Can modify group and add/update prompts
- DELETE: Can delete group and prompts
- SHARE: Can share group with others
Public prompt groups are accessible to all users with VIEW permission.
Error Responses
Group Not Found
{
"message": "Prompt group not found"
}
HTTP Status: 404
Insufficient Permissions
{
"error": "Insufficient permissions to view prompts in this group"
}
HTTP Status: 403
Invalid Request Body
{
"error": "Invalid request body",
"details": [
{
"field": "name",
"message": "Name is required"
}
]
}
HTTP Status: 400
TypeScript Types
import type { TPromptGroup, TPrompt } from 'librechat-data-provider';
interface TPromptGroup {
_id: string;
name: string;
description?: string;
author: string;
authorName?: string;
category?: string;
productionId?: string;
oneliner?: string;
isPublic?: boolean;
prompts?: TPrompt[];
createdAt?: string;
updatedAt?: string;
}
interface TPrompt {
_id: string;
groupId: string;
prompt: string;
title?: string;
tags?: string[];
author: string;
createdAt?: string;
updatedAt?: string;
}