Skip to main content

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

pageSize
number
Number of results per page (alternative to limit)
limit
number
default:"25"
Maximum number of groups to return
cursor
string
Pagination cursor (alternative to after)
after
string
Cursor for next page
name
string
Filter by group name
category
string
Filter by category

Response

data
TPromptGroup[]
Array of prompt groups
pageNumber
string
Current page number (always “1” for cursor pagination)
pageSize
string
Page size
hasMore
boolean
Whether more pages exist
after
string
Cursor for next page
{
  "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

name
string
Filter by group name (partial match)
category
string
Filter by category

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

groupId
string
required
Prompt group ID

Response

_id
string
Unique group identifier
name
string
Group name
description
string
Group description
author
string
Author user ID
authorName
string
Author display name
category
string
Category name
productionId
string
ID of the production (main) prompt in this group
isPublic
boolean
Whether the group is publicly accessible
prompts
TPrompt[]
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

group
object
required
Prompt group configuration
group.name
string
required
Group name
group.description
string
Group description
group.category
string
Category name
group.oneliner
string
Short one-line description
prompt
object
required
Initial prompt to add to the group
prompt.prompt
string
required
Prompt text/content
prompt.title
string
Prompt title

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

groupId
string
required
Prompt group ID

Request Body

prompt
object
required
Prompt to add
prompt.prompt
string
required
Prompt text/content
prompt.title
string
Prompt title
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

groupId
string
required
Prompt group ID

Request Body

All fields are optional:
name
string
New group name
description
string
New description
category
string
New category
oneliner
string
New one-liner
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

groupId
string
required
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

groupId
string
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

promptId
string
required
Prompt ID
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

promptId
string
required
Prompt ID to delete

Query Parameters

groupId
string
required
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

promptId
string
required
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;
}

Build docs developers (and LLMs) love